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
|
---|---|---|---|---|---|
Javascript | Javascript | add some esdoc definitions | fc6852f47dfe49232fe88a88b296079e2896150d | <ide><path>lib/SourceMapDevToolPlugin.js
<ide> const validateOptions = require("schema-utils");
<ide> const schema = require("../schemas/plugins/SourceMapDevToolPlugin.json");
<ide>
<ide> /** @typedef {import("../declarations/plugins/SourceMapDevToolPlugin").SourceMapDevToolPluginOptions} SourceMapDevToolPluginOptions */
<add>/** @typedef {import("./Chunk")} Chunk */
<add>/** @typedef {import("webpack-sources").Source} Source */
<add>/** @typedef {import("source-map").RawSourceMap} SourceMap */
<add>/** @typedef {import("./Module")} Module */
<add>/** @typedef {import("./Compilation")} Compilation */
<add>/** @typedef {import("./Compiler")} Compiler */
<add>/** @typedef {import("./Compilation")} SourceMapDefinition */
<ide>
<add>/**
<add> * @typedef {object} SourceMapTask
<add> * @property {Source} asset
<add> * @property {Array<string | Module>} [modules]
<add> * @property {string} source
<add> * @property {string} file
<add> * @property {SourceMap} sourceMap
<add> * @property {Chunk} chunk
<add> */
<add>
<add>/**
<add> * @param {string} name - file path
<add> * @returns {string} - file name
<add> */
<ide> const basename = name => {
<ide> if (!name.includes("/")) return name;
<ide> return name.substr(name.lastIndexOf("/") + 1);
<ide> };
<ide>
<add>/**
<add> * @type {WeakMap<Source, {file: string, assets: {[k: string]: ConcatSource | RawSource}}>}
<add> */
<ide> const assetsCache = new WeakMap();
<ide>
<add>/**
<add> * Creating {@link SourceMapTask} for given file
<add> * @param {string} file - current compiled file
<add> * @param {Chunk} chunk - related chunk
<add> * @param {SourceMapDevToolPluginOptions} options - source map options
<add> * @param {Compilation} compilation - compilation instance
<add> * @returns {SourceMapTask | undefined} - created task instance or `undefined`
<add> */
<ide> const getTaskForFile = (file, chunk, options, compilation) => {
<ide> const asset = compilation.assets[file];
<ide> const cache = assetsCache.get(asset);
<add> /**
<add> * If presented in cache, reassigns assets. Cache assets already have source maps.
<add> */
<ide> if (cache && cache.file === file) {
<ide> for (const cachedFile in cache.assets) {
<ide> compilation.assets[cachedFile] = cache.assets[cachedFile];
<add> /**
<add> * Add file to chunk, if not presented there
<add> */
<ide> if (cachedFile !== file) chunk.files.push(cachedFile);
<ide> }
<ide> return;
<ide> }
<ide> let source, sourceMap;
<add> /**
<add> * Check if asset can build source map
<add> */
<ide> if (asset.sourceAndMap) {
<ide> const sourceAndMap = asset.sourceAndMap(options);
<ide> sourceMap = sourceAndMap.map;
<ide> const getTaskForFile = (file, chunk, options, compilation) => {
<ide>
<ide> class SourceMapDevToolPlugin {
<ide> /**
<del> * @param {SourceMapDevToolPluginOptions=} options options object
<add> * @param {SourceMapDevToolPluginOptions} [options] - options object
<add> * @throws {Error} throws error, if got more than 1 arguments
<ide> */
<ide> constructor(options) {
<ide> if (arguments.length > 1) {
<ide> class SourceMapDevToolPlugin {
<ide>
<ide> validateOptions(schema, options, "SourceMap DevTool Plugin");
<ide>
<add> /** @type {string | false} */
<ide> this.sourceMapFilename = options.filename;
<ide> /** @type {string | false} */
<ide> this.sourceMappingURLComment =
<ide> options.append === false
<ide> ? false
<ide> : options.append || "\n//# sourceMappingURL=[url]";
<add> /** @type {string | Function} */
<ide> this.moduleFilenameTemplate =
<ide> options.moduleFilenameTemplate || "webpack://[namespace]/[resourcePath]";
<add> /** @type {string | Function} */
<ide> this.fallbackModuleFilenameTemplate =
<ide> options.fallbackModuleFilenameTemplate ||
<ide> "webpack://[namespace]/[resourcePath]?[hash]";
<add> /** @type {string} */
<ide> this.namespace = options.namespace || "";
<add> /** @type {SourceMapDevToolPluginOptions} */
<ide> this.options = options;
<ide> }
<ide>
<add> /**
<add> * Apply compiler
<add> * @param {Compiler} compiler - compiler instance
<add> * @returns {void}
<add> */
<ide> apply(compiler) {
<ide> const sourceMapFilename = this.sourceMapFilename;
<ide> const sourceMappingURLComment = this.sourceMappingURLComment;
<ide> class SourceMapDevToolPlugin {
<ide> new SourceMapDevToolModuleOptionsPlugin(options).apply(compilation);
<ide>
<ide> compilation.hooks.afterOptimizeChunkAssets.tap(
<del> {
<del> name: "SourceMapDevToolPlugin",
<del> context: true
<del> },
<add> //TODO need to fix type of Tap, currently { name: string; type: TapType; fn: Function; stage: number; context: boolean; }
<add> //@ts-ignore
<add> { name: "SourceMapDevToolPlugin", context: true },
<add> /**
<add> * @param {object} context - hook context
<add> * @param {Array<Chunk>} chunks - resulted chunks
<add> * @throws {Error} throws error, if `sourceMapFilename === false && sourceMappingURLComment === false`
<add> * @returns {void}
<add> */
<ide> (context, chunks) => {
<add> /** @type {Map<string | Module, string>} */
<ide> const moduleToSourceNameMapping = new Map();
<add> /**
<add> * @type {Function}
<add> * @returns {void}
<add> */
<ide> const reportProgress =
<ide> context && context.reportProgress
<ide> ? context.reportProgress
<ide> class SourceMapDevToolPlugin {
<ide> file,
<ide> "generate SourceMap"
<ide> );
<add> /** @type {SourceMapTask | undefined} */
<ide> const task = getTaskForFile(file, chunk, options, compilation);
<ide>
<ide> if (task) {
<ide> class SourceMapDevToolPlugin {
<ide> });
<ide>
<ide> reportProgress(0.5, "resolve sources");
<add> /** @type {Set<string>} */
<ide> const usedNamesSet = new Set(moduleToSourceNameMapping.values());
<add> /** @type {Set<string>} */
<ide> const conflictDetectionSet = new Set();
<ide>
<del> // all modules in defined order (longest identifier first)
<add> /**
<add> * all modules in defined order (longest identifier first)
<add> * @type {Array<string | Module>}
<add> */
<ide> const allModules = Array.from(moduleToSourceNameMapping.keys()).sort(
<ide> (a, b) => {
<ide> const ai = typeof a === "string" ? a : a.identifier();
<ide> class SourceMapDevToolPlugin {
<ide> assetsCache.set(asset, { file, assets });
<ide> /** @type {string | false} */
<ide> let currentSourceMappingURLComment = sourceMappingURLComment;
<add> /**
<add> * In css comment with `//` commenting next block as well, so workaround is to replace comment `//` with `/**\/`
<add> */
<ide> if (
<ide> currentSourceMappingURLComment !== false &&
<ide> /\.css($|\?)/i.test(file)
<ide> class SourceMapDevToolPlugin {
<ide> : path
<ide> .relative(path.dirname(file), sourceMapFile)
<ide> .replace(/\\/g, "/");
<add> /**
<add> * Add source map url to compilation asset, if {@link currentSourceMappingURLComment} presented
<add> */
<ide> if (currentSourceMappingURLComment !== false) {
<ide> assets[file] = compilation.assets[file] = new ConcatSource(
<ide> new RawSource(source),
<ide> class SourceMapDevToolPlugin {
<ide> )
<ide> );
<ide> }
<add> /**
<add> * Add source map file to compilation assets and chunk files
<add> */
<ide> assets[sourceMapFile] = compilation.assets[
<ide> sourceMapFile
<ide> ] = new RawSource(sourceMapString);
<ide> class SourceMapDevToolPlugin {
<ide> "SourceMapDevToolPlugin: append can't be false when no filename is provided"
<ide> );
<ide> }
<add> /**
<add> * Add source map as data url to asset
<add> */
<ide> assets[file] = compilation.assets[file] = new ConcatSource(
<ide> new RawSource(source),
<ide> currentSourceMappingURLComment | 1 |
Python | Python | fix syntax error | 0ca152a01541f306ca23d5c41b0f56a1dafef260 | <ide><path>examples/vectors_fast_text.py
<ide> import plac
<ide> import numpy
<ide>
<del>import from spacy.language import Language
<add>from spacy.language import Language
<ide>
<ide>
<ide> @plac.annotations( | 1 |
Python | Python | change local variable name from map to mapping | 56191ca1eca82f72f6cfab887802d996c6f139b9 | <ide><path>celery/backends/asynchronous.py
<ide> def remove_pending_result(self, result):
<ide> return result
<ide>
<ide> def _remove_pending_result(self, task_id):
<del> for map in self._pending_results:
<del> map.pop(task_id, None)
<add> for mapping in self._pending_results:
<add> mapping.pop(task_id, None)
<ide>
<ide> def on_result_fulfilled(self, result):
<ide> self.result_consumer.cancel_for(result.id) | 1 |
Ruby | Ruby | simplify the logic | fac17e8459c193e40144c5e7875f5b634d8af9a0 | <ide><path>Library/Homebrew/formulary.rb
<ide> def self.from_rack(rack, spec = nil)
<ide> end
<ide>
<ide> def self.to_rack(ref)
<del> name = canonical_name(ref)
<del> rack = HOMEBREW_CELLAR/name
<del>
<del> # Handle the case when ref is an old name and the installation
<del> # hasn't been migrated or when it's a package installed from
<del> # path but same name formula was renamed.
<del> unless rack.directory?
<del> if ref =~ HOMEBREW_TAP_FORMULA_REGEX
<del> rack = HOMEBREW_CELLAR/$3
<del> elsif !ref.include?("/")
<del> rack = HOMEBREW_CELLAR/ref
<del> end
<add> # First, check whether the rack with the given name exists.
<add> if (rack = HOMEBREW_CELLAR/File.basename(ref, ".rb")).directory?
<add> return rack
<ide> end
<ide>
<del> rack
<add> # Second, use canonical name to locate rack.
<add> name = canonical_name(ref)
<add> HOMEBREW_CELLAR/name
<ide> end
<ide>
<ide> def self.canonical_name(ref) | 1 |
Text | Text | add decorator brackets back. refs #941 | 8d83ff8e6c8513d0a88d6b1fecb34ed86f1e2085 | <ide><path>docs/api-guide/viewsets.md
<ide> For example:
<ide> queryset = User.objects.all()
<ide> serializer_class = UserSerializer
<ide>
<del> @action
<add> @action()
<ide> def set_password(self, request, pk=None):
<ide> user = self.get_object()
<ide> serializer = PasswordSerializer(data=request.DATA) | 1 |
Javascript | Javascript | inline default props | 88f64a5782e3903b394f4265676f0ca4cff743db | <ide><path>Libraries/Components/Slider/Slider.js
<ide> * LICENSE file in the root directory of this source tree.
<ide> *
<ide> * @format
<del> * @flow
<add> * @flow strict-local
<ide> */
<ide>
<ide> 'use strict';
<ide>
<ide> const Platform = require('../../Utilities/Platform');
<ide> import SliderNativeComponent from './SliderNativeComponent';
<ide> const React = require('react');
<del>const ReactNative = require('../../Renderer/shims/ReactNative');
<ide> const StyleSheet = require('../../StyleSheet/StyleSheet');
<ide>
<ide> import type {ImageSource} from '../../Image/ImageSource';
<ide> const Slider = (
<ide> props.style,
<ide> );
<ide>
<del> const {onValueChange, onSlidingComplete, ...localProps} = props;
<add> const {
<add> disabled = false,
<add> value = 0.5,
<add> minimumValue = 0,
<add> maximumValue = 1,
<add> step = 0,
<add> onValueChange,
<add> onSlidingComplete,
<add> ...localProps
<add> } = props;
<ide>
<ide> const onValueChangeEvent = onValueChange
<ide> ? (event: Event) => {
<ide> const Slider = (
<ide> return (
<ide> <SliderNativeComponent
<ide> {...localProps}
<del> ref={forwardedRef}
<del> style={style}
<add> enabled={!disabled}
<add> maximumValue={maximumValue}
<add> minimumValue={minimumValue}
<ide> onChange={onChangeEvent}
<add> onResponderTerminationRequest={() => false}
<ide> onSlidingComplete={onSlidingCompleteEvent}
<del> onValueChange={onValueChangeEvent}
<del> enabled={!props.disabled}
<ide> onStartShouldSetResponder={() => true}
<del> onResponderTerminationRequest={() => false}
<add> onValueChange={onValueChangeEvent}
<add> ref={forwardedRef}
<add> step={step}
<add> style={style}
<add> value={value}
<ide> />
<ide> );
<ide> };
<ide> const SliderWithRef: React.AbstractComponent<
<ide> React.ElementRef<typeof SliderNativeComponent>,
<ide> > = React.forwardRef(Slider);
<ide>
<del>// $FlowFixMe
<del>SliderWithRef.defaultProps = {
<del> disabled: false,
<del> value: 0,
<del> minimumValue: 0,
<del> maximumValue: 1,
<del> step: 0,
<del>};
<del>
<ide> let styles;
<ide> if (Platform.OS === 'ios') {
<ide> styles = StyleSheet.create({ | 1 |
Javascript | Javascript | make hot cases better | 720f3b271aebef0feaef207f07adcdb6d2be5ecc | <ide><path>test/HotTestCases.test.js
<ide> describe("HotTestCases", () => {
<ide> let options = {};
<ide> if (fs.existsSync(configPath)) options = require(configPath);
<ide> if (!options.mode) options.mode = "development";
<add> if (!options.devtool) options.devtool = false;
<ide> if (!options.context) options.context = testDirectory;
<ide> if (!options.entry) options.entry = "./index.js";
<ide> if (!options.output) options.output = {};
<ide> describe("HotTestCases", () => {
<ide> if (!options.module) options.module = {};
<ide> if (!options.module.rules) options.module.rules = [];
<ide> options.module.rules.push({
<del> test: /\.js$/,
<ide> loader: path.join(
<ide> __dirname,
<ide> "hotCases",
<ide><path>test/hotCases/fake-update-loader.js
<ide> module.exports = function(source) {
<del> this.cacheable(false);
<ide> var idx = this.updateIndex;
<ide> var items = source.split(/---+\r?\n/g);
<add> if (items.length > 1) {
<add> this.cacheable(false);
<add> }
<ide> return items[idx] || items[items.length - 1];
<del>}
<add>}; | 2 |
Ruby | Ruby | add more checks for conflics_with audit | 4c14675021ce399dc64459f94763e2016bc58b41 | <ide><path>Library/Homebrew/formula_auditor.rb
<ide> def audit_deps
<ide>
<ide> def audit_conflicts
<ide> formula.conflicts.each do |c|
<del> Formulary.factory(c.name)
<add> conflicting_formula = Formulary.factory(c.name)
<add> problem "Formula should not conflict with itself" if formula == conflicting_formula
<add>
<add> # Use Formula instead of FormulaConflict to be able correctly handle renamed formulae and aliases
<add> reverse_conflicts = conflicting_formula.conflicts.map { |rc| Formulary.factory(rc.name) }
<add> if reverse_conflicts.exclude? formula
<add> problem "Formula #{conflicting_formula.name} should also have a conflict declared with #{formula.name}"
<add> end
<ide> rescue TapFormulaUnavailableError
<ide> # Don't complain about missing cross-tap conflicts.
<ide> next | 1 |
Ruby | Ruby | add test for build.with? "--with-foo" | 5a7cbb762f1a9e715ae03e82eb6cb8ef4ac4a0bb | <ide><path>Library/Homebrew/rubocops/lines_cop.rb
<ide> def audit_formula(_node, _class_node, _parent_class_node, body_node)
<ide> problem "Don't duplicate 'without': Use `build.without? \"#{match[1]}\"` to check for \"--without-#{match[1]}\""
<ide> end
<ide>
<del> # find_instance_method_call(body_node, :build, :with?) do |m|
<del> # arg = parameters(m).first
<del> # next unless match = regex_match_group(arg, %r{-?-?with-(.*)})
<del> # problem "Don't duplicate 'with': Use `build.with? \"#{match[1]}\"` to check for \"--with-#{match[1]}\""
<del> # end
<del> #
<add> find_instance_method_call(body_node, :build, :with?) do |m|
<add> arg = parameters(m).first
<add> next unless match = regex_match_group(arg, %r{-?-?with-(.*)})
<add> problem "Don't duplicate 'with': Use `build.with? \"#{match[1]}\"` to check for \"--with-#{match[1]}\""
<add> end
<add>
<ide> # find_instance_method_call(body_node, :build, :include?) do |m|
<ide> # arg = parameters(m).first
<ide> # next unless match = regex_match_group(arg, %r{with(out)?-(.*)})
<ide><path>Library/Homebrew/test/rubocops/lines_cop_spec.rb
<ide> def post_install
<ide> end
<ide> end
<ide>
<del> it "with negated build.with?" do
<add> it "with duplicated build.without?" do
<ide> source = <<-EOS.undent
<ide> class Foo < Formula
<ide> desc "foo"
<ide> def post_install
<ide> expect_offense(expected, actual)
<ide> end
<ide> end
<add>
<add> it "with duplicated build.with?" do
<add> source = <<-EOS.undent
<add> class Foo < Formula
<add> desc "foo"
<add> url 'http://example.com/foo-1.0.tgz'
<add> def post_install
<add> return if build.with? "--with-bar"
<add> end
<add> end
<add> EOS
<add>
<add> expected_offenses = [{ message: "Don't duplicate 'with': Use `build.with? \"bar\"` to check for \"--with-bar\"",
<add> severity: :convention,
<add> line: 5,
<add> column: 27,
<add> source: source }]
<add>
<add> inspect_source(cop, source)
<add>
<add> expected_offenses.zip(cop.offenses).each do |expected, actual|
<add> expect_offense(expected, actual)
<add> end
<add> end
<ide> end
<ide> def expect_offense(expected, actual)
<ide> expect(actual.message).to eq(expected[:message]) | 2 |
Python | Python | fix wrong query on running tis | 84df8646ba396088e70ca8469b301d11d13d2da7 | <ide><path>airflow/api/common/experimental/delete_dag.py
<ide> def delete_dag(dag_id: str, keep_records_in_log: bool = True, session=None) -> i
<ide> """
<ide> log.info("Deleting DAG: %s", dag_id)
<ide> running_tis = (
<del> session.query(models.TaskInstance.state).filter(models.TaskInstance.state.in_(State.unfinished)).all()
<add> session.query(models.TaskInstance.state)
<add> .filter(models.TaskInstance.dag_id == dag_id)
<add> .filter(models.TaskInstance.state == State.RUNNING)
<add> .first()
<ide> )
<ide> if running_tis:
<ide> raise AirflowException("TaskInstances still running") | 1 |
Javascript | Javascript | improve regular expression validation | 4a3af65a88122307a86b28bf385b8f87767803e6 | <ide><path>lib/assert.js
<ide> function compareExceptionKey(actual, expected, key, message, keys, fn) {
<ide> }
<ide> }
<ide>
<del>function expectedException(actual, expected, msg, fn) {
<add>function expectedException(actual, expected, message, fn) {
<ide> if (typeof expected !== 'function') {
<del> if (isRegExp(expected))
<del> return expected.test(actual);
<del> // assert.doesNotThrow does not accept objects.
<del> if (arguments.length === 2) {
<del> throw new ERR_INVALID_ARG_TYPE(
<del> 'expected', ['Function', 'RegExp'], expected
<del> );
<add> // Handle regular expressions.
<add> if (isRegExp(expected)) {
<add> const str = String(actual);
<add> if (expected.test(str))
<add> return;
<add>
<add> throw new AssertionError({
<add> actual,
<add> expected,
<add> message: message || 'The input did not match the regular expression ' +
<add> `${inspect(expected)}. Input:\n\n${inspect(str)}\n`,
<add> operator: fn.name,
<add> stackStartFn: fn
<add> });
<ide> }
<ide>
<ide> // Handle primitives properly.
<ide> if (typeof actual !== 'object' || actual === null) {
<ide> const err = new AssertionError({
<ide> actual,
<ide> expected,
<del> message: msg,
<add> message,
<ide> operator: 'deepStrictEqual',
<ide> stackStartFn: fn
<ide> });
<ide> err.operator = fn.name;
<ide> throw err;
<ide> }
<ide>
<add> // Handle validation objects.
<ide> const keys = Object.keys(expected);
<ide> // Special handle errors to make sure the name and the message are compared
<ide> // as well.
<ide> function expectedException(actual, expected, msg, fn) {
<ide> expected[key].test(actual[key])) {
<ide> continue;
<ide> }
<del> compareExceptionKey(actual, expected, key, msg, keys, fn);
<add> compareExceptionKey(actual, expected, key, message, keys, fn);
<ide> }
<del> return true;
<add> return;
<ide> }
<add>
<ide> // Guard instanceof against arrow functions as they don't have a prototype.
<add> // Check for matching Error classes.
<ide> if (expected.prototype !== undefined && actual instanceof expected) {
<del> return true;
<add> return;
<ide> }
<ide> if (Error.isPrototypeOf(expected)) {
<del> return false;
<add> throw actual;
<add> }
<add>
<add> // Check validation functions return value.
<add> const res = expected.call({}, actual);
<add> if (res !== true) {
<add> throw actual;
<ide> }
<del> return expected.call({}, actual) === true;
<ide> }
<ide>
<ide> function getActual(fn) {
<ide> function expectsError(stackStartFn, actual, error, message) {
<ide> stackStartFn
<ide> });
<ide> }
<del> if (error && !expectedException(actual, error, message, stackStartFn)) {
<del> throw actual;
<add>
<add> if (!error)
<add> return;
<add>
<add> expectedException(actual, error, message, stackStartFn);
<add>}
<add>
<add>function hasMatchingError(actual, expected) {
<add> if (typeof expected !== 'function') {
<add> if (isRegExp(expected)) {
<add> const str = String(actual);
<add> return expected.test(str);
<add> }
<add> throw new ERR_INVALID_ARG_TYPE(
<add> 'expected', ['Function', 'RegExp'], expected
<add> );
<ide> }
<add> // Guard instanceof against arrow functions as they don't have a prototype.
<add> if (expected.prototype !== undefined && actual instanceof expected) {
<add> return true;
<add> }
<add> if (Error.isPrototypeOf(expected)) {
<add> return false;
<add> }
<add> return expected.call({}, actual) === true;
<ide> }
<ide>
<ide> function expectsNoError(stackStartFn, actual, error, message) {
<ide> function expectsNoError(stackStartFn, actual, error, message) {
<ide> error = undefined;
<ide> }
<ide>
<del> if (!error || expectedException(actual, error)) {
<add> if (!error || hasMatchingError(actual, error)) {
<ide> const details = message ? `: ${message}` : '.';
<ide> const fnType = stackStartFn.name === 'doesNotReject' ?
<ide> 'rejection' : 'exception';
<ide><path>test/parallel/test-assert.js
<ide> assert.throws(
<ide> }
<ide>
<ide> // Use a RegExp to validate the error message.
<del>a.throws(() => thrower(TypeError), /\[object Object\]/);
<add>{
<add> a.throws(() => thrower(TypeError), /\[object Object\]/);
<add>
<add> const symbol = Symbol('foo');
<add> a.throws(() => {
<add> throw symbol;
<add> }, /foo/);
<add>
<add> a.throws(() => {
<add> a.throws(() => {
<add> throw symbol;
<add> }, /abc/);
<add> }, {
<add> message: 'The input did not match the regular expression /abc/. ' +
<add> "Input:\n\n'Symbol(foo)'\n",
<add> code: 'ERR_ASSERTION',
<add> operator: 'throws',
<add> actual: symbol,
<add> expected: /abc/
<add> });
<add>}
<ide>
<ide> // Use a fn to validate the error object.
<ide> a.throws(() => thrower(TypeError), (err) => { | 2 |
Ruby | Ruby | move class methods to deprecated stuff | bb9d71ff9e537597ff4d5962e7870ad99001f605 | <ide><path>actionmailer/lib/action_mailer/base.rb
<ide> module ActionMailer #:nodoc:
<ide> # +implicit_parts_order+.
<ide> class Base < AbstractController::Base
<ide> include Quoting
<del> extend AdvAttrAccessor
<ide>
<ide> include AbstractController::Logger
<ide> include AbstractController::Rendering
<ide> def mailer_name
<ide>
<ide> alias :controller_path :mailer_name
<ide>
<del> def respond_to?(method_symbol, include_private = false) #:nodoc:
<del> matches_dynamic_method?(method_symbol) || super
<del> end
<del>
<del> def method_missing(method_symbol, *parameters) #:nodoc:
<del> if match = matches_dynamic_method?(method_symbol)
<del> case match[1]
<del> when 'create' then new(match[2], *parameters).message
<del> when 'deliver' then new(match[2], *parameters).deliver!
<del> when 'new' then nil
<del> else super
<del> end
<del> else
<del> super
<del> end
<del> end
<del>
<ide> # Receives a raw email, parses it into an email object, decodes it,
<ide> # instantiates a new mailer, and passes the email object to the mailer
<ide> # object's +receive+ method. If you want your mailer to be able to
<ide> def deliver(mail)
<ide> raise "no mail object available for delivery!" unless mail
<ide>
<ide> ActiveSupport::Notifications.instrument("action_mailer.deliver", :mailer => self.name) do |payload|
<del>
<ide> self.set_payload_for_mail(payload, mail)
<ide>
<ide> mail.delivery_method delivery_methods[delivery_method],
<ide> def set_payload_for_mail(payload, mail) #:nodoc:
<ide> payload[:date] = mail.date
<ide> payload[:mail] = mail.encoded
<ide> end
<del>
<del> private
<del>
<del> def matches_dynamic_method?(method_name) #:nodoc:
<del> method_name = method_name.to_s
<del> /^(create|deliver)_([_a-z]\w*)/.match(method_name) || /^(new)$/.match(method_name)
<del> end
<ide> end
<ide>
<ide> def mail(headers = {})
<ide> # Guard flag to prevent both the old and the new API from firing
<del> # TODO - Move this @mail_was_called flag into deprecated_api.rb
<add> # Should be removed when old API is deprecated
<ide> @mail_was_called = true
<ide>
<ide> m = @message
<ide> def mail(headers = {})
<ide>
<ide> m.body.set_sort_order(headers[:parts_order] || @@default_implicit_parts_order)
<ide>
<add> # # Set the subject if not set yet
<add> # @subject ||= I18n.t(:subject, :scope => [:actionmailer, mailer_name, method_name],
<add> # :default => method_name.humanize)
<add>
<add>
<ide> # TODO: m.body.sort_parts!
<ide> m
<ide> end
<ide> def mail(headers = {})
<ide> # method, for instance).
<ide> def initialize(method_name=nil, *args)
<ide> super()
<del> @mail_was_called = false
<ide> @message = Mail.new
<ide> process(method_name, *args) if method_name
<ide> end
<ide>
<del> # Process the mailer via the given +method_name+. The body will be
<del> # rendered and a new Mail object created.
<del> def process(method_name, *args)
<del> initialize_defaults(method_name)
<del> super
<del> unless @mail_was_called
<del> # Create e-mail parts
<del> create_parts
<del>
<del> # Set the subject if not set yet
<del> @subject ||= I18n.t(:subject, :scope => [:actionmailer, mailer_name, method_name],
<del> :default => method_name.humanize)
<del>
<del> # Build the mail object itself
<del> create_mail
<del> end
<del> @message
<del> end
<del>
<ide> # Delivers a Mail object. By default, it delivers the cached mail
<ide> # object (from the <tt>create!</tt> method). If no cached mail object exists, and
<ide> # no alternate has been given as the parameter, this will fail.
<ide><path>actionmailer/lib/action_mailer/deprecated_api.rb
<ide> module DeprecatedApi #:nodoc:
<ide> alias :controller_path :mailer_name
<ide> end
<ide>
<add> module ClassMethods
<add> def respond_to?(method_symbol, include_private = false) #:nodoc:
<add> matches_dynamic_method?(method_symbol) || super
<add> end
<add>
<add> def method_missing(method_symbol, *parameters) #:nodoc:
<add> if match = matches_dynamic_method?(method_symbol)
<add> case match[1]
<add> when 'create' then new(match[2], *parameters).message
<add> when 'deliver' then new(match[2], *parameters).deliver!
<add> when 'new' then nil
<add> else super
<add> end
<add> else
<add> super
<add> end
<add> end
<add>
<add> private
<add>
<add> def matches_dynamic_method?(method_name) #:nodoc:
<add> method_name = method_name.to_s
<add> /^(create|deliver)_([_a-z]\w*)/.match(method_name) || /^(new)$/.match(method_name)
<add> end
<add> end
<add>
<add> def initialize(*)
<add> super()
<add> @mail_was_called = false
<add> end
<add>
<ide> def render(*args)
<ide> options = args.last.is_a?(Hash) ? args.last : {}
<ide> if options[:body]
<ide> def render(*args)
<ide> super
<ide> end
<ide>
<add> def process(method_name, *args)
<add> initialize_defaults(method_name)
<add> super
<add> unless @mail_was_called
<add> # Create e-mail parts
<add> create_parts
<add>
<add> # Set the subject if not set yet
<add> @subject ||= I18n.t(:subject, :scope => [:actionmailer, mailer_name, method_name],
<add> :default => method_name.humanize)
<add>
<add> # Build the mail object itself
<add> create_mail
<add> end
<add> end
<add>
<add>
<ide> # Add a part to a multipart message, with the given content-type. The
<ide> # part itself is yielded to the block so that other properties (charset,
<ide> # body, headers, etc.) can be set on it. | 2 |
Text | Text | add info about valet to article | b1372bba158959c2b40bb9f4ee6c8bbbb0a6523d | <ide><path>guide/english/laravel/index.md
<ide> title: Laravel
<ide> # Laravel
<ide> [Laravel](https://laravel.com/) is a free and open-source PHP web framework available on [GitHub](https://github.com/laravel/laravel) and licensed under the terms of MIT License. It was created by Taylor Otwell and designed with the objective of enabling rapid development of web applications following the model–view–controller (MVC) architectural pattern. It has gained a lot of traction over the years and is now the most starred PHP framework on GitHub.
<ide>
<del>Some of the main features found in Laravel are different ways for accessing relational databases, utilities that aid in application deployment and maintenance, and a modular packaging system with a dedicated dependency manager. Laravel also simplifies a lot of common tasks found in web development and provides out of the box solutions for things like authentication, routing, and queues, allowing you to focus on your application.
<add>Some of the main features found in Laravel are different ways for accessing relational databases, utilities that aid in application deployment and maintenance, and a modular packaging system with a dedicated dependency manager. Laravel also simplifies a lot of common tasks found in web development and provides out of the box solutions for things like authentication, routing, and queues, allowing you to focus on your application. If you are a Mac user, you can install Valet as a development environment which is build for Laravel.
<ide>
<ide> Because Laravel is open-source, the community around it is very strong and the documentation is top-notch and example driven. Take a look at the [official documentation](https://laravel.com/docs/5.7/) to get a glimpse of how easy it is to use!
<ide> | 1 |
Ruby | Ruby | remove pointless assertion | 5ae32d5a793c00fb3f52c3c19f4469feab4aaf2f | <ide><path>Library/Homebrew/test/test_cleaner.rb
<ide> def test_clean_file
<ide> f = CleanerTestBall.new
<ide> shutup { f.brew { f.install } }
<ide>
<del> assert_nothing_raised { Cleaner.new f }
<add> Cleaner.new f
<add>
<ide> assert_equal 0100555, (f.bin/'a.out').stat.mode
<ide> assert_equal 0100444, (f.lib/'fat.dylib').stat.mode
<ide> assert_equal 0100444, (f.lib/'x86_64.dylib').stat.mode | 1 |
Java | Java | delete unused imports in headerassertiontests | d8fb6c557d890c2404c6bbc42790be469af55fe2 | <ide><path>spring-test/src/test/java/org/springframework/test/web/servlet/samples/standalone/resultmatchers/HeaderAssertionTests.java
<ide> import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*;
<ide> import static org.springframework.test.web.servlet.setup.MockMvcBuilders.*;
<ide>
<del>import java.text.SimpleDateFormat;
<del>import java.util.Locale;
<del>import java.util.TimeZone;
<del>
<ide> /**
<ide> * Examples of expectations on response header values.
<ide> * | 1 |
PHP | PHP | fix pagination comment | bbae90adad1d22353bf59ae3a7163bc84184a173 | <ide><path>laravel/database/query.php
<ide> public function aggregate($aggregator, $columns)
<ide> public function paginate($per_page = 20, $columns = array('*'))
<ide> {
<ide> // Because some database engines may throw errors if we leave orderings
<del> // on the query when retrieving the total number of records, we will
<del> // remove all of the ordreings and put them back on the query after
<del> // we have the count.
<add> // on the query when retrieving the total number of records, we'll drop
<add> // all of the ordreings and put them back on the query after we have
<add> // retrieved the count from the table.
<ide> list($orderings, $this->orderings) = array($this->orderings, null);
<ide>
<ide> $page = Paginator::page($total = $this->count($columns), $per_page);
<ide>
<ide> $this->orderings = $orderings;
<ide>
<del> // Now we're ready to get the actual pagination results from the
<del> // database table. The "for_page" method provides a convenient
<del> // way to set the limit and offset so we get the correct span
<del> // of results from the table.
<add> // Now we're ready to get the actual pagination results from the table
<add> // using the for_page and get methods. The "for_page" method provides
<add> // a convenient way to set the limit and offset so we get the correct
<add> // span of results from the table.
<ide> $results = $this->for_page($page, $per_page)->get($columns);
<ide>
<ide> return Paginator::make($results, $total, $per_page); | 1 |
Ruby | Ruby | fix new_full_name in report | 9a4987533af8207041c8061a36661286a429003d | <ide><path>Library/Homebrew/cmd/update-report.rb
<ide> def report
<ide> if tap.core_formula_repository?
<ide> new_full_name = new_name
<ide> else
<del> new_full_name = "#{tap}/#{new_full_name}"
<add> new_full_name = "#{tap}/#{new_name}"
<ide> end
<ide>
<ide> renamed_formulae << [old_full_name, new_full_name] if @report[:A].include? new_full_name | 1 |
PHP | PHP | add tests for aftersavecommit | 3b0c4b92e55b6dade6b4ae9b9de436f9c91e807a | <ide><path>tests/TestCase/ORM/TableTest.php
<ide> public function testAfterSave()
<ide> $called = true;
<ide> };
<ide> $table->eventManager()->attach($listener, 'Model.afterSave');
<add>
<add> $calledAfterCommit = false;
<add> $listenerAfterCommit = function ($e, $entity, $options) use ($data, &$calledAfterCommit) {
<add> $this->assertSame($data, $entity);
<add> $calledAfterCommit = true;
<add> };
<add> $table->eventManager()->attach($listenerAfterCommit, 'Model.afterSaveCommit');
<add>
<ide> $this->assertSame($data, $table->save($data));
<ide> $this->assertEquals($data->id, self::$nextUserId);
<ide> $this->assertTrue($called);
<add> $this->assertTrue($calledAfterCommit);
<add> }
<add>
<add> /**
<add> * Asserts that afterSaveCommit is not triggered for non-atomic saves
<add> *
<add> * @return void
<add> */
<add> public function testAfterSaveCommitForNonAtomic()
<add> {
<add> $table = TableRegistry::get('users');
<add> $data = new \Cake\ORM\Entity([
<add> 'username' => 'superuser',
<add> 'created' => new Time('2013-10-10 00:00'),
<add> 'updated' => new Time('2013-10-10 00:00')
<add> ]);
<add>
<add> $called = false;
<add> $listener = function ($e, $entity, $options) use ($data, &$called) {
<add> $this->assertSame($data, $entity);
<add> $called = true;
<add> };
<add> $table->eventManager()->attach($listener, 'Model.afterSave');
<add>
<add> $calledAfterCommit = false;
<add> $listenerAfterCommit = function ($e, $entity, $options) use ($data, &$calledAfterCommit) {
<add> $calledAfterCommit = true;
<add> };
<add> $table->eventManager()->attach($listenerAfterCommit, 'Model.afterSaveCommit');
<add>
<add> $this->assertSame($data, $table->save($data, ['atomic' => false]));
<add> $this->assertEquals($data->id, self::$nextUserId);
<add> $this->assertTrue($called);
<add> $this->assertFalse($calledAfterCommit);
<ide> }
<ide>
<ide> /**
<ide> public function testAfterSaveNotCalled()
<ide> $called = true;
<ide> };
<ide> $table->eventManager()->attach($listener, 'Model.afterSave');
<add>
<add> $calledAfterCommit = false;
<add> $listenerAfterCommit = function ($e, $entity, $options) use ($data, &$calledAfterCommit) {
<add> $calledAfterCommit = true;
<add> };
<add> $table->eventManager()->attach($listenerAfterCommit, 'Model.afterSaveCommit');
<add>
<ide> $this->assertFalse($table->save($data));
<ide> $this->assertFalse($called);
<add> $this->assertFalse($calledAfterCommit);
<add> }
<add>
<add> /**
<add> * Asserts that afterSaveCommit callback is triggered only for primary table
<add> *
<add> * @group save
<add> * @return void
<add> */
<add> public function testAfterSaveCommitTriggeredOnlyForPrimaryTable()
<add> {
<add> $entity = new \Cake\ORM\Entity([
<add> 'title' => 'A Title',
<add> 'body' => 'A body'
<add> ]);
<add> $entity->author = new \Cake\ORM\Entity([
<add> 'name' => 'Jose'
<add> ]);
<add>
<add> $table = TableRegistry::get('articles');
<add> $table->belongsTo('authors');
<add>
<add> $calledForArticle = false;
<add> $listenerForArticle = function ($e, $entity, $options) use (&$calledForArticle) {
<add> $calledForArticle = true;
<add> };
<add> $table->eventManager()->attach($listenerForArticle, 'Model.afterSaveCommit');
<add>
<add> $calledForAuthor = false;
<add> $listenerForAuthor = function ($e, $entity, $options) use (&$calledForAuthor) {
<add> $calledForAuthor = true;
<add> };
<add> $table->authors->eventManager()->attach($listenerForAuthor, 'Model.afterSaveCommit');
<add>
<add> $this->assertSame($entity, $table->save($entity));
<add> $this->assertFalse($entity->isNew());
<add> $this->assertFalse($entity->author->isNew());
<add> $this->assertTrue($calledForArticle);
<add> $this->assertFalse($calledForAuthor);
<ide> }
<ide>
<ide> /** | 1 |
PHP | PHP | fix some issues with stack middleware merging | fe5fa984b1ebe73cf40e96c0f3acb58718618090 | <ide><path>src/Illuminate/Foundation/Application.php
<ide> protected function getStackedClient()
<ide> * @param \Stack\Builder
<ide> * @return void
<ide> */
<del> protected function mergeCustomMiddlewares($stack)
<add> protected function mergeCustomMiddlewares(\Stack\Builder $stack)
<ide> {
<del> foreach ($this->middlewares as $key => $value)
<add> foreach ($this->middlewares as $middleware)
<ide> {
<del> $parameters = array_unshift($value, $key);
<add> list($class, $parameters) = $middleware;
<add>
<add> $parameters = array_unshift($parameters, $class);
<ide>
<ide> call_user_func_array(array($stack, 'push'), $parameters);
<ide> }
<ide> protected function mergeCustomMiddlewares($stack)
<ide> */
<ide> public function middleware($class, array $parameters = array())
<ide> {
<del> $this->middlewares[$class] = $parameters;
<add> $this->middlewares[] = compact('class', 'parameters');
<ide>
<ide> return $this;
<ide> } | 1 |
Text | Text | add a warning about the @jsx declaration | 0647c2ee98539776abda0640d4f76416eba78c9b | <ide><path>docs/docs/tutorial.md
<ide> For this tutorial we'll use prebuilt JavaScript files on a CDN. Open up your fav
<ide> /**
<ide> * @jsx React.DOM
<ide> */
<add> // The above declaration must remain intact at the top of the script.
<ide> // Your code here
<ide> </script>
<ide> </body> | 1 |
PHP | PHP | update doc blocks | 8e934b602280a4da565c12f4c609853e6643043f | <ide><path>src/Database/Driver/Sqlserver.php
<ide> use Cake\Database\Statement\PDOStatement;
<ide> use PDO;
<ide>
<add>/**
<add> * SQLServer driver.
<add> */
<ide> class Sqlserver extends \Cake\Database\Driver {
<ide>
<ide> use PDODriverTrait;
<ide> public function connect() {
<ide> $connection->exec("SET {$key} {$value}");
<ide> }
<ide> }
<del>
<ide> return true;
<ide> }
<ide>
<ide> /**
<del> * Returns whether php is able to use this driver for connecting to database
<add> * Returns whether PHP is able to use this driver for connecting to database
<ide> *
<ide> * @return boolean true if it is valid to use this driver
<ide> */
<del>
<ide> public function enabled() {
<ide> return in_array('sqlsrv', PDO::getAvailableDrivers());
<ide> }
<ide><path>src/Database/Schema/SqlserverSchema.php
<ide> use Cake\Database\Schema\Table;
<ide>
<ide> /**
<del> * Schema management/reflection features for Postgres.
<add> * Schema management/reflection features for SQLServer.
<ide> */
<ide> class SqlserverSchema extends BaseSchema {
<ide>
<ide> public function describeTableSql($name, $config) {
<ide> *
<ide> * @param string $col The column type
<ide> * @param int $length the column length
<del> * @throws Cake\Database\Exception when column cannot be parsed.
<add> * @throws \Cake\Database\Exception when column cannot be parsed.
<ide> * @return array Array of column information.
<ide> * @link http://technet.microsoft.com/en-us/library/ms187752.aspx
<ide> */ | 2 |
Text | Text | add v3.26.0-beta.4 to changelog | 75fa7e35aadf5d260e5e9a14fe28634da0fccd82 | <ide><path>CHANGELOG.md
<ide> # Ember Changelog
<ide>
<add>### v3.26.0-beta.4 (March 08, 2021)
<add>
<add>- [#19436](https://github.com/emberjs/ember.js/pull/19436) [BUGFIX] Support observer keys with colons
<add>- [#19448](https://github.com/emberjs/ember.js/pull/19448) [BUGFIX] Ensure query params are preserved through an intermediate loading state transition
<add>- [#19450](https://github.com/emberjs/ember.js/pull/19450) [BUGFIX] Ensure `routerService.currentRoute.name` and `routerService.currentRouteName` match during loading states
<add>
<ide> ### v3.26.0-beta.3 (March 02, 2021)
<ide>
<ide> - [#19412](https://github.com/emberjs/ember.js/pull/19412) [BUGFIX] Updates Glimmer VM to 0.76.0, fix: | 1 |
Mixed | Ruby | pass default values for `translate` through i18n | dd884eb4253b698039ea302becb71630cc7bc8a0 | <ide><path>actionview/CHANGELOG.md
<add>* The `translate` helper now passes `default` values that aren't
<add> translation keys through `I18n.translate` for interpolation.
<add>
<add> *Jonathan Hefner*
<add>
<ide> * Adds option `extname` to `stylesheet_link_tag` to skip default
<ide> `.css` extension appended to the stylesheet path.
<ide>
<ide><path>actionview/lib/action_view/helpers/translation_helper.rb
<ide> def translate(key, **options)
<ide> break translated unless translated.equal?(MISSING_TRANSLATION)
<ide> end
<ide>
<del> break alternatives.first if alternatives.present? && !alternatives.first.is_a?(Symbol)
<add> if alternatives.present? && !alternatives.first.is_a?(Symbol)
<add> break alternatives.first && I18n.translate(**options, default: alternatives)
<add> end
<ide>
<ide> first_key ||= key
<ide> key = alternatives&.shift
<ide><path>actionview/test/template/translation_helper_test.rb
<ide> def test_uses_custom_exception_handler_when_specified_for_html
<ide> I18n.exception_handler = old_exception_handler
<ide> end
<ide>
<del> def test_hash_default
<del> default = { separator: ".", delimiter: "," }
<del> assert_equal default, translate(:'special.number.format', default: default)
<del> end
<del>
<ide> def test_translation_returning_an_array
<ide> expected = %w(foo bar)
<ide> assert_equal expected, translate(:"translations.array")
<ide> def test_translate_with_string_default
<ide> assert_equal "A Generic String", translation
<ide> end
<ide>
<add> def test_translate_with_interpolated_string_default
<add> translation = translate(:"translations.missing", default: "An %{kind} String", kind: "Interpolated")
<add> assert_equal "An Interpolated String", translation
<add> end
<add>
<add> def test_translate_with_hash_default
<add> hash = { one: "%{count} thing", other: "%{count} things" }
<add> assert_equal hash, translate(:"translations.missing", default: hash)
<add> end
<add>
<add> def test_translate_with_hash_default_and_count
<add> hash = { one: "%{count} thing", other: "%{count} things" }
<add> assert_equal "1 thing", translate(:"translations.missing", default: hash, count: 1)
<add> assert_equal "2 things", translate(:"translations.missing", default: hash, count: 2)
<add> end
<add>
<add> def test_translate_with_proc_default
<add> translation = translate(:"translations.missing", default: Proc.new { "From Proc" })
<add> assert_equal "From Proc", translation
<add> end
<add>
<ide> def test_translate_with_object_default
<ide> translation = translate(:'translations.missing', default: 123)
<ide> assert_equal 123, translation | 3 |
Ruby | Ruby | push the autoloads up to requires | 60736fec5397c331cc8791b884f3579ef29f4f09 | <ide><path>activesupport/lib/active_support/notifications.rb
<add>require 'active_support/notifications/instrumenter'
<add>require 'active_support/notifications/instrumenter'
<add>require 'active_support/notifications/fanout'
<add>
<ide> module ActiveSupport
<ide> # = Notifications
<ide> #
<ide> module ActiveSupport
<ide> # to log subscribers in a thread. You can use any queue implementation you want.
<ide> #
<ide> module Notifications
<del> autoload :Instrumenter, 'active_support/notifications/instrumenter'
<del> autoload :Event, 'active_support/notifications/instrumenter'
<del> autoload :Fanout, 'active_support/notifications/fanout'
<del>
<ide> @instrumenters = Hash.new { |h,k| h[k] = notifier.listening?(k) }
<ide>
<ide> class << self | 1 |
PHP | PHP | remove invalid escape in comment | 56c50f5e4fef14f939b834a86bb957150e76ae90 | <ide><path>src/Datasource/EntityTrait.php
<ide> trait EntityTrait
<ide> * means no fields are accessible
<ide> *
<ide> * The special field '\*' can also be mapped, meaning that any other field
<del> * not defined in the map will take its value. For example, `'\*' => true`
<add> * not defined in the map will take its value. For example, `'*' => true`
<ide> * means that any field not defined in the map will be accessible by default
<ide> *
<ide> * @var bool[] | 1 |
Javascript | Javascript | improve view documentation | dfad0c557334b651db5419cd94e5f50034d0671e | <ide><path>packages/ember-views/lib/views/view.js
<ide> var invokeForState = {
<ide> firstName: 'Barry'
<ide> })
<ide> excitedGreeting: function(){
<del> return this.getPath("contnet.firstName") + "!!!"
<add> return this.getPath("content.firstName") + "!!!"
<ide> }
<ide> })
<ide>
<ide> Ember.View = Ember.Object.extend(Ember.Evented,
<ide> },
<ide>
<ide> /**
<del> Replaces the view's element to the specified parent element.
<add> Replaces the content of the specified parent element with this view's element.
<ide> If the view does not have an HTML representation yet, `createElement()`
<ide> will be called automatically.
<del> If the parent element already has some content, it will be removed.
<ide>
<ide> Note that this method just schedules the view to be appended; the DOM
<ide> element will not be appended to the given element until all bindings have
<ide> Ember.View = Ember.Object.extend(Ember.Evented,
<ide> return value !== undefined ? value : Ember.guidFor(this);
<ide> }).cacheable(),
<ide>
<del> /** @private */
<add> /**
<add> @private
<add>
<add> TODO: Perhaps this should be removed from the production build somehow.
<add> */
<ide> _elementIdDidChange: Ember.beforeObserver(function() {
<ide> throw "Changing a view's elementId after creation is not allowed.";
<ide> }, 'elementId'), | 1 |
Javascript | Javascript | add support for namespaced listeners | c31590e2f7e126e1fe161f37f22c1590197a245e | <ide><path>d3.js
<del>(function(){d3 = {version: "0.30.6"}; // semver
<add>(function(){d3 = {version: "0.30.8"}; // semver
<ide> if (!Date.now) Date.now = function() {
<ide> return +new Date();
<ide> };
<ide> function d3_selection(groups) {
<ide> return groups;
<ide> };
<ide>
<del> // TODO namespaced event listeners to allow multiples
<add> // type can be namespaced, e.g., "click.foo"
<add> // listener can be null for removal
<ide> groups.on = function(type, listener) {
<add>
<add> // parse the type specifier
<add> var i = type.indexOf("."),
<add> typo = i == -1 ? type : type.substring(0, i),
<add> name = "__on" + type;
<add>
<add> // remove the old event listener, and add the new event listener
<ide> return groups.each(function(d, i) {
<del> var l = function(e) {
<add> if (this[name]) this.removeEventListener(typo, this[name], false);
<add> if (listener) this.addEventListener(typo, this[name] = l, false);
<add>
<add> // wrapped event listener that preserves d, i
<add> function l(e) {
<ide> var o = d3.event; // Events can be reentrant (e.g., focus).
<ide> d3.event = e;
<ide> try {
<ide> listener.call(this, d, i);
<ide> } finally {
<ide> d3.event = o;
<ide> }
<del> };
<del> if (this.addEventListener)
<del> this.addEventListener(type, l, false);
<del> else
<del> this["on" + type] = l;
<add> }
<ide> });
<ide> };
<ide>
<ide><path>d3.min.js
<ide> e.local)}:function(){return this.getAttribute(e)});return a.each(c==null?e.local
<ide> return a.each(typeof c=="function"?g:c?i:h)};a.style=function(e,c,i){function h(){this.style.removeProperty(e)}function g(){this.style.setProperty(e,c,i)}function k(){var j=c.apply(this,arguments);j==null?this.style.removeProperty(e):this.style.setProperty(e,j,i)}if(arguments.length<3)i=null;if(arguments.length<2)return f(function(){return window.getComputedStyle(this,null).getPropertyValue(e)});return a.each(c==null?h:typeof c=="function"?k:g)};a.property=function(e,c){function i(){delete this[e]}
<ide> function h(){this[e]=c}function g(){var k=c.apply(this,arguments);if(k==null)delete this[e];else this[e]=k}e=d3.ns.qualify(e);if(arguments.length<2)return f(function(){return this[e]});return a.each(c==null?i:typeof c=="function"?g:h)};a.text=function(e){function c(){this.appendChild(document.createTextNode(e))}function i(){var h=e.apply(this,arguments);h!=null&&this.appendChild(document.createTextNode(h))}if(arguments.length<1)return f(function(){return this.textContent});a.each(function(){for(;this.lastChild;)this.removeChild(this.lastChild)});
<ide> return e==null?a:a.each(typeof e=="function"?i:c)};a.html=function(e){function c(){this.innerHTML=e}function i(){this.innerHTML=e.apply(this,arguments)}if(arguments.length<1)return f(function(){return this.innerHTML});return a.each(typeof e=="function"?i:c)};a.append=function(e){function c(h){return h.appendChild(document.createElement(e))}function i(h){return h.appendChild(document.createElementNS(e.space,e.local))}e=d3.ns.qualify(e);return b(e.local?i:c)};a.insert=function(e,c){function i(g){return g.insertBefore(document.createElement(e),
<del>g.querySelector(c))}function h(g){return g.insertBefore(document.createElementNS(e.space,e.local),g.querySelector(c))}e=d3.ns.qualify(e);return b(e.local?h:i)};a.remove=function(){return b(function(e){var c=e.parentNode;c.removeChild(e);return c})};a.sort=function(e){e=Ga.apply(this,arguments);for(var c=0,i=a.length;c<i;c++){var h=a[c];h.sort(e);for(var g=1,k=h.length,j=h[0];g<k;g++){var o=h[g];if(o){j&&j.parentNode.insertBefore(o,j.nextSibling);j=o}}}return a};a.on=function(e,c){return a.each(function(i,
<del>h){var g=function(k){var j=d3.event;d3.event=k;try{c.call(this,i,h)}finally{d3.event=j}};if(this.addEventListener)this.addEventListener(e,g,false);else this["on"+e]=g})};a.transition=function(){return X(a)};a.call=ea;return a}function Ga(a){if(!arguments.length)a=d3.ascending;return function(b,d){return a(b&&b.__data__,d&&d.__data__)}}function X(a){function b(l){var n=true,q=-1;a.each(function(){if(g[++q]!=2){var m=(l-k[q])/j[q],r=this.__transition__,t,s,u=c[q];if(m<1){n=false;if(m<0)return}else m=
<del>1;if(g[q]){if(!r||r.active!=f){g[q]=2;return}}else if(!r||r.active>f){g[q]=2;return}else{g[q]=1;h.start.dispatch.apply(this,arguments);u=c[q]={};r.active=f;for(s in e)u[s]=e[s].apply(this,arguments)}t=p(m);for(s in e)u[s].call(this,t);if(m==1){g[q]=2;if(r.active==f){m=r.owner;if(m==f){delete this.__transition__;i&&this.parentNode.removeChild(this)}Y=f;h.end.dispatch.apply(this,arguments);Y=0;r.owner=m}}}});return n}var d={},f=Y||++Ha,e={},c=[],i=false,h=d3.dispatch("start","end"),g=[],k=[],j=[],o,
<del>p=d3.ease("cubic-in-out");a.each(function(){(this.__transition__||(this.__transition__={})).owner=f});d.delay=function(l){var n=Infinity,q=-1;if(typeof l=="function")a.each(function(){var m=k[++q]=+l.apply(this,arguments);if(m<n)n=m});else{n=+l;a.each(function(){k[++q]=n})}Ia(b,n);return d};d.duration=function(l){var n=-1;if(typeof l=="function"){o=0;a.each(function(){var q=j[++n]=+l.apply(this,arguments);if(q>o)o=q})}else{o=+l;a.each(function(){j[++n]=o})}return d};d.ease=function(l){p=typeof l==
<del>"string"?d3.ease(l):l;return d};d.attrTween=function(l,n){function q(r,t){var s=n.call(this,r,t,this.getAttribute(l));return function(u){this.setAttribute(l,s(u))}}function m(r,t){var s=n.call(this,r,t,this.getAttributeNS(l.space,l.local));return function(u){this.setAttributeNS(l.space,l.local,s(u))}}e["attr."+l]=l.local?m:q;return d};d.attr=function(l,n){return d.attrTween(l,ia(n))};d.styleTween=function(l,n,q){if(arguments.length<3)q=null;e["style."+l]=function(m,r){var t=n.call(this,m,r,window.getComputedStyle(this,
<del>null).getPropertyValue(l));return function(s){this.style.setProperty(l,t(s),q)}};return d};d.style=function(l,n,q){if(arguments.length<3)q=null;return d.styleTween(l,ia(n),q)};d.select=function(l){var n;l=X(a.select(l)).ease(p);n=-1;l.delay(function(){return k[++n]});n=-1;l.duration(function(){return j[++n]});return l};d.selectAll=function(l){var n;l=X(a.selectAll(l)).ease(p);n=-1;l.delay(function(q,m){return k[m?n:++n]});n=-1;l.duration(function(q,m){return j[m?n:++n]});return l};d.remove=function(){i=
<del>true;return d};d.each=function(l,n){h[l].add(n);return d};d.call=ea;return d.delay(0).duration(250)}function ia(a){return typeof a=="function"?function(b,d,f){return d3.interpolate(f,String(a.call(this,b,d)))}:(a=String(a),function(b,d,f){return d3.interpolate(f,a)})}function Ia(a,b){var d=Date.now(),f=false,e=d+b,c=F;if(isFinite(b)){for(;c;){if(c.callback==a){c.then=d;c.delay=b;f=true}else{var i=c.then+c.delay;if(i<e)e=i}c=c.next}f||(F={callback:a,then:d,delay:b,next:F});if(!K){clearTimeout(Z);Z=
<del>setTimeout(Ja,Math.max(24,e-d))}}}function Ja(){K=setInterval(Ka,24);Z=0}function Ka(){for(var a,b=Date.now(),d=F;d;){a=b-d.then;if(a>d.delay)d.flush=d.callback(a);d=d.next}a=null;for(b=F;b;)b=b.flush?a?a.next=b.next:F=b.next:(a=b).next;a||(K=clearInterval(K))}function La(a){return a.innerRadius}function Ma(a){return a.outerRadius}function ja(a){return a.startAngle}function ka(a){return a.endAngle}function $(a,b,d,f){var e=[],c=-1,i=b.length,h=typeof d=="function",g=typeof f=="function",k;if(h&&g)for(;++c<
<del>i;)e.push([d.call(a,k=b[c],c),f.call(a,k,c)]);else if(h)for(;++c<i;)e.push([d.call(a,b[c],c),f]);else if(g)for(;++c<i;)e.push([d,f.call(a,b[c],c)]);else for(;++c<i;)e.push([d,f]);return e}function la(a){return a[0]}function ma(a){return a[1]}function I(a){var b=[],d=0,f=a.length,e=a[0];for(b.push(e[0],",",e[1]);++d<f;)b.push("L",(e=a[d])[0],",",e[1]);return b.join("")}function na(a,b){if(b.length<1||a.length!=b.length&&a.length!=b.length+2)return I(a);var d=a.length!=b.length,f="",e=a[0],c=a[1],i=
<del>b[0],h=i,g=1;if(d){f+="Q"+(c[0]-i[0]*2/3)+","+(c[1]-i[1]*2/3)+","+c[0]+","+c[1];e=a[1];g=2}if(b.length>1){h=b[1];c=a[g];g++;f+="C"+(e[0]+i[0])+","+(e[1]+i[1])+","+(c[0]-h[0])+","+(c[1]-h[1])+","+c[0]+","+c[1];for(e=2;e<b.length;e++,g++){c=a[g];h=b[e];f+="S"+(c[0]-h[0])+","+(c[1]-h[1])+","+c[0]+","+c[1]}}if(d){d=a[g];f+="Q"+(c[0]+h[0]*2/3)+","+(c[1]+h[1]*2/3)+","+d[0]+","+d[1]}return f}function oa(a,b){for(var d=[],f=(1-b)/2,e=a[0],c=a[1],i=a[2],h=2,g=a.length;++h<g;){d.push([f*(i[0]-e[0]),f*(i[1]-
<del>e[1])]);e=c;c=i;i=a[h]}d.push([f*(i[0]-e[0]),f*(i[1]-e[1])]);return d}function C(a,b){return a[0]*b[0]+a[1]*b[1]+a[2]*b[2]+a[3]*b[3]}function L(a,b,d){a.push("C",C(pa,b),",",C(pa,d),",",C(qa,b),",",C(qa,d),",",C(M,b),",",C(M,d))}function Na(){return 0}function Oa(a){return a.source}function Pa(a){return a.target}function Qa(a){return a.radius}function Ra(){return 64}function Sa(){return"circle"}d3={version:"0.30.6"};if(!Date.now)Date.now=function(){return+new Date};if(!Object.create)Object.create=
<del>function(a){function b(){}b.prototype=a;return new b};d3.ascending=function(a,b){return a<b?-1:a>b?1:0};d3.descending=function(a,b){return b<a?-1:b>a?1:0};d3.min=function(a,b){var d=0,f=a.length,e=a[0],c;if(arguments.length==1)for(;++d<f;){if(e>(c=a[d]))e=c}else for(e=b(a[0]);++d<f;)if(e>(c=b(a[d])))e=c;return e};d3.max=function(a,b){var d=0,f=a.length,e=a[0],c;if(arguments.length==1)for(;++d<f;){if(e<(c=a[d]))e=c}else for(e=b(e);++d<f;)if(e<(c=b(a[d])))e=c;return e};d3.nest=function(){function a(c,
<del>i){if(c>=d.length)return e?e.call(b,i):f?i.sort(f):i;for(var h=-1,g=i.length,k=d[c],j,o=[],p,l={};++h<g;)if((j=k(p=i[h]))in l)l[j].push(p);else{l[j]=[p];o.push(j)}c++;h=-1;for(g=o.length;++h<g;){p=l[j=o[h]];l[j]=a(c,p)}return l}var b={},d=[],f,e;b.map=function(c){return a(0,c)};b.key=function(c){d.push(c);return b};b.sortKeys=function(){return b};b.sortValues=function(c){f=c;return b};b.rollup=function(c){e=c;return b};return b};d3.keys=function(a){var b=[],d;for(d in a)b.push(d);return b};d3.values=
<del>function(a){var b=[],d;for(d in a)b.push(a[d]);return b};d3.entries=function(a){var b=[],d;for(d in a)b.push({key:d,value:a[d]});return b};d3.merge=function(a){return Array.prototype.concat.apply([],a)};d3.split=function(a,b){var d=[],f=[],e,c=-1,i=a.length;if(arguments.length<2)b=ua;for(;++c<i;)if(b.call(f,e=a[c],c))f=[];else{f.length||d.push(f);f.push(e)}return d};d3.range=function(a,b,d){if(arguments.length==1){b=a;a=0}if(d==null)d=1;if((b-a)/d==Infinity)throw Error("infinite range");var f=[],
<del>e=-1,c;if(d<0)for(;(c=a+d*++e)>b;)f.push(c);else for(;(c=a+d*++e)<b;)f.push(c);return f};d3.requote=function(a){return a.replace(Ta,"\\$&")};var Ta=/[\\\^\$\*\+\?\[\]\(\)\.\{\}]/g;d3.xhr=function(a,b,d){var f=new XMLHttpRequest;if(arguments.length<3)d=b;else b&&f.overrideMimeType(b);f.open("GET",a,true);f.onreadystatechange=function(){if(f.readyState==4)d(f.status<300?f:null)};f.send(null)};d3.text=function(a,b,d){if(arguments.length<3){d=b;b=null}d3.xhr(a,b,function(f){d(f&&f.responseText)})};d3.json=
<del>function(a,b){d3.text(a,"application/json",function(d){b(d?JSON.parse(d):null)})};d3.html=function(a,b){d3.text(a,"text/html",function(d){if(d!=null){var f=document.createRange();f.selectNode(document.body);d=f.createContextualFragment(d)}b(d)})};d3.xml=function(a,b,d){if(arguments.length<3){d=b;b=null}d3.xhr(a,b,function(f){d(f&&f.responseXML)})};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",
<del>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(){for(var a={},b,d=0,f=arguments.length;d<f;d++){b=arguments[d];a[b]=va(b)}return a};d3.format=function(a){a=Ua.exec(a);var b=a[1]||" ",d=ra[a[3]]||ra["-"],f=a[5],e=+a[6],c=a[7],i=a[8],h=a[9];if(i)i=i.substring(1);if(f)b="0";if(h=="d")i="0";return function(g){g=+g;var k=g<0&&(g=-g);if(h=="d"&&g%1)return"";g=i?g.toFixed(i):
<del>""+g;if(c){for(var j=g.lastIndexOf("."),o=j>=0?g.substring(j):(j=g.length,""),p=[];j>0;)p.push(g.substring(j-=3,j+3));g=p.reverse().join(",")+o}k=(g=d(k,g)).length;if(k<e)g=Array(e-k+1).join(b)+g;return g}};var Ua=/(?:([^{])?([<>=^]))?([+\- ])?(#)?(0)?([0-9]+)?(,)?(\.[0-9]+)?([a-zA-Z%])?/,ra={"+":function(a,b){return(a?"−":"+")+b}," ":function(a,b){return(a?"−":" ")+b},"-":function(a,b){return a?"−"+b:b}},Va=S(2),Wa=S(3),Xa={linear:function(){return wa},poly:S,quad:function(){return Va},cubic:function(){return Wa},
<del>sin:function(){return xa},exp:function(){return ya},circle:function(){return za},elastic:function(a,b){var d;if(arguments.length<2)b=0.45;if(arguments.length<1){a=1;d=b/4}else d=b/(2*Math.PI)*Math.asin(1/a);return function(f){return 1+a*Math.pow(2,10*-f)*Math.sin((f-d)*2*Math.PI/b)}},back:function(a){a||(a=1.70158);return function(b){return b*b*((a+1)*b-a)}},bounce:function(){return Aa}},Ya={"in":function(a){return a},out:fa,"in-out":ga,"out-in":function(a){return ga(fa(a))}};d3.ease=function(a){var b=
<del>a.indexOf("-"),d=b>=0?a.substring(0,b):a;b=b>=0?a.substring(b+1):"in";return Ya[b](Xa[d].apply(null,Array.prototype.slice.call(arguments,1)))};d3.event=null;d3.interpolate=function(a,b){if(typeof b=="number")return d3.interpolateNumber(+a,b);if(typeof b=="string")return b in G||/^(#|rgb\(|hsl\()/.test(b)?d3.interpolateRgb(String(a),b):d3.interpolateString(String(a),b);if(b instanceof Array)return d3.interpolateArray(a,b);return d3.interpolateObject(a,b)};d3.interpolateNumber=function(a,b){b-=a;return function(d){return a+
<del>b*d}};d3.interpolateRound=function(a,b){b-=a;return function(d){return Math.round(a+b*d)}};d3.interpolateString=function(a,b){var d,f,e=0,c=[],i=[],h,g;for(f=0;d=aa.exec(b);++f){d.index&&c.push(b.substring(e,d.index));i.push({i:c.length,x:d[0]});c.push(null);e=aa.lastIndex}e<b.length&&c.push(b.substring(e));f=0;for(h=i.length;(d=aa.exec(a))&&f<h;++f){g=i[f];if(g.x==d[0]){if(g.i)if(c[g.i+1]==null){c[g.i-1]+=g.x;c.splice(g.i,1);for(d=f+1;d<h;++d)i[d].i--}else{c[g.i-1]+=g.x+c[g.i+1];c.splice(g.i,2);
<del>for(d=f+1;d<h;++d)i[d].i-=2}else if(c[g.i+1]==null)c[g.i]=g.x;else{c[g.i]=g.x+c[g.i+1];c.splice(g.i+1,1);for(d=f+1;d<h;++d)i[d].i--}i.splice(f,1);h--;f--}else g.x=d3.interpolateNumber(parseFloat(d[0]),parseFloat(g.x))}for(;f<h;){g=i.pop();if(c[g.i+1]==null)c[g.i]=g.x;else{c[g.i]=g.x+c[g.i+1];c.splice(g.i+1,1)}h--}if(c.length==1)return c[0]==null?i[0].x:function(){return b};return function(k){for(f=0;f<h;++f)c[(g=i[f]).i]=g.x(k);return c.join("")}};d3.interpolateRgb=function(a,b){a=d3.rgb(a);b=d3.rgb(b);
<del>var d=a.r,f=a.g,e=a.b,c=b.r-d,i=b.g-f,h=b.b-e;return function(g){return"rgb("+Math.round(d+c*g)+","+Math.round(f+i*g)+","+Math.round(e+h*g)+")"}};d3.interpolateArray=function(a,b){var d=[],f=[],e=a.length,c=b.length,i=Math.min(a.length,b.length),h;for(h=0;h<i;++h)d.push(d3.interpolate(a[h],b[h]));for(;h<e;++h)f[h]=a[h];for(;h<c;++h)f[h]=b[h];return function(g){for(h=0;h<i;++h)f[h]=d[h](g);return f}};d3.interpolateObject=function(a,b){var d={},f={},e;for(e in a)if(e in b)d[e]=(e in Za||/\bcolor\b/.test(e)?
<del>d3.interpolateRgb:d3.interpolate)(a[e],b[e]);else f[e]=a[e];for(e in b)e in a||(f[e]=b[e]);return function(c){for(e in d)f[e]=d[e](c);return f}};var aa=/[-+]?(?:\d+\.\d+|\d+\.|\.\d+|\d+)(?:[eE][-]?\d+)?/g,Za={background:1,fill:1,stroke:1};d3.rgb=function(a,b,d){return arguments.length==1?U(""+a,J,ha):J(~~a,~~b,~~d)};var G={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",
<del>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",
<del>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",
<del>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",
<del>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",
<del>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",
<del>tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"},ba;for(ba in G)G[ba]=U(G[ba],J,ha);d3.hsl=function(a,b,d){return arguments.length==1?U(""+a,Ca,W):W(+a,+b,+d)};var N=y([[document]]);N[0].parentNode=document.documentElement;d3.select=function(a){return typeof a=="string"?N.select(a):y([[a]])};d3.selectAll=function(a){return typeof a=="string"?N.selectAll(a):
<del>y([R(a)])};d3.transition=N.transition;var Ha=0,Y=0,F=null,Z=0,K;d3.scale={};d3.scale.linear=function(){function a(j){return k((j-d)*i)}function b(j){var o=Math.min(d,f),p=Math.max(d,f),l=p-o,n=Math.pow(10,Math.floor(Math.log(l/j)/Math.LN10));j=j/(l/n);if(j<=0.15)n*=10;else if(j<=0.35)n*=5;else if(j<=0.75)n*=2;return{start:Math.ceil(o/n)*n,stop:Math.floor(p/n)*n+n*0.5,step:n}}var d=0,f=1,e=0,c=1,i=1/(f-d),h=(f-d)/(c-e),g=d3.interpolate,k=g(e,c);a.invert=function(j){return(j-e)*h+d};a.domain=function(j){if(!arguments.length)return[d,
<del>f];d=j[0];f=j[1];i=1/(f-d);h=(f-d)/(c-e);return a};a.range=function(j){if(!arguments.length)return[e,c];e=j[0];c=j[1];h=(f-d)/(c-e);k=g(e,c);return a};a.rangeRound=function(j){return a.range(j).interpolate(d3.interpolateRound)};a.interpolate=function(j){if(!arguments.length)return g;k=(g=j)(e,c);return a};a.ticks=function(j){j=b(j);return d3.range(j.start,j.stop,j.step)};a.tickFormat=function(j){j=Math.max(0,-Math.floor(Math.log(b(j).step)/Math.LN10+0.01));return d3.format(",."+j+"f")};return a};
<del>d3.scale.log=function(){function a(c){return(e?-Math.log(-c):Math.log(c))/Math.LN10}function b(c){return e?-Math.pow(10,-c):Math.pow(10,c)}function d(c){return f(a(c))}var f=d3.scale.linear(),e=false;d.invert=function(c){return b(f.invert(c))};d.domain=function(c){if(!arguments.length)return f.domain().map(b);e=(c[0]||c[1])<0;f.domain(c.map(a));return d};d.range=D(d,f.range);d.rangeRound=D(d,f.rangeRound);d.interpolate=D(d,f.interpolate);d.ticks=function(){var c=f.domain(),i=[];if(c.every(isFinite)){var h=
<del>Math.floor(c[0]),g=Math.ceil(c[1]),k=b(c[0]);c=b(c[1]);if(e)for(i.push(b(h));h++<g;)for(var j=9;j>0;j--)i.push(b(h)*j);else{for(;h<g;h++)for(j=1;j<10;j++)i.push(b(h)*j);i.push(b(h))}for(h=0;i[h]<k;h++);for(g=i.length;i[g-1]>c;g--);i=i.slice(h,g)}return i};d.tickFormat=function(){return function(c){return c.toPrecision(1)}};return d};d3.scale.pow=function(){function a(g){return h?-Math.pow(-g,c):Math.pow(g,c)}function b(g){return h?-Math.pow(-g,i):Math.pow(g,i)}function d(g){return f(a(g))}var f=d3.scale.linear(),
<del>e=d3.scale.linear(),c=1,i=1/c,h=false;d.invert=function(g){return b(f.invert(g))};d.domain=function(g){if(!arguments.length)return f.domain().map(b);h=(g[0]||g[1])<0;f.domain(g.map(a));e.domain(g);return d};d.range=D(d,f.range);d.rangeRound=D(d,f.rangeRound);d.inteprolate=D(d,f.interpolate);d.ticks=e.ticks;d.tickFormat=e.tickFormat;d.exponent=function(g){if(!arguments.length)return c;var k=d.domain();c=g;i=1/g;return d.domain(k)};return d};d3.scale.sqrt=function(){return d3.scale.pow().exponent(0.5)};
<del>d3.scale.ordinal=function(){function a(c){c=c in d?d[c]:d[c]=b.push(c)-1;return f[c%f.length]}var b=[],d={},f=[],e=0;a.domain=function(c){if(!arguments.length)return b;b=c;d={};for(var i=-1,h=-1,g=b.length;++i<g;){c=b[i];c in d||(d[c]=++h)}return a};a.range=function(c){if(!arguments.length)return f;f=c;return a};a.rangePoints=function(c,i){if(arguments.length<2)i=0;var h=c[0],g=c[1],k=(g-h)/(b.length-1+i);f=b.length==1?[(h+g)/2]:d3.range(h+k*i/2,g+k/2,k);e=0;return a};a.rangeBands=function(c,i){if(arguments.length<
<del>2)i=0;var h=c[0],g=c[1],k=(g-h)/(b.length+i);f=d3.range(h+k*i,g,k);e=k*(1-i);return a};a.rangeRoundBands=function(c,i){if(arguments.length<2)i=0;var h=c[0],g=c[1],k=g-h,j=Math.floor(k/(b.length+i));f=d3.range(h+Math.round((k-(b.length-i)*j)/2),g,j);e=Math.round(j*(1-i));return a};a.rangeBand=function(){return e};return a};d3.scale.category10=function(){return d3.scale.ordinal().range($a)};d3.scale.category20=function(){return d3.scale.ordinal().range(ab)};d3.scale.category20b=function(){return d3.scale.ordinal().range(bb)};
<del>d3.scale.category20c=function(){return d3.scale.ordinal().range(cb)};var $a=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],ab=["#1f77b4","#aec7e8","#ff7f0e","#ffbb78","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5","#8c564b","#c49c94","#e377c2","#f7b6d2","#7f7f7f","#c7c7c7","#bcbd22","#dbdb8d","#17becf","#9edae5"],bb=["#393b79","#5254a3","#6b6ecf","#9c9ede","#637939","#8ca252","#b5cf6b","#cedb9c","#8c6d31","#bd9e39","#e7ba52","#e7cb94",
<del>"#843c39","#ad494a","#d6616b","#e7969c","#7b4173","#a55194","#ce6dbd","#de9ed6"],cb=["#3182bd","#6baed6","#9ecae1","#c6dbef","#e6550d","#fd8d3c","#fdae6b","#fdd0a2","#31a354","#74c476","#a1d99b","#c7e9c0","#756bb1","#9e9ac8","#bcbddc","#dadaeb","#636363","#969696","#bdbdbd","#d9d9d9"];d3.scale.quantile=function(){function a(){for(var i=-1,h=c.length=e.length,g=f.length/h;++i<h;)c[i]=f[~~(i*g)]}function b(i){if(isNaN(i=+i))return NaN;for(var h=0,g=c.length-1;h<=g;){var k=h+g>>1,j=c[k];if(j<i)h=k+1;
<del>else if(j>i)g=k-1;else return k}return g<0?0:g}function d(i){return e[b(i)]}var f=[],e=[],c=[];d.domain=function(i){if(!arguments.length)return f;f=i.filter(function(h){return!isNaN(h)}).sort(d3.ascending);a();return d};d.range=function(i){if(!arguments.length)return e;e=i;a();return d};d.quantiles=function(){return c};return d};d3.scale.quantize=function(){function a(i){return c[Math.max(0,Math.min(e,Math.floor(f*(i-b))))]}var b=0,d=1,f=2,e=1,c=[0,1];a.domain=function(i){if(!arguments.length)return[b,
<del>d];b=i[0];d=i[1];f=c.length/(d-b);return a};a.range=function(i){if(!arguments.length)return c;c=i;f=c.length/(d-b);e=c.length-1;return a};return a};d3.svg={};d3.svg.arc=function(){function a(c,i){var h=b.call(this,c,i),g=d.call(this,c,i),k=f.call(this,c,i)+O,j=e.call(this,c,i)+O,o=j-k,p=o<Math.PI?"0":"1",l=Math.cos(k);k=Math.sin(k);var n=Math.cos(j);j=Math.sin(j);return o>=db?h?"M0,"+g+"A"+g+","+g+" 0 1,1 0,"+-g+"A"+g+","+g+" 0 1,1 0,"+g+"M0,"+h+"A"+h+","+h+" 0 1,1 0,"+-h+"A"+h+","+h+" 0 1,1 0,"+
<del>h+"Z":"M0,"+g+"A"+g+","+g+" 0 1,1 0,"+-g+"A"+g+","+g+" 0 1,1 0,"+g+"Z":h?"M"+g*l+","+g*k+"A"+g+","+g+" 0 "+p+",1 "+g*n+","+g*j+"L"+h*n+","+h*j+"A"+h+","+h+" 0 "+p+",0 "+h*l+","+h*k+"Z":"M"+g*l+","+g*k+"A"+g+","+g+" 0 "+p+",1 "+g*n+","+g*j+"L0,0Z"}var b=La,d=Ma,f=ja,e=ka;a.innerRadius=function(c){if(!arguments.length)return b;b=v(c);return a};a.outerRadius=function(c){if(!arguments.length)return d;d=v(c);return a};a.startAngle=function(c){if(!arguments.length)return f;f=v(c);return a};a.endAngle=function(c){if(!arguments.length)return e;
<del>e=v(c);return a};return a};var O=-Math.PI/2,db=2*Math.PI-1.0E-6;d3.svg.line=function(){function a(i){return i.length<1?null:"M"+e($(this,i,b,d),c)}var b=la,d=ma,f="linear",e=P[f],c=0.7;a.x=function(i){if(!arguments.length)return b;b=i;return a};a.y=function(i){if(!arguments.length)return d;d=i;return a};a.interpolate=function(i){if(!arguments.length)return f;e=P[f=i];return a};a.tension=function(i){if(!arguments.length)return c;c=i;return a};return a};var P={linear:I,basis:function(a){if(a.length<
<del>3)return I(a);var b=[],d=1,f=a.length,e=a[0],c=e[0],i=e[1],h=[c,c,c,(e=a[1])[0]],g=[i,i,i,e[1]];b.push(c,",",i);for(L(b,h,g);++d<f;){e=a[d];h.shift();h.push(e[0]);g.shift();g.push(e[1]);L(b,h,g)}for(d=-1;++d<2;){h.shift();h.push(e[0]);g.shift();g.push(e[1]);L(b,h,g)}return b.join("")},"basis-closed":function(a){for(var b,d=-1,f=a.length,e=f+4,c,i=[],h=[];++d<4;){c=a[d%f];i.push(c[0]);h.push(c[1])}b=[C(M,i),",",C(M,h)];for(--d;++d<e;){c=a[d%f];i.shift();i.push(c[0]);h.shift();h.push(c[1]);L(b,i,h)}return b.join("")},
<del>cardinal:function(a,b){if(a.length<3)return I(a);return a[0]+na(a,oa(a,b))},"cardinal-closed":function(a,b){if(a.length<3)return I(a);return a[0]+na(a,oa([a[a.length-2]].concat(a,[a[1]]),b))}},pa=[0,2/3,1/3,0],qa=[0,1/3,2/3,0],M=[0,1/6,2/3,1/6];d3.svg.area=function(){function a(h){return h.length<1?null:"M"+c($(this,h,b,f),i)+"L"+c($(this,h,b,d).reverse(),i)+"Z"}var b=la,d=Na,f=ma,e="linear",c=P[e],i=0.7;a.x=function(h){if(!arguments.length)return b;b=h;return a};a.y0=function(h){if(!arguments.length)return d;
<del>d=h;return a};a.y1=function(h){if(!arguments.length)return f;f=h;return a};a.interpolate=function(h){if(!arguments.length)return e;c=P[e=h];return a};a.tension=function(h){if(!arguments.length)return i;i=h;return a};return a};d3.svg.chord=function(){function a(h,g){var k=b(this,d,h,g),j=b(this,f,h,g);return"M"+k.p0+("A"+k.r+","+k.r+" 0 0,1 "+k.p1)+(k.a0==j.a0&&k.a1==j.a1?"Q 0,0 "+k.p0:"Q 0,0 "+j.p0+("A"+j.r+","+j.r+" 0 0,1 "+j.p1)+("Q 0,0 "+k.p0))+"Z"}function b(h,g,k,j){var o=g.call(h,k,j);g=e.call(h,
<del>o,j);k=c.call(h,o,j)+O;h=i.call(h,o,j)+O;return{r:g,a0:k,a1:h,p0:[g*Math.cos(k),g*Math.sin(k)],p1:[g*Math.cos(h),g*Math.sin(h)]}}var d=Oa,f=Pa,e=Qa,c=ja,i=ka;a.radius=function(h){if(!arguments.length)return e;e=v(h);return a};a.source=function(h){if(!arguments.length)return d;d=v(h);return a};a.target=function(h){if(!arguments.length)return f;f=v(h);return a};a.startAngle=function(h){if(!arguments.length)return c;c=v(h);return a};a.endAngle=function(h){if(!arguments.length)return i;i=v(h);return a};
<del>return a};d3.svg.mouse=function(a){var b=(a.ownerSVGElement||a).createSVGPoint();if(ca<0&&(window.scrollX||window.scrollY)){var d=d3.select(document.body).append("svg:svg").style("position","absolute").style("top",0).style("left",0),f=d[0][0].getScreenCTM();ca=!(f.f||f.e);d.remove()}if(ca){b.x=d3.event.pageX;b.y=d3.event.pageY}else{b.x=d3.event.clientX;b.y=d3.event.clientY}b=b.matrixTransform(a.getScreenCTM().inverse());return[b.x,b.y]};var ca=/WebKit/.test(navigator.userAgent)?-1:0;d3.svg.symbol=
<del>function(){function a(f,e){return(sa[b.call(this,f,e)]||sa.circle)(d.call(this,f,e))}var b=Sa,d=Ra;a.type=function(f){if(!arguments.length)return b;b=v(f);return a};a.size=function(f){if(!arguments.length)return d;d=v(f);return a};return a};d3.svg.symbolTypes=["circle","cross","diamond","square","triangle-down","triangle-up"];var sa={circle:function(a){a=Math.sqrt(a/Math.PI);return"M0,"+a+"A"+a+","+a+" 0 1,1 0,"+-a+"A"+a+","+a+" 0 1,1 0,"+a+"Z"},cross:function(a){a=Math.sqrt(a/5)/2;return"M"+-3*a+
<del>","+-a+"H"+-a+"V"+-3*a+"H"+a+"V"+-a+"H"+3*a+"V"+a+"H"+a+"V"+3*a+"H"+-a+"V"+a+"H"+-3*a+"Z"},diamond:function(a){a=Math.sqrt(a/(2*ta));var b=a*ta;return"M0,"+-a+"L"+b+",0 0,"+a+" "+-b+",0Z"},square:function(a){a=Math.sqrt(a)/2;return"M"+-a+","+-a+"L"+a+","+-a+" "+a+","+a+" "+-a+","+a+"Z"},"triangle-down":function(a){a=Math.sqrt(a/Q);var b=a*Q/2;return"M0,"+b+"L"+a+","+-b+" "+-a+","+-b+"Z"},"triangle-up":function(a){a=Math.sqrt(a/Q);var b=a*Q/2;return"M0,"+-b+"L"+a+","+b+" "+-a+","+b+"Z"}},Q=Math.sqrt(3),
<del>ta=Math.tan(30*Math.PI/180)})();
<add>g.querySelector(c))}function h(g){return g.insertBefore(document.createElementNS(e.space,e.local),g.querySelector(c))}e=d3.ns.qualify(e);return b(e.local?h:i)};a.remove=function(){return b(function(e){var c=e.parentNode;c.removeChild(e);return c})};a.sort=function(e){e=Ga.apply(this,arguments);for(var c=0,i=a.length;c<i;c++){var h=a[c];h.sort(e);for(var g=1,k=h.length,j=h[0];g<k;g++){var o=h[g];if(o){j&&j.parentNode.insertBefore(o,j.nextSibling);j=o}}}return a};a.on=function(e,c){var i=e.indexOf("."),
<add>h=i==-1?e:e.substring(0,i),g="__on"+e;return a.each(function(k,j){function o(p){var l=d3.event;d3.event=p;try{c.call(this,k,j)}finally{d3.event=l}}this[g]&&this.removeEventListener(h,this[g],false);if(c)this.addEventListener(h,this[g]=o,false)})};a.transition=function(){return X(a)};a.call=ea;return a}function Ga(a){if(!arguments.length)a=d3.ascending;return function(b,d){return a(b&&b.__data__,d&&d.__data__)}}function X(a){function b(l){var n=true,q=-1;a.each(function(){if(g[++q]!=2){var m=(l-k[q])/
<add>j[q],r=this.__transition__,t,s,u=c[q];if(m<1){n=false;if(m<0)return}else m=1;if(g[q]){if(!r||r.active!=f){g[q]=2;return}}else if(!r||r.active>f){g[q]=2;return}else{g[q]=1;h.start.dispatch.apply(this,arguments);u=c[q]={};r.active=f;for(s in e)u[s]=e[s].apply(this,arguments)}t=p(m);for(s in e)u[s].call(this,t);if(m==1){g[q]=2;if(r.active==f){m=r.owner;if(m==f){delete this.__transition__;i&&this.parentNode.removeChild(this)}Y=f;h.end.dispatch.apply(this,arguments);Y=0;r.owner=m}}}});return n}var d={},
<add>f=Y||++Ha,e={},c=[],i=false,h=d3.dispatch("start","end"),g=[],k=[],j=[],o,p=d3.ease("cubic-in-out");a.each(function(){(this.__transition__||(this.__transition__={})).owner=f});d.delay=function(l){var n=Infinity,q=-1;if(typeof l=="function")a.each(function(){var m=k[++q]=+l.apply(this,arguments);if(m<n)n=m});else{n=+l;a.each(function(){k[++q]=n})}Ia(b,n);return d};d.duration=function(l){var n=-1;if(typeof l=="function"){o=0;a.each(function(){var q=j[++n]=+l.apply(this,arguments);if(q>o)o=q})}else{o=
<add>+l;a.each(function(){j[++n]=o})}return d};d.ease=function(l){p=typeof l=="string"?d3.ease(l):l;return d};d.attrTween=function(l,n){function q(r,t){var s=n.call(this,r,t,this.getAttribute(l));return function(u){this.setAttribute(l,s(u))}}function m(r,t){var s=n.call(this,r,t,this.getAttributeNS(l.space,l.local));return function(u){this.setAttributeNS(l.space,l.local,s(u))}}e["attr."+l]=l.local?m:q;return d};d.attr=function(l,n){return d.attrTween(l,ia(n))};d.styleTween=function(l,n,q){if(arguments.length<
<add>3)q=null;e["style."+l]=function(m,r){var t=n.call(this,m,r,window.getComputedStyle(this,null).getPropertyValue(l));return function(s){this.style.setProperty(l,t(s),q)}};return d};d.style=function(l,n,q){if(arguments.length<3)q=null;return d.styleTween(l,ia(n),q)};d.select=function(l){var n;l=X(a.select(l)).ease(p);n=-1;l.delay(function(){return k[++n]});n=-1;l.duration(function(){return j[++n]});return l};d.selectAll=function(l){var n;l=X(a.selectAll(l)).ease(p);n=-1;l.delay(function(q,m){return k[m?
<add>n:++n]});n=-1;l.duration(function(q,m){return j[m?n:++n]});return l};d.remove=function(){i=true;return d};d.each=function(l,n){h[l].add(n);return d};d.call=ea;return d.delay(0).duration(250)}function ia(a){return typeof a=="function"?function(b,d,f){return d3.interpolate(f,String(a.call(this,b,d)))}:(a=String(a),function(b,d,f){return d3.interpolate(f,a)})}function Ia(a,b){var d=Date.now(),f=false,e=d+b,c=F;if(isFinite(b)){for(;c;){if(c.callback==a){c.then=d;c.delay=b;f=true}else{var i=c.then+c.delay;
<add>if(i<e)e=i}c=c.next}f||(F={callback:a,then:d,delay:b,next:F});if(!K){clearTimeout(Z);Z=setTimeout(Ja,Math.max(24,e-d))}}}function Ja(){K=setInterval(Ka,24);Z=0}function Ka(){for(var a,b=Date.now(),d=F;d;){a=b-d.then;if(a>d.delay)d.flush=d.callback(a);d=d.next}a=null;for(b=F;b;)b=b.flush?a?a.next=b.next:F=b.next:(a=b).next;a||(K=clearInterval(K))}function La(a){return a.innerRadius}function Ma(a){return a.outerRadius}function ja(a){return a.startAngle}function ka(a){return a.endAngle}function $(a,
<add>b,d,f){var e=[],c=-1,i=b.length,h=typeof d=="function",g=typeof f=="function",k;if(h&&g)for(;++c<i;)e.push([d.call(a,k=b[c],c),f.call(a,k,c)]);else if(h)for(;++c<i;)e.push([d.call(a,b[c],c),f]);else if(g)for(;++c<i;)e.push([d,f.call(a,b[c],c)]);else for(;++c<i;)e.push([d,f]);return e}function la(a){return a[0]}function ma(a){return a[1]}function I(a){var b=[],d=0,f=a.length,e=a[0];for(b.push(e[0],",",e[1]);++d<f;)b.push("L",(e=a[d])[0],",",e[1]);return b.join("")}function na(a,b){if(b.length<1||a.length!=
<add>b.length&&a.length!=b.length+2)return I(a);var d=a.length!=b.length,f="",e=a[0],c=a[1],i=b[0],h=i,g=1;if(d){f+="Q"+(c[0]-i[0]*2/3)+","+(c[1]-i[1]*2/3)+","+c[0]+","+c[1];e=a[1];g=2}if(b.length>1){h=b[1];c=a[g];g++;f+="C"+(e[0]+i[0])+","+(e[1]+i[1])+","+(c[0]-h[0])+","+(c[1]-h[1])+","+c[0]+","+c[1];for(e=2;e<b.length;e++,g++){c=a[g];h=b[e];f+="S"+(c[0]-h[0])+","+(c[1]-h[1])+","+c[0]+","+c[1]}}if(d){d=a[g];f+="Q"+(c[0]+h[0]*2/3)+","+(c[1]+h[1]*2/3)+","+d[0]+","+d[1]}return f}function oa(a,b){for(var d=
<add>[],f=(1-b)/2,e=a[0],c=a[1],i=a[2],h=2,g=a.length;++h<g;){d.push([f*(i[0]-e[0]),f*(i[1]-e[1])]);e=c;c=i;i=a[h]}d.push([f*(i[0]-e[0]),f*(i[1]-e[1])]);return d}function C(a,b){return a[0]*b[0]+a[1]*b[1]+a[2]*b[2]+a[3]*b[3]}function L(a,b,d){a.push("C",C(pa,b),",",C(pa,d),",",C(qa,b),",",C(qa,d),",",C(M,b),",",C(M,d))}function Na(){return 0}function Oa(a){return a.source}function Pa(a){return a.target}function Qa(a){return a.radius}function Ra(){return 64}function Sa(){return"circle"}d3={version:"0.30.8"};
<add>if(!Date.now)Date.now=function(){return+new Date};if(!Object.create)Object.create=function(a){function b(){}b.prototype=a;return new b};d3.ascending=function(a,b){return a<b?-1:a>b?1:0};d3.descending=function(a,b){return b<a?-1:b>a?1:0};d3.min=function(a,b){var d=0,f=a.length,e=a[0],c;if(arguments.length==1)for(;++d<f;){if(e>(c=a[d]))e=c}else for(e=b(a[0]);++d<f;)if(e>(c=b(a[d])))e=c;return e};d3.max=function(a,b){var d=0,f=a.length,e=a[0],c;if(arguments.length==1)for(;++d<f;){if(e<(c=a[d]))e=c}else for(e=
<add>b(e);++d<f;)if(e<(c=b(a[d])))e=c;return e};d3.nest=function(){function a(c,i){if(c>=d.length)return e?e.call(b,i):f?i.sort(f):i;for(var h=-1,g=i.length,k=d[c],j,o=[],p,l={};++h<g;)if((j=k(p=i[h]))in l)l[j].push(p);else{l[j]=[p];o.push(j)}c++;h=-1;for(g=o.length;++h<g;){p=l[j=o[h]];l[j]=a(c,p)}return l}var b={},d=[],f,e;b.map=function(c){return a(0,c)};b.key=function(c){d.push(c);return b};b.sortKeys=function(){return b};b.sortValues=function(c){f=c;return b};b.rollup=function(c){e=c;return b};return b};
<add>d3.keys=function(a){var b=[],d;for(d in a)b.push(d);return b};d3.values=function(a){var b=[],d;for(d in a)b.push(a[d]);return b};d3.entries=function(a){var b=[],d;for(d in a)b.push({key:d,value:a[d]});return b};d3.merge=function(a){return Array.prototype.concat.apply([],a)};d3.split=function(a,b){var d=[],f=[],e,c=-1,i=a.length;if(arguments.length<2)b=ua;for(;++c<i;)if(b.call(f,e=a[c],c))f=[];else{f.length||d.push(f);f.push(e)}return d};d3.range=function(a,b,d){if(arguments.length==1){b=a;a=0}if(d==
<add>null)d=1;if((b-a)/d==Infinity)throw Error("infinite range");var f=[],e=-1,c;if(d<0)for(;(c=a+d*++e)>b;)f.push(c);else for(;(c=a+d*++e)<b;)f.push(c);return f};d3.requote=function(a){return a.replace(Ta,"\\$&")};var Ta=/[\\\^\$\*\+\?\[\]\(\)\.\{\}]/g;d3.xhr=function(a,b,d){var f=new XMLHttpRequest;if(arguments.length<3)d=b;else b&&f.overrideMimeType(b);f.open("GET",a,true);f.onreadystatechange=function(){if(f.readyState==4)d(f.status<300?f:null)};f.send(null)};d3.text=function(a,b,d){if(arguments.length<
<add>3){d=b;b=null}d3.xhr(a,b,function(f){d(f&&f.responseText)})};d3.json=function(a,b){d3.text(a,"application/json",function(d){b(d?JSON.parse(d):null)})};d3.html=function(a,b){d3.text(a,"text/html",function(d){if(d!=null){var f=document.createRange();f.selectNode(document.body);d=f.createContextualFragment(d)}b(d)})};d3.xml=function(a,b,d){if(arguments.length<3){d=b;b=null}d3.xhr(a,b,function(f){d(f&&f.responseXML)})};d3.ns={prefix:{svg:"http://www.w3.org/2000/svg",xhtml:"http://www.w3.org/1999/xhtml",
<add>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(){for(var a={},b,d=0,f=arguments.length;d<f;d++){b=arguments[d];a[b]=va(b)}return a};d3.format=function(a){a=Ua.exec(a);var b=a[1]||" ",d=ra[a[3]]||ra["-"],f=a[5],e=+a[6],c=a[7],i=a[8],h=a[9];if(i)i=i.substring(1);if(f)b="0";if(h=="d")i="0";return function(g){g=
<add>+g;var k=g<0&&(g=-g);if(h=="d"&&g%1)return"";g=i?g.toFixed(i):""+g;if(c){for(var j=g.lastIndexOf("."),o=j>=0?g.substring(j):(j=g.length,""),p=[];j>0;)p.push(g.substring(j-=3,j+3));g=p.reverse().join(",")+o}k=(g=d(k,g)).length;if(k<e)g=Array(e-k+1).join(b)+g;return g}};var Ua=/(?:([^{])?([<>=^]))?([+\- ])?(#)?(0)?([0-9]+)?(,)?(\.[0-9]+)?([a-zA-Z%])?/,ra={"+":function(a,b){return(a?"−":"+")+b}," ":function(a,b){return(a?"−":" ")+b},"-":function(a,b){return a?"−"+b:b}},Va=S(2),Wa=S(3),Xa={linear:function(){return wa},
<add>poly:S,quad:function(){return Va},cubic:function(){return Wa},sin:function(){return xa},exp:function(){return ya},circle:function(){return za},elastic:function(a,b){var d;if(arguments.length<2)b=0.45;if(arguments.length<1){a=1;d=b/4}else d=b/(2*Math.PI)*Math.asin(1/a);return function(f){return 1+a*Math.pow(2,10*-f)*Math.sin((f-d)*2*Math.PI/b)}},back:function(a){a||(a=1.70158);return function(b){return b*b*((a+1)*b-a)}},bounce:function(){return Aa}},Ya={"in":function(a){return a},out:fa,"in-out":ga,
<add>"out-in":function(a){return ga(fa(a))}};d3.ease=function(a){var b=a.indexOf("-"),d=b>=0?a.substring(0,b):a;b=b>=0?a.substring(b+1):"in";return Ya[b](Xa[d].apply(null,Array.prototype.slice.call(arguments,1)))};d3.event=null;d3.interpolate=function(a,b){if(typeof b=="number")return d3.interpolateNumber(+a,b);if(typeof b=="string")return b in G||/^(#|rgb\(|hsl\()/.test(b)?d3.interpolateRgb(String(a),b):d3.interpolateString(String(a),b);if(b instanceof Array)return d3.interpolateArray(a,b);return d3.interpolateObject(a,
<add>b)};d3.interpolateNumber=function(a,b){b-=a;return function(d){return a+b*d}};d3.interpolateRound=function(a,b){b-=a;return function(d){return Math.round(a+b*d)}};d3.interpolateString=function(a,b){var d,f,e=0,c=[],i=[],h,g;for(f=0;d=aa.exec(b);++f){d.index&&c.push(b.substring(e,d.index));i.push({i:c.length,x:d[0]});c.push(null);e=aa.lastIndex}e<b.length&&c.push(b.substring(e));f=0;for(h=i.length;(d=aa.exec(a))&&f<h;++f){g=i[f];if(g.x==d[0]){if(g.i)if(c[g.i+1]==null){c[g.i-1]+=g.x;c.splice(g.i,1);
<add>for(d=f+1;d<h;++d)i[d].i--}else{c[g.i-1]+=g.x+c[g.i+1];c.splice(g.i,2);for(d=f+1;d<h;++d)i[d].i-=2}else if(c[g.i+1]==null)c[g.i]=g.x;else{c[g.i]=g.x+c[g.i+1];c.splice(g.i+1,1);for(d=f+1;d<h;++d)i[d].i--}i.splice(f,1);h--;f--}else g.x=d3.interpolateNumber(parseFloat(d[0]),parseFloat(g.x))}for(;f<h;){g=i.pop();if(c[g.i+1]==null)c[g.i]=g.x;else{c[g.i]=g.x+c[g.i+1];c.splice(g.i+1,1)}h--}if(c.length==1)return c[0]==null?i[0].x:function(){return b};return function(k){for(f=0;f<h;++f)c[(g=i[f]).i]=g.x(k);
<add>return c.join("")}};d3.interpolateRgb=function(a,b){a=d3.rgb(a);b=d3.rgb(b);var d=a.r,f=a.g,e=a.b,c=b.r-d,i=b.g-f,h=b.b-e;return function(g){return"rgb("+Math.round(d+c*g)+","+Math.round(f+i*g)+","+Math.round(e+h*g)+")"}};d3.interpolateArray=function(a,b){var d=[],f=[],e=a.length,c=b.length,i=Math.min(a.length,b.length),h;for(h=0;h<i;++h)d.push(d3.interpolate(a[h],b[h]));for(;h<e;++h)f[h]=a[h];for(;h<c;++h)f[h]=b[h];return function(g){for(h=0;h<i;++h)f[h]=d[h](g);return f}};d3.interpolateObject=function(a,
<add>b){var d={},f={},e;for(e in a)if(e in b)d[e]=(e in Za||/\bcolor\b/.test(e)?d3.interpolateRgb:d3.interpolate)(a[e],b[e]);else f[e]=a[e];for(e in b)e in a||(f[e]=b[e]);return function(c){for(e in d)f[e]=d[e](c);return f}};var aa=/[-+]?(?:\d+\.\d+|\d+\.|\.\d+|\d+)(?:[eE][-]?\d+)?/g,Za={background:1,fill:1,stroke:1};d3.rgb=function(a,b,d){return arguments.length==1?U(""+a,J,ha):J(~~a,~~b,~~d)};var G={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",
<add>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",
<add>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",
<add>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",
<add>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",
<add>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",
<add>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"},ba;for(ba in G)G[ba]=U(G[ba],J,ha);d3.hsl=function(a,b,d){return arguments.length==1?U(""+a,Ca,W):W(+a,+b,+d)};var N=y([[document]]);N[0].parentNode=document.documentElement;d3.select=function(a){return typeof a=="string"?N.select(a):
<add>y([[a]])};d3.selectAll=function(a){return typeof a=="string"?N.selectAll(a):y([R(a)])};d3.transition=N.transition;var Ha=0,Y=0,F=null,Z=0,K;d3.scale={};d3.scale.linear=function(){function a(j){return k((j-d)*i)}function b(j){var o=Math.min(d,f),p=Math.max(d,f),l=p-o,n=Math.pow(10,Math.floor(Math.log(l/j)/Math.LN10));j=j/(l/n);if(j<=0.15)n*=10;else if(j<=0.35)n*=5;else if(j<=0.75)n*=2;return{start:Math.ceil(o/n)*n,stop:Math.floor(p/n)*n+n*0.5,step:n}}var d=0,f=1,e=0,c=1,i=1/(f-d),h=(f-d)/(c-e),g=d3.interpolate,
<add>k=g(e,c);a.invert=function(j){return(j-e)*h+d};a.domain=function(j){if(!arguments.length)return[d,f];d=j[0];f=j[1];i=1/(f-d);h=(f-d)/(c-e);return a};a.range=function(j){if(!arguments.length)return[e,c];e=j[0];c=j[1];h=(f-d)/(c-e);k=g(e,c);return a};a.rangeRound=function(j){return a.range(j).interpolate(d3.interpolateRound)};a.interpolate=function(j){if(!arguments.length)return g;k=(g=j)(e,c);return a};a.ticks=function(j){j=b(j);return d3.range(j.start,j.stop,j.step)};a.tickFormat=function(j){j=Math.max(0,
<add>-Math.floor(Math.log(b(j).step)/Math.LN10+0.01));return d3.format(",."+j+"f")};return a};d3.scale.log=function(){function a(c){return(e?-Math.log(-c):Math.log(c))/Math.LN10}function b(c){return e?-Math.pow(10,-c):Math.pow(10,c)}function d(c){return f(a(c))}var f=d3.scale.linear(),e=false;d.invert=function(c){return b(f.invert(c))};d.domain=function(c){if(!arguments.length)return f.domain().map(b);e=(c[0]||c[1])<0;f.domain(c.map(a));return d};d.range=D(d,f.range);d.rangeRound=D(d,f.rangeRound);d.interpolate=
<add>D(d,f.interpolate);d.ticks=function(){var c=f.domain(),i=[];if(c.every(isFinite)){var h=Math.floor(c[0]),g=Math.ceil(c[1]),k=b(c[0]);c=b(c[1]);if(e)for(i.push(b(h));h++<g;)for(var j=9;j>0;j--)i.push(b(h)*j);else{for(;h<g;h++)for(j=1;j<10;j++)i.push(b(h)*j);i.push(b(h))}for(h=0;i[h]<k;h++);for(g=i.length;i[g-1]>c;g--);i=i.slice(h,g)}return i};d.tickFormat=function(){return function(c){return c.toPrecision(1)}};return d};d3.scale.pow=function(){function a(g){return h?-Math.pow(-g,c):Math.pow(g,c)}function b(g){return h?
<add>-Math.pow(-g,i):Math.pow(g,i)}function d(g){return f(a(g))}var f=d3.scale.linear(),e=d3.scale.linear(),c=1,i=1/c,h=false;d.invert=function(g){return b(f.invert(g))};d.domain=function(g){if(!arguments.length)return f.domain().map(b);h=(g[0]||g[1])<0;f.domain(g.map(a));e.domain(g);return d};d.range=D(d,f.range);d.rangeRound=D(d,f.rangeRound);d.inteprolate=D(d,f.interpolate);d.ticks=e.ticks;d.tickFormat=e.tickFormat;d.exponent=function(g){if(!arguments.length)return c;var k=d.domain();c=g;i=1/g;return d.domain(k)};
<add>return d};d3.scale.sqrt=function(){return d3.scale.pow().exponent(0.5)};d3.scale.ordinal=function(){function a(c){c=c in d?d[c]:d[c]=b.push(c)-1;return f[c%f.length]}var b=[],d={},f=[],e=0;a.domain=function(c){if(!arguments.length)return b;b=c;d={};for(var i=-1,h=-1,g=b.length;++i<g;){c=b[i];c in d||(d[c]=++h)}return a};a.range=function(c){if(!arguments.length)return f;f=c;return a};a.rangePoints=function(c,i){if(arguments.length<2)i=0;var h=c[0],g=c[1],k=(g-h)/(b.length-1+i);f=b.length==1?[(h+g)/
<add>2]:d3.range(h+k*i/2,g+k/2,k);e=0;return a};a.rangeBands=function(c,i){if(arguments.length<2)i=0;var h=c[0],g=c[1],k=(g-h)/(b.length+i);f=d3.range(h+k*i,g,k);e=k*(1-i);return a};a.rangeRoundBands=function(c,i){if(arguments.length<2)i=0;var h=c[0],g=c[1],k=g-h,j=Math.floor(k/(b.length+i));f=d3.range(h+Math.round((k-(b.length-i)*j)/2),g,j);e=Math.round(j*(1-i));return a};a.rangeBand=function(){return e};return a};d3.scale.category10=function(){return d3.scale.ordinal().range($a)};d3.scale.category20=
<add>function(){return d3.scale.ordinal().range(ab)};d3.scale.category20b=function(){return d3.scale.ordinal().range(bb)};d3.scale.category20c=function(){return d3.scale.ordinal().range(cb)};var $a=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],ab=["#1f77b4","#aec7e8","#ff7f0e","#ffbb78","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5","#8c564b","#c49c94","#e377c2","#f7b6d2","#7f7f7f","#c7c7c7","#bcbd22","#dbdb8d","#17becf","#9edae5"],bb=
<add>["#393b79","#5254a3","#6b6ecf","#9c9ede","#637939","#8ca252","#b5cf6b","#cedb9c","#8c6d31","#bd9e39","#e7ba52","#e7cb94","#843c39","#ad494a","#d6616b","#e7969c","#7b4173","#a55194","#ce6dbd","#de9ed6"],cb=["#3182bd","#6baed6","#9ecae1","#c6dbef","#e6550d","#fd8d3c","#fdae6b","#fdd0a2","#31a354","#74c476","#a1d99b","#c7e9c0","#756bb1","#9e9ac8","#bcbddc","#dadaeb","#636363","#969696","#bdbdbd","#d9d9d9"];d3.scale.quantile=function(){function a(){for(var i=-1,h=c.length=e.length,g=f.length/h;++i<h;)c[i]=
<add>f[~~(i*g)]}function b(i){if(isNaN(i=+i))return NaN;for(var h=0,g=c.length-1;h<=g;){var k=h+g>>1,j=c[k];if(j<i)h=k+1;else if(j>i)g=k-1;else return k}return g<0?0:g}function d(i){return e[b(i)]}var f=[],e=[],c=[];d.domain=function(i){if(!arguments.length)return f;f=i.filter(function(h){return!isNaN(h)}).sort(d3.ascending);a();return d};d.range=function(i){if(!arguments.length)return e;e=i;a();return d};d.quantiles=function(){return c};return d};d3.scale.quantize=function(){function a(i){return c[Math.max(0,
<add>Math.min(e,Math.floor(f*(i-b))))]}var b=0,d=1,f=2,e=1,c=[0,1];a.domain=function(i){if(!arguments.length)return[b,d];b=i[0];d=i[1];f=c.length/(d-b);return a};a.range=function(i){if(!arguments.length)return c;c=i;f=c.length/(d-b);e=c.length-1;return a};return a};d3.svg={};d3.svg.arc=function(){function a(c,i){var h=b.call(this,c,i),g=d.call(this,c,i),k=f.call(this,c,i)+O,j=e.call(this,c,i)+O,o=j-k,p=o<Math.PI?"0":"1",l=Math.cos(k);k=Math.sin(k);var n=Math.cos(j);j=Math.sin(j);return o>=db?h?"M0,"+g+
<add>"A"+g+","+g+" 0 1,1 0,"+-g+"A"+g+","+g+" 0 1,1 0,"+g+"M0,"+h+"A"+h+","+h+" 0 1,1 0,"+-h+"A"+h+","+h+" 0 1,1 0,"+h+"Z":"M0,"+g+"A"+g+","+g+" 0 1,1 0,"+-g+"A"+g+","+g+" 0 1,1 0,"+g+"Z":h?"M"+g*l+","+g*k+"A"+g+","+g+" 0 "+p+",1 "+g*n+","+g*j+"L"+h*n+","+h*j+"A"+h+","+h+" 0 "+p+",0 "+h*l+","+h*k+"Z":"M"+g*l+","+g*k+"A"+g+","+g+" 0 "+p+",1 "+g*n+","+g*j+"L0,0Z"}var b=La,d=Ma,f=ja,e=ka;a.innerRadius=function(c){if(!arguments.length)return b;b=v(c);return a};a.outerRadius=function(c){if(!arguments.length)return d;
<add>d=v(c);return a};a.startAngle=function(c){if(!arguments.length)return f;f=v(c);return a};a.endAngle=function(c){if(!arguments.length)return e;e=v(c);return a};return a};var O=-Math.PI/2,db=2*Math.PI-1.0E-6;d3.svg.line=function(){function a(i){return i.length<1?null:"M"+e($(this,i,b,d),c)}var b=la,d=ma,f="linear",e=P[f],c=0.7;a.x=function(i){if(!arguments.length)return b;b=i;return a};a.y=function(i){if(!arguments.length)return d;d=i;return a};a.interpolate=function(i){if(!arguments.length)return f;
<add>e=P[f=i];return a};a.tension=function(i){if(!arguments.length)return c;c=i;return a};return a};var P={linear:I,basis:function(a){if(a.length<3)return I(a);var b=[],d=1,f=a.length,e=a[0],c=e[0],i=e[1],h=[c,c,c,(e=a[1])[0]],g=[i,i,i,e[1]];b.push(c,",",i);for(L(b,h,g);++d<f;){e=a[d];h.shift();h.push(e[0]);g.shift();g.push(e[1]);L(b,h,g)}for(d=-1;++d<2;){h.shift();h.push(e[0]);g.shift();g.push(e[1]);L(b,h,g)}return b.join("")},"basis-closed":function(a){for(var b,d=-1,f=a.length,e=f+4,c,i=[],h=[];++d<
<add>4;){c=a[d%f];i.push(c[0]);h.push(c[1])}b=[C(M,i),",",C(M,h)];for(--d;++d<e;){c=a[d%f];i.shift();i.push(c[0]);h.shift();h.push(c[1]);L(b,i,h)}return b.join("")},cardinal:function(a,b){if(a.length<3)return I(a);return a[0]+na(a,oa(a,b))},"cardinal-closed":function(a,b){if(a.length<3)return I(a);return a[0]+na(a,oa([a[a.length-2]].concat(a,[a[1]]),b))}},pa=[0,2/3,1/3,0],qa=[0,1/3,2/3,0],M=[0,1/6,2/3,1/6];d3.svg.area=function(){function a(h){return h.length<1?null:"M"+c($(this,h,b,f),i)+"L"+c($(this,
<add>h,b,d).reverse(),i)+"Z"}var b=la,d=Na,f=ma,e="linear",c=P[e],i=0.7;a.x=function(h){if(!arguments.length)return b;b=h;return a};a.y0=function(h){if(!arguments.length)return d;d=h;return a};a.y1=function(h){if(!arguments.length)return f;f=h;return a};a.interpolate=function(h){if(!arguments.length)return e;c=P[e=h];return a};a.tension=function(h){if(!arguments.length)return i;i=h;return a};return a};d3.svg.chord=function(){function a(h,g){var k=b(this,d,h,g),j=b(this,f,h,g);return"M"+k.p0+("A"+k.r+","+
<add>k.r+" 0 0,1 "+k.p1)+(k.a0==j.a0&&k.a1==j.a1?"Q 0,0 "+k.p0:"Q 0,0 "+j.p0+("A"+j.r+","+j.r+" 0 0,1 "+j.p1)+("Q 0,0 "+k.p0))+"Z"}function b(h,g,k,j){var o=g.call(h,k,j);g=e.call(h,o,j);k=c.call(h,o,j)+O;h=i.call(h,o,j)+O;return{r:g,a0:k,a1:h,p0:[g*Math.cos(k),g*Math.sin(k)],p1:[g*Math.cos(h),g*Math.sin(h)]}}var d=Oa,f=Pa,e=Qa,c=ja,i=ka;a.radius=function(h){if(!arguments.length)return e;e=v(h);return a};a.source=function(h){if(!arguments.length)return d;d=v(h);return a};a.target=function(h){if(!arguments.length)return f;
<add>f=v(h);return a};a.startAngle=function(h){if(!arguments.length)return c;c=v(h);return a};a.endAngle=function(h){if(!arguments.length)return i;i=v(h);return a};return a};d3.svg.mouse=function(a){var b=(a.ownerSVGElement||a).createSVGPoint();if(ca<0&&(window.scrollX||window.scrollY)){var d=d3.select(document.body).append("svg:svg").style("position","absolute").style("top",0).style("left",0),f=d[0][0].getScreenCTM();ca=!(f.f||f.e);d.remove()}if(ca){b.x=d3.event.pageX;b.y=d3.event.pageY}else{b.x=d3.event.clientX;
<add>b.y=d3.event.clientY}b=b.matrixTransform(a.getScreenCTM().inverse());return[b.x,b.y]};var ca=/WebKit/.test(navigator.userAgent)?-1:0;d3.svg.symbol=function(){function a(f,e){return(sa[b.call(this,f,e)]||sa.circle)(d.call(this,f,e))}var b=Sa,d=Ra;a.type=function(f){if(!arguments.length)return b;b=v(f);return a};a.size=function(f){if(!arguments.length)return d;d=v(f);return a};return a};d3.svg.symbolTypes=["circle","cross","diamond","square","triangle-down","triangle-up"];var sa={circle:function(a){a=
<add>Math.sqrt(a/Math.PI);return"M0,"+a+"A"+a+","+a+" 0 1,1 0,"+-a+"A"+a+","+a+" 0 1,1 0,"+a+"Z"},cross:function(a){a=Math.sqrt(a/5)/2;return"M"+-3*a+","+-a+"H"+-a+"V"+-3*a+"H"+a+"V"+-a+"H"+3*a+"V"+a+"H"+a+"V"+3*a+"H"+-a+"V"+a+"H"+-3*a+"Z"},diamond:function(a){a=Math.sqrt(a/(2*ta));var b=a*ta;return"M0,"+-a+"L"+b+",0 0,"+a+" "+-b+",0Z"},square:function(a){a=Math.sqrt(a)/2;return"M"+-a+","+-a+"L"+a+","+-a+" "+a+","+a+" "+-a+","+a+"Z"},"triangle-down":function(a){a=Math.sqrt(a/Q);var b=a*Q/2;return"M0,"+
<add>b+"L"+a+","+-b+" "+-a+","+-b+"Z"},"triangle-up":function(a){a=Math.sqrt(a/Q);var b=a*Q/2;return"M0,"+-b+"L"+a+","+b+" "+-a+","+b+"Z"}},Q=Math.sqrt(3),ta=Math.tan(30*Math.PI/180)})();
<ide><path>src/core/core.js
<del>d3 = {version: "0.30.7"}; // semver
<add>d3 = {version: "0.30.8"}; // semver
<ide><path>src/core/selection.js
<ide> function d3_selection(groups) {
<ide> return groups;
<ide> };
<ide>
<del> // TODO namespaced event listeners to allow multiples
<add> // type can be namespaced, e.g., "click.foo"
<add> // listener can be null for removal
<ide> groups.on = function(type, listener) {
<add>
<add> // parse the type specifier
<add> var i = type.indexOf("."),
<add> typo = i == -1 ? type : type.substring(0, i),
<add> name = "__on" + type;
<add>
<add> // remove the old event listener, and add the new event listener
<ide> return groups.each(function(d, i) {
<del> var l = function(e) {
<add> if (this[name]) this.removeEventListener(typo, this[name], false);
<add> if (listener) this.addEventListener(typo, this[name] = l, false);
<add>
<add> // wrapped event listener that preserves d, i
<add> function l(e) {
<ide> var o = d3.event; // Events can be reentrant (e.g., focus).
<ide> d3.event = e;
<ide> try {
<ide> listener.call(this, d, i);
<ide> } finally {
<ide> d3.event = o;
<ide> }
<del> };
<del> if (this.addEventListener)
<del> this.addEventListener(type, l, false);
<del> else
<del> this["on" + type] = l;
<add> }
<ide> });
<ide> };
<ide> | 4 |
Python | Python | add building block for the zroconf protocol | 0ad3fcdbfd3413fedc70ba86e593ac8c6cc9c831 | <ide><path>glances/__init__.py
<ide> # First log with Glances and PSUtil version
<ide> logger.info('Start Glances {0}'.format(__version__))
<ide> logger.info('{0} {1} and PSutil {2} detected'.format(platform.python_implementation(),
<del> platform.python_version(),
<del> __psutil_version))
<add> platform.python_version(),
<add> __psutil_version))
<ide>
<ide> # Check PSutil version
<del>if psutil_version < psutil_min_version:
<add>if psutil_version < psutil_min_version:
<ide> logger.critical('PSutil 2.0 or higher is needed. Glances cannot start.')
<ide> sys.exit(1)
<ide>
<ide> def main():
<ide>
<ide> elif core.is_client():
<ide> logger.info("Start client mode")
<del>
<ide> # Import the Glances client module
<ide> from glances.core.glances_client import GlancesClient
<ide>
<ide> # Init the client
<ide> client = GlancesClient(config=core.get_config(),
<ide> args=core.get_args())
<ide>
<del> # Test if client and server are in the same major version
<del> if not client.login():
<del> logger.critical(_("The server version is not compatible with the client"))
<del> sys.exit(2)
<add> if core.is_client_autodiscover():
<add> # !!! Create a new script with the client_browser feature
<add> import time
<add> while True:
<add> print client.get_servers_list()
<add> time.sleep(3)
<add>
<add> else:
<add> # Test if client and server are in the same major version
<add> if not client.login():
<add> logger.critical(
<add> _("The server version is not compatible with the client"))
<add> sys.exit(2)
<ide>
<del> # Start the client loop
<del> client.serve_forever()
<add> # Start the client loop
<add> client.serve_forever()
<ide>
<ide> # Shutdown the client
<ide> client.close()
<ide> def main():
<ide> server = GlancesServer(cached_time=core.cached_time,
<ide> config=core.get_config(),
<ide> args=args)
<del> print(_("Glances server is running on {0}:{1}").format(args.bind_address, args.port))
<add> print(_("Glances server is running on {0}:{1}").format(
<add> args.bind_address, args.port))
<ide>
<ide> # Set the server login/password (if -P/--password tag)
<ide> if args.password != "":
<ide><path>glances/core/glances_client.py
<ide> import sys
<ide> try:
<ide> from xmlrpc.client import Transport, ServerProxy, ProtocolError, Fault
<del>except ImportError:
<add>except ImportError:
<ide> # Python 2
<ide> from xmlrpclib import Transport, ServerProxy, ProtocolError, Fault
<ide> try:
<ide> import http.client as httplib
<del>except:
<add>except:
<ide> # Python 2
<ide> import httplib
<ide>
<ide> # Import Glances libs
<ide> from glances.core.glances_globals import version, logger
<ide> from glances.core.glances_stats import GlancesStatsClient
<ide> from glances.outputs.glances_curses import GlancesCurses
<add>from glances.core.glances_autodiscover import GlancesAutoDiscoverServer
<ide>
<ide>
<ide> class GlancesClientTransport(Transport):
<add>
<ide> """This class overwrite the default XML-RPC transport and manage timeout"""
<del>
<add>
<ide> def set_timeout(self, timeout):
<ide> self.timeout = timeout
<ide>
<ide> def make_connection(self, host):
<ide>
<ide>
<ide> class GlancesClient(object):
<add>
<ide> """This class creates and manages the TCP client."""
<ide>
<ide> def __init__(self, config=None, args=None):
<ide> def __init__(self, config=None, args=None):
<ide> # Configure the server timeout to 7 seconds
<ide> transport.set_timeout(7)
<ide> try:
<del> self.client = ServerProxy(uri, transport = transport)
<add> self.client = ServerProxy(uri, transport=transport)
<ide> except Exception as e:
<ide> logger.error(_("Couldn't create socket {0}: {1}").format(uri, e))
<ide> sys.exit(2)
<ide>
<add> # Start the autodiscover mode (Zeroconf listener)
<add> if self.args.autodiscover:
<add> self.autodiscover_server = GlancesAutoDiscoverServer()
<add>
<add> def get_servers_list(self):
<add> """Return the current server list (dict of dict)"""
<add> if self.args.autodiscover:
<add> return self.autodiscover_server.get_servers_list()
<add> else:
<add> return {}
<add>
<ide> def set_mode(self, mode='glances'):
<ide> """Set the client mode.
<ide>
<ide> def login(self):
<ide> except ProtocolError as err:
<ide> # Others errors
<ide> if str(err).find(" 401 ") > 0:
<del> logger.error(_("Connection to server failed (Bad password)"))
<add> logger.error(
<add> _("Connection to server failed (Bad password)"))
<ide> else:
<del> logger.error(_("Connection to server failed ({0})").format(err))
<add> logger.error(
<add> _("Connection to server failed ({0})").format(err))
<ide> sys.exit(2)
<ide>
<ide> if self.get_mode() == 'glances' and version[:3] == client_version[:3]:
<ide> # Init stats
<ide> self.stats = GlancesStatsClient()
<ide> self.stats.set_plugins(json.loads(self.client.getAllPlugins()))
<ide> else:
<del> logger.error("Client version: %s / Server version: %s" % (version, client_version))
<add> logger.error(
<add> "Client version: %s / Server version: %s" % (version, client_version))
<ide>
<ide> else:
<ide> self.set_mode('snmp')
<ide>
<del> if self.get_mode() == 'snmp':
<add> if self.get_mode() == 'snmp':
<ide> logger.info(_("Trying to grab stats by SNMP..."))
<ide> # Fallback to SNMP if needed
<ide> from glances.core.glances_stats import GlancesStatsClientSNMP
<ide> def update(self):
<ide> return self.update_snmp()
<ide> else:
<ide> self.end()
<del> logger.critical(_("Unknown server mode: {0}").format(self.get_mode()))
<add> logger.critical(
<add> _("Unknown server mode: {0}").format(self.get_mode()))
<ide> sys.exit(2)
<ide>
<ide> def update_glances(self):
<ide><path>glances/core/glances_main.py
<ide> def init_args(self):
<ide> help=_('connect to a Glances server by IPv4/IPv6 address or hostname'))
<ide> parser.add_argument('-s', '--server', action='store_true', default=False,
<ide> dest='server', help=_('run Glances in server mode'))
<add> parser.add_argument('--autodiscover', action='store_true', default=False,
<add> dest='autodiscover', help=_('autodetect all Glances servers on your local area network'))
<add> parser.add_argument('--disable-autodiscover', action='store_true', default=False,
<add> dest='disable_autodiscover', help=_('disable server announcement on the local area network'))
<ide> parser.add_argument('-p', '--port', default=None, type=int, dest='port',
<ide> help=_('define the client/server TCP port [default: {0}]').format(self.server_port))
<ide> parser.add_argument('-B', '--bind', default='0.0.0.0', dest='bind_address',
<ide> def __get_password(self, description='', confirm=False, clear=False):
<ide>
<ide> def is_standalone(self):
<ide> """Return True if Glances is running in standalone mode."""
<del> return not self.args.client and not self.args.server and not self.args.webserver
<add> return not self.args.client and not self.args.autodiscover and not self.args.server and not self.args.webserver
<ide>
<ide> def is_client(self):
<ide> """Return True if Glances is running in client mode."""
<del> return self.args.client and not self.args.server
<add> return (self.args.client or self.args.autodiscover) and not self.args.server
<add>
<add> def is_client_autodiscover(self):
<add> """Return True if Glances is running in client mode with autodiscover."""
<add> return self.args.autodiscover and not self.args.server
<ide>
<ide> def is_server(self):
<ide> """Return True if Glances is running in server mode."""
<ide><path>glances/core/glances_server.py
<ide> from glances.core.glances_globals import version, logger
<ide> from glances.core.glances_stats import GlancesStatsServer
<ide> from glances.core.glances_timer import Timer
<add>from glances.core.glances_autodiscover import GlancesAutoDiscoverClient
<ide>
<ide>
<ide> class GlancesXMLRPCHandler(SimpleXMLRPCRequestHandler):
<ide> def __init__(self, requestHandler=GlancesXMLRPCHandler,
<ide> cached_time=1,
<ide> config=None,
<ide> args=None):
<add> # Args
<add> self.args = args
<add>
<ide> # Init the XML RPC server
<ide> try:
<ide> self.server = GlancesXMLRPCServer(args.bind_address, args.port, requestHandler)
<ide> def __init__(self, requestHandler=GlancesXMLRPCHandler,
<ide> self.server.register_introspection_functions()
<ide> self.server.register_instance(GlancesInstance(cached_time, config))
<ide>
<add> # Announce the server to the network
<add> if not self.args.disable_autodiscover:
<add> # Note: The Zeroconf service name will be based on the hostname
<add> self.autodiscover_client = GlancesAutoDiscoverClient(socket.gethostname(), args)
<add> else:
<add> logger.info("Glances autodiscover announce is disabled")
<add>
<ide> def add_user(self, username, password):
<ide> """Add an user to the dictionary."""
<ide> self.server.user_dict[username] = password
<ide> def server_close(self):
<ide>
<ide> def end(self):
<ide> """End of the Glances server session."""
<add> if not self.args.disable_autodiscover:
<add> self.autodiscover_client.close()
<ide> self.server_close() | 4 |
Ruby | Ruby | reduce action.blank? calls | c99d28f1f223e87523559f071eca2d84ac41f14c | <ide><path>actionpack/lib/action_dispatch/routing/mapper.rb
<ide> def default_controller_and_action
<ide>
<ide> hash = {}
<ide>
<del> action = action.to_s unless action.is_a?(Regexp)
<del>
<ide> if controller.is_a? Regexp
<ide> hash[:controller] = controller
<ide> else
<ide> check_controller! controller.to_s
<ide> hash[:controller] = controller.to_s if controller
<ide> end
<ide>
<del> check_action! action
<add> if action.is_a? Regexp
<add> hash[:action] = action
<add> else
<add> check_action! action.to_s
<add> hash[:action] = action.to_s if action
<add> end
<ide>
<del> hash[:action] = action unless action.blank?
<ide> hash
<ide> end
<ide> end | 1 |
Javascript | Javascript | remove the `document.readystate` polyfill | 9ff3c6f99dc1c2debcd99158e09f7a1c3cab7065 | <ide><path>src/shared/compatibility.js
<ide> PDFJS.compatibilityChecked = true;
<ide> });
<ide> })();
<ide>
<del>// Provides correct document.readyState value for legacy browsers.
<del>// Support: IE9,10.
<del>(function checkDocumentReadyState() {
<del> if (!hasDOM) {
<del> return;
<del> }
<del> if (!document.attachEvent) {
<del> return;
<del> }
<del> var documentProto = document.constructor.prototype;
<del> var readyStateProto = Object.getOwnPropertyDescriptor(documentProto,
<del> 'readyState');
<del> Object.defineProperty(documentProto, 'readyState', {
<del> get() {
<del> var value = readyStateProto.get.call(this);
<del> return value === 'interactive' ? 'loading' : value;
<del> },
<del> set(value) {
<del> readyStateProto.set.call(this, value);
<del> },
<del> enumerable: true,
<del> configurable: true,
<del> });
<del>})();
<del>
<ide> // Provides support for ChildNode.remove in legacy browsers.
<ide> // Support: IE.
<ide> (function checkChildNodeRemove() { | 1 |
Python | Python | improve error message | 24e94730368c96ffe809370dad8ae5140136279d | <ide><path>rest_framework/permissions.py
<ide> def has_permission(self, request, view):
<ide>
<ide> assert queryset is not None, (
<ide> 'Cannot apply DjangoModelPermissions on a view that '
<del> 'does not have `.queryset` property.'
<add> 'does not have `.queryset` property nor redefines `.get_queryset()`.'
<ide> )
<ide>
<ide> perms = self.get_required_permissions(request.method, queryset.model) | 1 |
Javascript | Javascript | fix the merge | 8ee1f96b1918cf95dd636651bab6e7f6bf3a01df | <ide><path>src/obj.js
<ide> var XRef = (function XRefClosure() {
<ide> return e;
<ide> },
<ide> getCatalogObj: function XRef_getCatalogObj() {
<del> return this.this.root;
<add> return this.root;
<ide> }
<ide> };
<ide> | 1 |
Javascript | Javascript | add accusative condition for russian locale, fix | 5131e2d2b57cade078d197310b96c244d0cc24bd | <ide><path>locale/ru.js
<ide> 'accusative': 'воскресенье_понедельник_вторник_среду_четверг_пятницу_субботу'.split('_')
<ide> },
<ide>
<del> nounCase = (/\[ ?[Вв] ?(?:прошлую|следующую)? ?\] ?dddd/).test(format) ?
<add> nounCase = (/\[ ?[Вв] ?(?:прошлую|следующую|эту)? ?\] ?dddd/).test(format) ?
<ide> 'accusative' :
<ide> 'nominative';
<ide> | 1 |
Ruby | Ruby | extract common controllers to abstract_unit | 546497d027f9e4e55e99dbf7b499bb091d6b5d24 | <ide><path>actionpack/test/abstract_unit.rb
<ide> def url_for(set, options, recall = nil)
<ide> set.send(:url_for, options.merge(:only_path => true, :_recall => recall))
<ide> end
<ide> end
<add>
<add>class ResourcesController < ActionController::Base
<add> def index() render :nothing => true end
<add> alias_method :show, :index
<add>end
<add>
<add>class ThreadsController < ResourcesController; end
<add>class MessagesController < ResourcesController; end
<add>class CommentsController < ResourcesController; end
<add>class AuthorsController < ResourcesController; end
<add>class LogosController < ResourcesController; end
<add>
<add>class AccountsController < ResourcesController; end
<add>class AdminController < ResourcesController; end
<add>class ProductsController < ResourcesController; end
<add>class ImagesController < ResourcesController; end
<add>class PreferencesController < ResourcesController; end
<add>
<add>module Backoffice
<add> class ProductsController < ResourcesController; end
<add> class TagsController < ResourcesController; end
<add> class ManufacturersController < ResourcesController; end
<add> class ImagesController < ResourcesController; end
<add>
<add> module Admin
<add> class ProductsController < ResourcesController; end
<add> class ImagesController < ResourcesController; end
<add> end
<add>end
<ide><path>actionpack/test/controller/resources_test.rb
<ide> require 'active_support/core_ext/object/try'
<ide> require 'active_support/core_ext/object/with_options'
<ide>
<del>class ResourcesController < ActionController::Base
<del> def index() render :nothing => true end
<del> alias_method :show, :index
<del>end
<del>
<del>class ThreadsController < ResourcesController; end
<del>class MessagesController < ResourcesController; end
<del>class CommentsController < ResourcesController; end
<del>class AuthorsController < ResourcesController; end
<del>class LogosController < ResourcesController; end
<del>
<del>class AccountsController < ResourcesController; end
<del>class AdminController < ResourcesController; end
<del>class ProductsController < ResourcesController; end
<del>class ImagesController < ResourcesController; end
<del>class PreferencesController < ResourcesController; end
<del>
<del>module Backoffice
<del> class ProductsController < ResourcesController; end
<del> class TagsController < ResourcesController; end
<del> class ManufacturersController < ResourcesController; end
<del> class ImagesController < ResourcesController; end
<del>
<del> module Admin
<del> class ProductsController < ResourcesController; end
<del> class ImagesController < ResourcesController; end
<del> end
<del>end
<del>
<ide> class ResourcesTest < ActionController::TestCase
<ide> def test_default_restful_routes
<ide> with_restful_routing :messages do
<ide><path>actionpack/test/dispatch/routing/concerns_test.rb
<ide> require 'abstract_unit'
<ide>
<del>class CommentsController < ActionController::Base
<del> def index
<del> head :ok
<del> end
<del>end
<del>
<del>class ImageAttachmentsController < ActionController::Base
<del> def index
<del> head :ok
<del> end
<del>end
<del>
<ide> class RoutingConcernsTest < ActionDispatch::IntegrationTest
<ide> Routes = ActionDispatch::Routing::RouteSet.new.tap do |app|
<ide> app.draw do
<ide> class RoutingConcernsTest < ActionDispatch::IntegrationTest
<ide> end
<ide>
<ide> concern :image_attachable do
<del> resources :image_attachments, only: :index
<add> resources :images, only: :index
<ide> end
<ide>
<ide> resources :posts, concerns: [:commentable, :image_attachable] do
<ide> def test_accessing_concern_from_nested_resources
<ide> end
<ide>
<ide> def test_accessing_concern_from_resources_with_more_than_one_concern
<del> get "/posts/1/image_attachments"
<add> get "/posts/1/images"
<ide> assert_equal "200", @response.code
<del> assert_equal "/posts/1/image_attachments", post_image_attachments_path(post_id: 1)
<add> assert_equal "/posts/1/images", post_images_path(post_id: 1)
<ide> end
<ide>
<ide> def test_accessing_concern_from_resources_using_only_option
<del> get "/posts/1/image_attachment/1"
<add> get "/posts/1/image/1"
<ide> assert_equal "404", @response.code
<ide> end
<ide> | 3 |
Javascript | Javascript | remove hardwired references to 'iojs' | f78c722df5a254b27f4ae05d69dd03e1d2cb9ebc | <ide><path>test/debugger/test-debugger-remote.js
<ide> var expected = [];
<ide> var scriptToDebug = common.fixturesDir + '/empty.js';
<ide>
<ide> function fail() {
<del> assert(0); // `iojs --debug-brk script.js` should not quit
<add> assert(0); // `--debug-brk script.js` should not quit
<ide> }
<ide>
<ide> // running with debug agent
<ide> interfacer.on('line', function(line) {
<ide> assert.ok(expected == line, 'Got unexpected line: ' + line);
<ide> });
<ide>
<del>// give iojs time to start up the debugger
<add>// allow time to start up the debugger
<ide> setTimeout(function() {
<ide> child.removeListener('exit', fail);
<ide> child.kill();
<ide><path>test/parallel/test-process-argv-0.js
<ide> console.error('argv=%j', process.argv);
<ide> console.error('exec=%j', process.execPath);
<ide>
<ide> if (process.argv[2] !== 'child') {
<del> var child = spawn('./iojs', [__filename, 'child'], {
<add> var child = spawn(process.execPath, [__filename, 'child'], {
<ide> cwd: path.dirname(process.execPath)
<ide> });
<ide>
<ide><path>test/sequential/test-setproctitle.js
<ide> if ('linux freebsd darwin'.indexOf(process.platform) === -1) {
<ide> var common = require('../common');
<ide> var assert = require('assert');
<ide> var exec = require('child_process').exec;
<add>var path = require('path');
<ide>
<ide> // The title shouldn't be too long; libuv's uv_set_process_title() out of
<ide> // security considerations no longer overwrites envp, only argv, so the
<ide> exec('ps -p ' + process.pid + ' -o args=', function(error, stdout, stderr) {
<ide> assert.equal(stderr, '');
<ide>
<ide> // freebsd always add ' (procname)' to the process title
<del> if (process.platform === 'freebsd') title += ' (iojs)';
<add> if (process.platform === 'freebsd')
<add> title += ` (${path.basename(process.execPath)})`;
<ide>
<ide> // omitting trailing whitespace and \n
<ide> assert.equal(stdout.replace(/\s+$/, ''), title); | 3 |
Python | Python | update version number for trunk to 1.4.0 | d854e19f4a1c6e5b2ae4007152bbd962fb851642 | <ide><path>numpy/version.py
<del>version='1.3.0'
<add>version='1.4.0'
<ide> release=False
<ide>
<ide> if not release: | 1 |
Python | Python | specify the 'num_gpus' argument | ddbf38334a8a2d4e469d72fc4fde22c8b794680e | <ide><path>research/deep_speech/deep_speech.py
<ide> def run_deep_speech(_):
<ide>
<ide> # Use distribution strategy for multi-gpu training
<ide> num_gpus = flags_core.get_num_gpus(flags_obj)
<del> distribution_strategy = distribution_utils.get_distribution_strategy(num_gpus)
<add> distribution_strategy = distribution_utils.get_distribution_strategy(num_gpus=num_gpus)
<ide> run_config = tf.estimator.RunConfig(
<ide> train_distribute=distribution_strategy)
<ide> | 1 |
PHP | PHP | remove useless property | e56f2f4f0d64d033ad71c9822e404067568c2331 | <ide><path>tests/test_app/TestApp/Controller/RequestActionController.php
<ide> class RequestActionController extends AppController
<ide> {
<ide>
<del> /**
<del> * modelClass property
<del> *
<del> * @var string
<del> */
<del> public $modelClass = 'Posts';
<del>
<ide> /**
<ide> * test_request_action method
<ide> * | 1 |
Ruby | Ruby | remove useless number sign | 7bb34b12f09bdd94fe285caa18501aeffd1c64e6 | <ide><path>activerecord/lib/active_record/base.rb
<ide> module ActiveRecord #:nodoc:
<ide> #
<ide> # Dynamic attribute-based finders are a cleaner way of getting (and/or creating) objects
<ide> # by simple queries without turning to SQL. They work by appending the name of an attribute
<del> # to <tt>find_by_</tt> # like <tt>Person.find_by_user_name</tt>.
<del> # Instead of writing # <tt>Person.where(user_name: user_name).first</tt>, you just do
<add> # to <tt>find_by_</tt> like <tt>Person.find_by_user_name</tt>.
<add> # Instead of writing <tt>Person.where(user_name: user_name).first</tt>, you just do
<ide> # <tt>Person.find_by_user_name(user_name)</tt>.
<ide> #
<ide> # It's possible to add an exclamation point (!) on the end of the dynamic finders to get them to raise an | 1 |
Ruby | Ruby | use system tar for bottle toc inspection | edbb3a9e53358a720c390df23839cf8f4abb1b10 | <ide><path>Library/Homebrew/bottles.rb
<ide> def bottle_tag
<ide> end
<ide>
<ide> def bottle_receipt_path(bottle_file)
<del> Utils.popen_read("tar", "-tzf", bottle_file, "*/*/INSTALL_RECEIPT.json").chomp
<add> Utils.popen_read("/usr/bin/tar", "-tzf", bottle_file, "*/*/INSTALL_RECEIPT.json").chomp
<ide> end
<ide>
<ide> def bottle_resolve_formula_names(bottle_file) | 1 |
Mixed | Ruby | implement replace method so key? works correctly | f38e752bdf27668faf1125479f815832484c0a72 | <ide><path>activesupport/CHANGELOG.md
<ide> ## Rails 4.0.0 (unreleased) ##
<ide>
<add>* Implement HashWithIndifferentAccess#replace so key? works correctly. *David Graham*
<add>
<ide> * Hash#extract! returns only those keys that present in the receiver.
<ide>
<ide> {:a => 1, :b => 2}.extract!(:a, :x) # => {:a => 1}
<ide><path>activesupport/lib/active_support/hash_with_indifferent_access.rb
<ide> def reverse_merge!(other_hash)
<ide> replace(reverse_merge( other_hash ))
<ide> end
<ide>
<add> # Replaces the contents of this hash with other_hash.
<add> #
<add> # h = { "a" => 100, "b" => 200 }
<add> # h.replace({ "c" => 300, "d" => 400 }) #=> {"c"=>300, "d"=>400}
<add> def replace(other_hash)
<add> super(self.class.new_from_hash_copying_default(other_hash))
<add> end
<add>
<ide> # Removes the specified key from the hash.
<ide> def delete(key)
<ide> super(convert_key(key))
<ide><path>activesupport/test/core_ext/hash_ext_test.rb
<ide> def test_indifferent_merging
<ide> assert_equal 2, hash['b']
<ide> end
<ide>
<add> def test_indifferent_replace
<add> hash = HashWithIndifferentAccess.new
<add> hash[:a] = 42
<add>
<add> replaced = hash.replace(b: 12)
<add>
<add> assert hash.key?('b')
<add> assert !hash.key?(:a)
<add> assert_equal 12, hash[:b]
<add> assert_same hash, replaced
<add> end
<add>
<ide> def test_indifferent_merging_with_block
<ide> hash = HashWithIndifferentAccess.new
<ide> hash[:a] = 1 | 3 |
Javascript | Javascript | fix edge-case when protocol is non-lowercase | 48a4600c5669bb2b624bf004bbbb88a2d97ff6f8 | <ide><path>lib/url.js
<ide> Url.prototype.parse = function(url, parseQueryString, slashesDenoteHost) {
<ide> this.query = {};
<ide> }
<ide> if (rest) this.pathname = rest;
<del> if (slashedProtocol[proto] &&
<add> if (slashedProtocol[lowerProto] &&
<ide> this.hostname && !this.pathname) {
<ide> this.pathname = '/';
<ide> }
<ide><path>test/simple/test-url.js
<ide> var parseTests = {
<ide> 'path': '/'
<ide> },
<ide>
<add> 'HTTP://www.example.com' : {
<add> 'href': 'http://www.example.com/',
<add> 'protocol': 'http:',
<add> 'slashes': true,
<add> 'host': 'www.example.com',
<add> 'hostname': 'www.example.com',
<add> 'pathname': '/',
<add> 'path': '/'
<add> },
<add>
<ide> 'http://www.ExAmPlE.com/' : {
<ide> 'href': 'http://www.example.com/',
<ide> 'protocol': 'http:', | 2 |
Text | Text | add 2.15.0-beta.1 to changelog.md | 6ccb09546ecc300148b737eaed653b0361c16311 | <ide><path>CHANGELOG.md
<ide> # Ember Changelog
<ide>
<add>### 2.15.0-beta.1 (July 5, 2017)
<add>
<add>- [#14338](https://github.com/emberjs/ember.js/pull/14338) [FEATURE] Remove explicit names from initializers.
<add>- [#15325](https://github.com/emberjs/ember.js/pull/15325) / [#15326](https://github.com/emberjs/ember.js/pull/15326) [FEATURE ember-engines-mount-params] Allow `{{mount` to accept a `model` named parameter.
<add>- [#15347](https://github.com/emberjs/ember.js/pull/15347) [BUGFIX] Make better errors for meta updates after object destruction.
<add>- [#15411](https://github.com/emberjs/ember.js/pull/15411) [CLEANUP] Remove deprecated `Ember.Backburner`.
<add>- [#15366](https://github.com/emberjs/ember.js/pull/15366) [BUGFIX] Allow numeric keys for the `get` helper.
<add>- [#14805](https://github.com/emberjs/ember.js/pull/14805) / [#14861](https://github.com/emberjs/ember.js/pull/14861) / [#14979](https://github.com/emberjs/ember.js/pull/14979) / [#15414](https://github.com/emberjs/ember.js/pull/15414) / [#15415](https://github.com/emberjs/ember.js/pull/15415) [FEATURE ember-routing-router-service] Enable by default.
<add>- [#15193](https://github.com/emberjs/ember.js/pull/15193) [CLEANUP] Remove `owner._lookupFactory` support.
<add>
<ide> ### 2.14.0 (July 5, 2017)
<ide>
<ide> - [#15312](https://github.com/emberjs/ember.js/pull/15312) [BUGFIX] Avoid re-freezing already frozen objects. | 1 |
Go | Go | correct regexp to match v6 addresses with zone id | 3776604aab56cf610365d40279df7e598cc64d33 | <ide><path>libnetwork/resolvconf/resolvconf.go
<ide> var (
<ide> // -- e.g. other link-local types -- either won't work in containers or are unnecessary.
<ide> // For readability and sufficiency for Docker purposes this seemed more reasonable than a
<ide> // 1000+ character regexp with exact and complete IPv6 validation
<del> ipv6Address = `([0-9A-Fa-f]{0,4}:){2,7}([0-9A-Fa-f]{0,4})`
<add> ipv6Address = `([0-9A-Fa-f]{0,4}:){2,7}([0-9A-Fa-f]{0,4})(%\w+)?`
<ide>
<ide> localhostNSRegexp = regexp.MustCompile(`(?m)^nameserver\s+` + dns.IPLocalhost + `\s*\n*`)
<ide> nsIPv6Regexp = regexp.MustCompile(`(?m)^nameserver\s+` + ipv6Address + `\s*\n*`)
<ide><path>libnetwork/resolvconf/resolvconf_test.go
<ide> func TestFilterResolvDns(t *testing.T) {
<ide> }
<ide> }
<ide>
<add> // with IPv6 disabled (false param), the IPv6 link-local nameserver with zone ID should be removed
<add> ns1 = "nameserver 10.16.60.14\nnameserver FE80::BB1%1\nnameserver FE80::BB1%eth0\nnameserver 10.16.60.21\n"
<add> if result, _ := FilterResolvDNS([]byte(ns1), false); result != nil {
<add> if ns0 != string(result.Content) {
<add> t.Fatalf("Failed Localhost+IPv6 off: expected \n<%s> got \n<%s>", ns0, string(result.Content))
<add> }
<add> }
<add>
<ide> // with IPv6 enabled, the IPv6 nameserver should be preserved
<ide> ns0 = "nameserver 10.16.60.14\nnameserver 2002:dead:beef::1\nnameserver 10.16.60.21\n"
<ide> ns1 = "nameserver 10.16.60.14\nnameserver 2002:dead:beef::1\nnameserver 10.16.60.21\nnameserver ::1" | 2 |
Python | Python | fix docstrings in data_preprocessing.py. | f0e10716160cd048618ccdd4b6e18336223a172f | <ide><path>official/recommendation/data_preprocessing.py
<ide> def __init__(self, user_map, item_map, num_data_readers, cache_paths,
<ide> item_map: Dict mapping raw item ids to regularized ids.
<ide> num_data_readers: The number of reader Datasets used during training.
<ide> cache_paths: Object containing locations for various cache files.
<add> num_train_positives: The number of positive training examples in the
<add> dataset.
<ide> """
<ide>
<ide> self.user_map = {int(k): int(v) for k, v in user_map.items()}
<ide> def generate_train_eval_data(df, approx_num_shards, num_items, cache_paths):
<ide> num_items: The cardinality of the item set.
<ide> cache_paths: rconst.Paths object containing locations for various cache
<ide> files.
<del>
<del> Returns:
<del> A tuple containing the validation data.
<ide> """
<ide>
<ide> num_rows = len(df) | 1 |
Text | Text | replace github -> github (english) | 3e4bcf00b54640a9c9d7bfedd180ec217a924fd5 | <ide><path>guide/english/electron/index.md
<ide> Some apps built using Electron include:
<ide> * [Skype](https://www.skype.com/) (Microsoft's popular video chat application)
<ide> * [Slack](https://slack.com/) (A messaging app for teams)
<ide> * [Discord](https://discordapp.com) (A popular messaging app for gamers)
<del>* [Github Desktop](https://desktop.github.com/) (Official Github Desktop Client)
<add>* [GitHub Desktop](https://desktop.github.com/) (Official GitHub Desktop Client)
<ide> * [Whatsapp Deskstop](https://web.whatsapp.com/desktop/windows/release/x64/WhatsAppSetup.exe)(Whatsapp Client For Windows)
<ide> * [Twitch.tv](https://www.twitch.tv/)(A live Streaming Video Platform)
<ide> * [Wire](https://wire.com/)(An encrypted instant messaging client) | 1 |
Python | Python | avoid use of deepcopy in printer | 5916d46ba8a9c85f5f8c115bb831561e3c64d256 | <ide><path>spacy/tokens/printers.py
<ide> def parse_tree(doc, light=False, flat=False):
<ide> >>> trees = doc.print_tree()
<ide> [{'modifiers': [{'modifiers': [], 'NE': 'PERSON', 'word': 'Bob', 'arc': 'nsubj', 'POS_coarse': 'PROPN', 'POS_fine': 'NNP', 'lemma': 'Bob'}, {'modifiers': [], 'NE': 'PERSON', 'word': 'Alice', 'arc': 'dobj', 'POS_coarse': 'PROPN', 'POS_fine': 'NNP', 'lemma': 'Alice'}, {'modifiers': [{'modifiers': [], 'NE': '', 'word': 'the', 'arc': 'det', 'POS_coarse': 'DET', 'POS_fine': 'DT', 'lemma': 'the'}], 'NE': '', 'word': 'pizza', 'arc': 'dobj', 'POS_coarse': 'NOUN', 'POS_fine': 'NN', 'lemma': 'pizza'}, {'modifiers': [], 'NE': '', 'word': '.', 'arc': 'punct', 'POS_coarse': 'PUNCT', 'POS_fine': '.', 'lemma': '.'}], 'NE': '', 'word': 'brought', 'arc': 'ROOT', 'POS_coarse': 'VERB', 'POS_fine': 'VBD', 'lemma': 'bring'}, {'modifiers': [{'modifiers': [], 'NE': 'PERSON', 'word': 'Alice', 'arc': 'nsubj', 'POS_coarse': 'PROPN', 'POS_fine': 'NNP', 'lemma': 'Alice'}, {'modifiers': [{'modifiers': [], 'NE': '', 'word': 'the', 'arc': 'det', 'POS_coarse': 'DET', 'POS_fine': 'DT', 'lemma': 'the'}], 'NE': '', 'word': 'pizza', 'arc': 'dobj', 'POS_coarse': 'NOUN', 'POS_fine': 'NN', 'lemma': 'pizza'}, {'modifiers': [], 'NE': '', 'word': '.', 'arc': 'punct', 'POS_coarse': 'PUNCT', 'POS_fine': '.', 'lemma': '.'}], 'NE': '', 'word': 'ate', 'arc': 'ROOT', 'POS_coarse': 'VERB', 'POS_fine': 'VBD', 'lemma': 'eat'}]
<ide> """
<del> doc_clone = deepcopy(doc)
<add> doc_clone = Doc(doc.vocab, words=[w.text for w in doc])
<add> doc_clone.from_array(doc.to_array([HEAD, DEP, TAG, ENT_IOB, ENT_TYPE])
<ide> merge_ents(doc_clone) # merge the entities into single tokens first
<ide> return [POS_tree(sent.root, light=light, flat=flat) for sent in doc_clone.sents] | 1 |
PHP | PHP | fix indentation (tabs for now) | 3626b9b5bd8a47e6ae2000655ee29c3e690f453c | <ide><path>src/Illuminate/Foundation/Application.php
<ide> public function booted($callback)
<ide> /**
<ide> * {@inheritdoc}
<ide> */
<del> public function handle(SymfonyRequest $request, $type = self::MASTER_REQUEST, $catch = true)
<del> {
<del> return $this['Illuminate\Contracts\Http\Kernel']->handle(Request::createFromBase($request));
<del> }
<add> public function handle(SymfonyRequest $request, $type = self::MASTER_REQUEST, $catch = true)
<add> {
<add> return $this['Illuminate\Contracts\Http\Kernel']->handle(Request::createFromBase($request));
<add> }
<ide>
<ide> /**
<ide> * Determine if the application configuration is cached. | 1 |
Javascript | Javascript | fix false redirect alarm in router.didtransition | 9758b1e1635be19ccd577de9557f3016f69fe1f3 | <ide><path>packages/ember-routing/lib/system/route.js
<ide> Ember.Route = Ember.Object.extend({
<ide> @param {...Object} models the
<ide> */
<ide> transitionTo: function() {
<del> this.transitioned = true;
<add> if (this._checkingRedirect) { this.redirected = true; }
<ide> return this.router.transitionTo.apply(this.router, arguments);
<ide> },
<ide>
<ide> Ember.Route = Ember.Object.extend({
<ide> @param {...Object} models the
<ide> */
<ide> replaceWith: function() {
<del> this.transitioned = true;
<add> if (this._checkingRedirect) { this.redirected = true; }
<ide> return this.router.replaceWith.apply(this.router, arguments);
<ide> },
<ide>
<ide> Ember.Route = Ember.Object.extend({
<ide> @method setup
<ide> */
<ide> setup: function(context) {
<del> this.transitioned = false;
<add> this.redirected = false;
<add> this._checkingRedirect = true;
<add>
<ide> this.redirect(context);
<ide>
<del> if (this.transitioned) { return false; }
<add> this._checkingRedirect = false;
<add> if (this.redirected) { return false; }
<ide>
<ide> var controller = this.controllerFor(this.routeName, context);
<ide>
<ide><path>packages/ember-routing/lib/system/router.js
<ide> Ember.Router = Ember.Object.extend({
<ide> didTransition: function(infos) {
<ide> // Don't do any further action here if we redirected
<ide> for (var i=0, l=infos.length; i<l; i++) {
<del> if (infos[i].handler.transitioned) { return; }
<add> if (infos[i].handler.redirected) { return; }
<ide> }
<ide>
<ide> var appController = this.container.lookup('controller:application'),
<ide><path>packages/ember/tests/routing/basic_test.js
<ide> test("Redirecting from the middle of a route aborts the remainder of the routes"
<ide> equal(router.get('location').getURL(), "/home");
<ide> });
<ide>
<add>test("Transitioning from a parent event does not prevent currentPath from being set", function() {
<add> Router.map(function() {
<add> this.resource("foo", function() {
<add> this.resource("bar", function() {
<add> this.route("baz");
<add> });
<add> this.route("qux");
<add> });
<add> });
<add>
<add> App.FooRoute = Ember.Route.extend({
<add> events: {
<add> goToQux: function() {
<add> this.transitionTo('foo.qux');
<add> }
<add> }
<add> });
<add>
<add> bootApplication();
<add>
<add> var applicationController = router.container.lookup('controller:application');
<add>
<add> Ember.run(function() {
<add> router.handleURL("/foo/bar/baz");
<add> });
<add>
<add> equal(applicationController.get('currentPath'), 'foo.bar.baz');
<add>
<add> Ember.run(function() {
<add> router.send("goToQux");
<add> });
<add>
<add> equal(applicationController.get('currentPath'), 'foo.qux');
<add> equal(router.get('location').getURL(), "/foo/qux");
<add>});
<add>
<ide> test("Generated names can be customized when providing routes with dot notation", function() {
<ide> expect(3);
<ide> | 3 |
Ruby | Ruby | repair pub-date in livecheck | 6720f8bd1e0237a44bbc0f53769a9d232fb19d62 | <ide><path>Library/Homebrew/livecheck/strategy/sparkle.rb
<ide> def self.item_from_content(content)
<ide> version ||= (item > "version").first&.text&.strip
<ide>
<ide> title = (item > "title").first&.text&.strip
<del> pub_date = (item > "pubDate").first&.text&.strip&.yield_self { |d| Time.parse(d) }
<add> pub_date = (item > "pubDate").first&.text&.strip&.yield_self { |d| Time.parse(d) } || Time.new(0)
<ide>
<ide> if (match = title&.match(/(\d+(?:\.\d+)*)\s*(\([^)]+\))?\Z/))
<ide> short_version ||= match[1] | 1 |
Ruby | Ruby | push content_type assigment in to metal | cd8eb351fb514a0e7225cb548e5eec082a0b495e | <ide><path>actionpack/lib/abstract_controller/rendering.rb
<ide> def render(*args, &block)
<ide> options = _normalize_render(*args, &block)
<ide> self.response_body = render_to_body(options)
<ide> if options[:html]
<del> _set_content_type Mime::HTML.to_s
<add> _set_html_content_type
<ide> else
<del> _set_content_type _get_content_type(rendered_format)
<add> _set_rendered_content_type rendered_format
<ide> end
<ide> self.response_body
<ide> end
<ide> def _process_options(options)
<ide> def _process_format(format)
<ide> end
<ide>
<del> def _get_content_type(rendered_format) # :nodoc:
<add> def _set_html_content_type # :nodoc:
<ide> end
<ide>
<del> def _set_content_type(type) # :nodoc:
<add> def _set_rendered_content_type(format) # :nodoc:
<ide> end
<ide>
<ide> # Normalize args and options.
<ide><path>actionpack/lib/action_controller/metal/mime_responds.rb
<ide> def respond_to(*mimes)
<ide>
<ide> if format = collector.negotiate_format(request)
<ide> _process_format(format)
<del> _set_content_type _get_content_type format
<add> _set_rendered_content_type format
<ide> response = collector.response
<ide> response ? response.call : render({})
<ide> else
<ide><path>actionpack/lib/action_controller/metal/rendering.rb
<ide> def _render_in_priorities(options)
<ide> nil
<ide> end
<ide>
<del> def _get_content_type(rendered_format)
<del> self.content_type || rendered_format.to_s
<add> def _set_html_content_type
<add> self.content_type = Mime::HTML.to_s
<ide> end
<ide>
<del> def _set_content_type(format)
<del> self.content_type = format
<add> def _set_rendered_content_type(format)
<add> unless response.content_type
<add> self.content_type = format.to_s
<add> end
<ide> end
<ide>
<ide> # Normalize arguments by catching blocks and setting them on :update. | 3 |
Ruby | Ruby | use env helper | 32b7e32856e61f256f2703faa17cdbcee26e17b7 | <ide><path>Library/Homebrew/formula.rb
<ide> def run_post_install
<ide> build = self.build
<ide> self.build = Tab.for_formula(self)
<ide>
<del> old_tmpdir = ENV["TMPDIR"]
<del> old_temp = ENV["TEMP"]
<del> old_tmp = ENV["TMP"]
<del> old_path = ENV["HOMEBREW_PATH"]
<del>
<del> ENV["TMPDIR"] = ENV["TEMP"] = ENV["TMP"] = HOMEBREW_TEMP
<del> ENV["HOMEBREW_PATH"] = nil
<add> new_env = {
<add> "TMPDIR" => HOMEBREW_TEMP,
<add> "TEMP" => HOMEBREW_TEMP,
<add> "TMP" => HOMEBREW_TEMP,
<add> "HOMEBREW_PATH" => nil,
<add> }
<ide>
<del> ENV.clear_sensitive_environment!
<add> with_env(new_env) do
<add> ENV.clear_sensitive_environment!
<ide>
<del> Pathname.glob("#{bottle_prefix}/{etc,var}/**/*") do |path|
<del> path.extend(InstallRenamed)
<del> path.cp_path_sub(bottle_prefix, HOMEBREW_PREFIX)
<del> end
<add> Pathname.glob("#{bottle_prefix}/{etc,var}/**/*") do |path|
<add> path.extend(InstallRenamed)
<add> path.cp_path_sub(bottle_prefix, HOMEBREW_PREFIX)
<add> end
<ide>
<del> with_logging("post_install") do
<del> post_install
<add> with_logging("post_install") do
<add> post_install
<add> end
<ide> end
<ide> ensure
<ide> self.build = build
<del> ENV["TMPDIR"] = old_tmpdir
<del> ENV["TEMP"] = old_temp
<del> ENV["TMP"] = old_tmp
<del> ENV["HOMEBREW_PATH"] = old_path
<ide> @prefix_returns_versioned_prefix = false
<ide> end
<ide> | 1 |
Javascript | Javascript | remove warning for pre-build files | 84506cb60928792c6b3d3f337a3877da9f94b61d | <ide><path>lib/CompatibilityPlugin.js
<ide> CompatibilityPlugin.prototype.apply = function(compiler) {
<ide> if(last.critical && last.request === "." && last.userRequest === "." && last.recursive)
<ide> this.state.current.dependencies.pop();
<ide> }
<del> dep.critical = "This seems to be a pre-built javascript file. Though this is possible, it's not recommended. Try to require the original source to get better results.";
<ide> this.state.current.addDependency(dep);
<ide> return true;
<ide> }); | 1 |
Javascript | Javascript | use firefox 47 | 1d4216a8bcd32428f826ab544c3da88b87a2ca7b | <ide><path>docs/protractor-conf.js
<ide> config.specs = [
<ide> 'app/e2e/**/*.scenario.js'
<ide> ];
<ide>
<del>config.capabilities = {
<del> browserName: 'chrome',
<del>};
<add>config.capabilities.browserName = 'chrome';
<ide>
<ide> exports.config = config;
<ide><path>protractor-conf.js
<ide> config.specs = [
<ide> 'docs/app/e2e/**/*.scenario.js'
<ide> ];
<ide>
<del>config.capabilities = {
<del> browserName: 'chrome'
<del>};
<add>config.capabilities.browserName = 'chrome';
<ide>
<ide> config.directConnect = true;
<ide>
<ide><path>protractor-shared-conf.js
<ide> exports.config = {
<ide>
<ide> framework: 'jasmine2',
<ide>
<add> capabilities: {
<add> // Fix element scrolling behavior in Firefox for fixed header elements (like angularjs.org has)
<add> 'elementScrollBehavior': 1
<add> },
<add>
<ide> onPrepare: function() {
<ide> /* global angular: false, browser: false, jasmine: false */
<ide>
<ide><path>protractor-travis-conf.js
<ide> if (process.env.BROWSER_PROVIDER === 'browserstack') {
<ide> }),
<ide> capabilitiesForBrowserStack({
<ide> browserName: 'firefox',
<del> version: '28'
<add> version: '47'
<ide> }),
<ide> capabilitiesForBrowserStack({
<ide> browserName: 'safari',
<ide> if (process.env.BROWSER_PROVIDER === 'browserstack') {
<ide> }),
<ide> capabilitiesForSauceLabs({
<ide> browserName: 'firefox',
<del> version: '28'
<add> version: '47'
<ide> }),
<ide> capabilitiesForSauceLabs({
<ide> browserName: 'safari',
<ide> function capabilitiesForBrowserStack(capabilities) {
<ide> return {
<ide> 'browserstack.user': process.env.BROWSER_STACK_USERNAME,
<ide> 'browserstack.key': process.env.BROWSER_STACK_ACCESS_KEY,
<del> 'browserstack.local' : 'true',
<add> 'browserstack.local': 'true',
<ide> 'browserstack.debug': 'true',
<ide> 'browserstack.tunnelIdentifier': process.env.TRAVIS_JOB_NUMBER,
<ide> 'tunnelIdentifier': process.env.TRAVIS_JOB_NUMBER,
<ide> function capabilitiesForBrowserStack(capabilities) {
<ide>
<ide> 'browserName': capabilities.browserName,
<ide> 'platform': capabilities.platform,
<del> 'version': capabilities.version
<add> 'version': capabilities.version,
<add> 'elementScrollBehavior': 1
<ide> };
<ide> }
<ide>
<ide> function capabilitiesForSauceLabs(capabilities) {
<ide>
<ide> 'browserName': capabilities.browserName,
<ide> 'platform': capabilities.platform,
<del> 'version': capabilities.version
<add> 'version': capabilities.version,
<add> 'elementScrollBehavior': 1
<ide> };
<ide> } | 4 |
PHP | PHP | fix codestyle errors | adb78e6c3992279bb0dcede982f7ba86db765a25 | <ide><path>lib/Cake/Database/Schema/MysqlSchema.php
<ide> protected function _foreignOnClause($on) {
<ide> }
<ide> }
<ide>
<del>
<ide> }
<ide><path>lib/Cake/Database/Schema/Table.php
<ide> public function addConstraint($name, $attrs) {
<ide> *
<ide> * @param array $attrs Attributes to set.
<ide> * @return array
<del> * @throw Cake\Database\Exception When foreign key definition is not valid.
<add> * @throws Cake\Database\Exception When foreign key definition is not valid.
<ide> */
<ide> protected function _checkForeignKey($attrs) {
<ide> if (count($attrs['references']) < 2) {
<ide><path>lib/Cake/Database/Statement/BufferedStatement.php
<ide> public function rewind() {
<ide> $this->_counter = 0;
<ide> }
<ide>
<del> public function _reset() {
<add> protected function _reset() {
<ide> $this->_count = $this->_counter = 0;
<ide> $this->_records = [];
<ide> $this->_allFetched = false;
<ide><path>lib/Cake/ORM/Association.php
<ide> public function joinType($type = null) {
<ide> * @param string $name
<ide> * @return string
<ide> */
<del> function property($name = null) {
<add> public function property($name = null) {
<ide> if ($name !== null) {
<ide> $this->_property = $name;
<ide> }
<ide> function property($name = null) {
<ide> *
<ide> * @param string $name
<ide> * @return string
<add> * @throws \InvalidArgumentException When an invalid strategy is provided.
<ide> */
<del> function strategy($name = null) {
<add> public function strategy($name = null) {
<ide> if ($name !== null) {
<ide> $valid = [self::STRATEGY_JOIN, self::STRATEGY_SELECT, self::STRATEGY_SUBQUERY];
<ide> if (!in_array($name, $valid)) {
<ide> function strategy($name = null) {
<ide> * @param array $options List of options used for initialization
<ide> * @return void
<ide> */
<del> protected function _options(array $options) {
<add> protected function _options(array $options) {
<ide> }
<ide>
<ide> /**
<ide><path>lib/Cake/ORM/Association/ExternalAssociationTrait.php
<ide> public function canBeJoined($options = []) {
<ide> public function foreignKey($key = null) {
<ide> if ($key === null) {
<ide> if ($this->_foreignKey === null) {
<del> $this->_foreignKey = Inflector::underscore($this->source()->alias()) . '_id';
<add> $this->_foreignKey = Inflector::underscore($this->source()->alias()) . '_id';
<ide> }
<ide> return $this->_foreignKey;
<ide> }
<ide> protected function _resultInjector($fetchQuery, $resultMap) {
<ide> ));
<ide>
<ide> $alias = $this->target()->alias();
<del> $nestKey = $alias . '__' . $alias;
<add> $nestKey = $alias . '__' . $alias;
<ide> return function($row) use ($resultMap, $sourceKey, $nestKey) {
<ide> if (isset($resultMap[$row[$sourceKey]])) {
<ide> $row[$nestKey] = $resultMap[$row[$sourceKey]];
<ide> protected function _resultInjector($fetchQuery, $resultMap) {
<ide> *
<ide> * @param array $options options accepted by eagerLoader()
<ide> * @return Cake\ORM\Query
<add> * @throws \InvalidArgumentException When a key is required for associations but not selected.
<ide> */
<ide> protected function _buildQuery($options) {
<ide> $target = $this->target();
<ide><path>lib/Cake/ORM/Association/HasOne.php
<ide> class HasOne extends Association {
<ide> public function foreignKey($key = null) {
<ide> if ($key === null) {
<ide> if ($this->_foreignKey === null) {
<del> $this->_foreignKey = Inflector::underscore($this->source()->alias()) . '_id';
<add> $this->_foreignKey = Inflector::underscore($this->source()->alias()) . '_id';
<ide> }
<ide> return $this->_foreignKey;
<ide> }
<ide><path>lib/Cake/ORM/Query.php
<ide> protected function _addContainments() {
<ide> * @param string $alias name of the association to be loaded
<ide> * @param array $options list of extra options to use for this association
<ide> * @return array normalized associations
<add> * @throws \InvalidArgumentException When containments refer to associations that do not exist.
<ide> */
<ide> protected function _normalizeContain(Table $parent, $alias, $options) {
<ide> $defaults = $this->_containOptions;
<ide><path>lib/Cake/ORM/ResultSet.php
<ide> */
<ide> namespace Cake\ORM;
<ide>
<del>use \Iterator;
<ide> use Cake\Database\Type;
<add>use \Iterator;
<ide>
<ide> /**
<ide> * Represents the results obtained after executing a query for an specific table
<ide> public function valid() {
<ide> return $this->_current !== false;
<ide> }
<ide>
<del>
<ide> /**
<ide> * Calculates the list of associations that should get eager loaded
<ide> * when fetching each record
<ide> *
<ide> * @return void
<ide> */
<del> public function _calculateAssociationMap() {
<add> protected function _calculateAssociationMap() {
<ide> $contain = $this->_query->normalizedContainments();
<ide>
<ide> if (!$contain) {
<ide> protected function _castValues($table, $values) {
<ide> if (empty($this->types[$alias])) {
<ide> $schema = $table->schema();
<ide> foreach ($schema->columns() as $col) {
<del> $this->types[$alias][$col] = Type::build($schema->columnType($col));
<add> $this->types[$alias][$col] = Type::build($schema->columnType($col));
<ide> }
<ide> }
<ide>
<ide><path>lib/Cake/ORM/Table.php
<ide> public function belongsToMany($associated, array $options = []) {
<ide> * @return \Cake\ORM\Query
<ide> */
<ide> public function find($type, $options = []) {
<del> return $this->{'find' . ucfirst($type)}($this->buildQuery(), $options);
<add> return $this->{'find' . ucfirst($type)}($this->_buildQuery(), $options);
<ide> }
<ide>
<ide> /**
<ide> public function findAll(Query $query, array $options = []) {
<ide> *
<ide> * @return \Cake\ORM\Query
<ide> */
<del> protected function buildQuery() {
<add> protected function _buildQuery() {
<ide> $query = new Query($this->connection());
<ide> return $query
<ide> ->repository($this)
<ide><path>lib/Cake/Test/TestCase/ORM/Association/BelongsToManyTest.php
<ide> namespace Cake\Test\TestCase\ORM\Association;
<ide>
<ide> use Cake\ORM\Association\BelongsToMany;
<del>use Cake\ORM\Table;
<ide> use Cake\ORM\Query;
<add>use Cake\ORM\Table;
<ide>
<ide> /**
<ide> * Tests BelongsToMany class
<ide><path>lib/Cake/Test/TestCase/ORM/Association/BelongsToTest.php
<ide> namespace Cake\Test\TestCase\ORM\Association;
<ide>
<ide> use Cake\ORM\Association\BelongsTo;
<del>use Cake\ORM\Table;
<ide> use Cake\ORM\Query;
<add>use Cake\ORM\Table;
<ide>
<ide> /**
<ide> * Tests BelongsTo class
<ide><path>lib/Cake/Test/TestCase/ORM/Association/HasManyTest.php
<ide> namespace Cake\Test\TestCase\ORM\Association;
<ide>
<ide> use Cake\ORM\Association\HasMany;
<del>use Cake\ORM\Table;
<ide> use Cake\ORM\Query;
<add>use Cake\ORM\Table;
<ide>
<ide> /**
<ide> * Tests HasMany class
<ide><path>lib/Cake/Test/TestCase/ORM/Association/HasOneTest.php
<ide> namespace Cake\Test\TestCase\ORM\Association;
<ide>
<ide> use Cake\ORM\Association\HasOne;
<del>use Cake\ORM\Table;
<ide> use Cake\ORM\Query;
<add>use Cake\ORM\Table;
<ide>
<ide> /**
<ide> * Tests HasOne class
<ide><path>lib/Cake/Test/TestCase/ORM/QueryTest.php
<ide> public function testContainToJoinsOneLevel() {
<ide> ]])
<ide> ->will($this->returnValue($query));
<ide>
<del>
<ide> $query->expects($this->at(4))->method('join')
<ide> ->with(['stuffType' => [
<ide> 'table' => 'stuff_types', | 14 |
Javascript | Javascript | add an annon unsubscribe route | a5ea7ad87928079c89c7e4a87a1d3eb819e87091 | <ide><path>server/boot/randomAPIs.js
<ide> import request from 'request';
<add>import { isMongoId } from 'validator';
<add>import dedent from 'dedent';
<add>
<ide> import constantStrings from '../utils/constantStrings.json';
<ide> import testimonials from '../resources/testimonials.json';
<add>import { wrapHandledError } from '../utils/create-handled-error';
<ide>
<ide> const githubClient = process.env.GITHUB_ID;
<ide> const githubSecret = process.env.GITHUB_SECRET;
<ide> module.exports = function(app) {
<ide> router.get('/twitch', twitch);
<ide> router.get('/u/:email', unsubscribe);
<ide> router.get('/unsubscribe/:email', unsubscribe);
<del> router.get('/submit-cat-photo', submitCatPhoto);
<add> router.get('/z', unsubscribeAnon);
<ide> router.get(
<ide> '/the-fastest-web-page-on-the-internet',
<ide> theFastestWebPageOnTheInternet
<ide> module.exports = function(app) {
<ide> });
<ide> }
<ide>
<del> function submitCatPhoto(req, res) {
<del> res.send('Submitted!');
<del> }
<del>
<ide> function bootcampCalculator(req, res) {
<ide> res.render('resources/calculator', {
<ide> title: 'Coding Bootcamp Cost Calculator'
<ide> module.exports = function(app) {
<ide> res.redirect('https://twitch.tv/freecodecamp');
<ide> }
<ide>
<add> function unsubscribeAnon(req, res, next) {
<add> const { query: { unsubscribeId } } = req;
<add> const isValid = unsubscribeId && isMongoId(unsubscribeId);
<add> if (!isValid) {
<add> throw wrapHandledError(
<add> new Error('unsubscribeId is not a mongo ObjectId'),
<add> {
<add> message: dedent`
<add> Oops... something is not right. We could not unsubscribe that email
<add> address
<add> `,
<add> type: 'danger',
<add> redirectTo: '/'
<add> }
<add> );
<add> }
<add> User.findOne({
<add> where: { unsubscribeId }
<add> }, (err, user) => {
<add> if (err) { return next(err); }
<add> if (!user || !user.email) {
<add> throw wrapHandledError(
<add> new Error('No user or user email to unsubscribe'),
<add> {
<add> message: dedent`
<add> We couldn't find a user account to unsubscribe, are you clicking
<add> a link from an email we sent?
<add> `,
<add> type: 'info',
<add> redirectTo: '/'
<add> }
<add> );
<add> }
<add> return user.update$({
<add> sendQuincyEmail: false
<add> }).subscribe(() => {
<add> req.flash(
<add> 'info',
<add> 'We\'ve successfully updated your Email preferences.'
<add> );
<add> return res.redirect('/unsubscribed');
<add> },
<add> next,
<add> () => {
<add> return user.manualReload();
<add> }
<add> );
<add> });
<add> }
<add>
<ide> function unsubscribe(req, res, next) {
<ide> req.checkParams(
<ide> 'email',
<ide> module.exports = function(app) {
<ide> req.flash('info', {
<ide> msg: 'We\'ve successfully updated your Email preferences.'
<ide> });
<del> return res.redirect('/unsubscribed/' + req.params.email);
<add> return res.redirect('/unsubscribed');
<ide> })
<ide> .catch(next);
<ide> }); | 1 |
PHP | PHP | add back test file lost during merge | bdda6bec42904b9ce4ff1829feeec90995143071 | <ide><path>tests/TestCase/Console/CommandCollectionTest.php
<ide> public function testAutoDiscoverApp()
<ide>
<ide> $this->assertTrue($collection->has('app'));
<ide> $this->assertTrue($collection->has('demo'));
<add> $this->assertTrue($collection->has('i18m'));
<ide> $this->assertTrue($collection->has('sample'));
<ide> $this->assertTrue($collection->has('testing_dispatch'));
<ide>
<ide> $this->assertSame('TestApp\Shell\AppShell', $collection->get('app'));
<ide> $this->assertSame('TestApp\Command\DemoCommand', $collection->get('demo'));
<add> $this->assertSame('TestApp\Shell\I18mShell', $collection->get('i18m'));
<ide> $this->assertSame('TestApp\Shell\SampleShell', $collection->get('sample'));
<ide> }
<ide>
<ide><path>tests/TestCase/Shell/CompletionShellTest.php
<ide> public function testCommands()
<ide>
<ide> $expected = 'TestPlugin.example TestPlugin.sample TestPluginTwo.example unique welcome ' .
<ide> 'cache help i18n plugin routes schema_cache server upgrade version ' .
<del> "abort auto_load_model demo integration merge sample shell_test testing_dispatch";
<add> "abort auto_load_model demo i18m integration merge sample shell_test testing_dispatch";
<ide> $this->assertTextEquals($expected, $output);
<ide> }
<ide>
<ide><path>tests/test_app/TestApp/Shell/I18mShell.php
<add><?php
<add>declare(strict_types=1);
<add>/**
<add> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<add> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<add> *
<add> * Licensed under The MIT License
<add> * For full copyright and license information, please see the LICENSE.txt
<add> * Redistributions of files must retain the above copyright notice
<add> *
<add> * @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<add> * @link https://cakephp.org CakePHP(tm) Project
<add> * @since 3.0.8
<add> * @license https://opensource.org/licenses/mit-license.php MIT License
<add> */
<add>
<add>/**
<add> * I18mShell
<add> */
<add>namespace TestApp\Shell;
<add>
<add>use Cake\Console\Shell;
<add>
<add>class I18mShell extends Shell
<add>{
<add> /**
<add> * main method
<add> *
<add> * @return void
<add> */
<add> public function main()
<add> {
<add> $this->out('This is the main method called from I18mShell');
<add> }
<add>} | 3 |
Javascript | Javascript | fix reactrenderdocument tests | fea4fec0bc3cd72b57cc65e75ef6ba2131cdedcb | <ide><path>src/core/__tests__/ReactRenderDocument-test.js
<ide> describe('rendering React components at document', function() {
<ide> testDocument = getTestDocument();
<ide> });
<ide>
<del> if (!testDocument) {
<del> // These tests are not applicable in jst, since jsdom is buggy.
<del> return;
<del> }
<del>
<ide> it('should be able to switch root constructors via state', function() {
<add> if (!testDocument) {
<add> // These tests are not applicable in jst, since jsdom is buggy.
<add> return;
<add> }
<add>
<ide> var Component = React.createClass({
<ide> render: function() {
<ide> return (
<ide> describe('rendering React components at document', function() {
<ide> });
<ide>
<ide> it('should be able to switch root constructors', function() {
<add> if (!testDocument) {
<add> // These tests are not applicable in jst, since jsdom is buggy.
<add> return;
<add> }
<add>
<ide> var Component = React.createClass({
<ide> render: function() {
<ide> return (
<ide> describe('rendering React components at document', function() {
<ide> });
<ide>
<ide> it('should be able to mount into document', function() {
<add> if (!testDocument) {
<add> // These tests are not applicable in jst, since jsdom is buggy.
<add> return;
<add> }
<add>
<ide> var Component = React.createClass({
<ide> render: function() {
<ide> return (
<ide> describe('rendering React components at document', function() {
<ide> });
<ide>
<ide> it('should throw on full document render', function() {
<add> if (!testDocument) {
<add> // These tests are not applicable in jst, since jsdom is buggy.
<add> return;
<add> }
<add>
<ide> var container = testDocument;
<ide> expect(function() {
<ide> React.renderComponent(<html />, container);
<ide> describe('rendering React components at document', function() {
<ide> });
<ide>
<ide> it('should throw on full document render of non-html', function() {
<add> if (!testDocument) {
<add> // These tests are not applicable in jst, since jsdom is buggy.
<add> return;
<add> }
<add>
<ide> var container = testDocument;
<ide> ReactMount.allowFullPageRender = true;
<ide> expect(function() { | 1 |
Javascript | Javascript | create internal connresetexception | aa8b820aaa4d36085baaf8beb1187b2b9955fffb | <ide><path>lib/_http_client.js
<ide> const { Buffer } = require('buffer');
<ide> const { defaultTriggerAsyncIdScope } = require('internal/async_hooks');
<ide> const { URL, urlToOptions, searchParamsSymbol } = require('internal/url');
<ide> const { outHeadersKey, ondrain } = require('internal/http');
<add>const { connResetException, codes } = require('internal/errors');
<ide> const {
<ide> ERR_HTTP_HEADERS_SENT,
<ide> ERR_INVALID_ARG_TYPE,
<ide> ERR_INVALID_HTTP_TOKEN,
<ide> ERR_INVALID_PROTOCOL,
<ide> ERR_UNESCAPED_CHARACTERS
<del>} = require('internal/errors').codes;
<add>} = codes;
<ide> const { getTimerDuration } = require('internal/timers');
<ide> const {
<ide> DTRACE_HTTP_CLIENT_REQUEST,
<ide> function emitAbortNT() {
<ide> this.emit('abort');
<ide> }
<ide>
<del>
<del>function createHangUpError() {
<del> // eslint-disable-next-line no-restricted-syntax
<del> const error = new Error('socket hang up');
<del> error.code = 'ECONNRESET';
<del> return error;
<del>}
<del>
<del>
<ide> function socketCloseListener() {
<ide> const socket = this;
<ide> const req = socket._httpMessage;
<ide> function socketCloseListener() {
<ide> // receive a response. The error needs to
<ide> // fire on the request.
<ide> req.socket._hadError = true;
<del> req.emit('error', createHangUpError());
<add> req.emit('error', connResetException('socket hang up'));
<ide> }
<ide> req.emit('close');
<ide> }
<ide> function socketOnEnd() {
<ide> // If we don't have a response then we know that the socket
<ide> // ended prematurely and we need to emit an error on the request.
<ide> req.socket._hadError = true;
<del> req.emit('error', createHangUpError());
<add> req.emit('error', connResetException('socket hang up'));
<ide> }
<ide> if (parser) {
<ide> parser.finish();
<ide><path>lib/_tls_wrap.js
<ide> const tls_wrap = internalBinding('tls_wrap');
<ide> const { Pipe, constants: PipeConstants } = internalBinding('pipe_wrap');
<ide> const { owner_symbol } = require('internal/async_hooks').symbols;
<ide> const { SecureContext: NativeSecureContext } = internalBinding('crypto');
<add>const { connResetException, codes } = require('internal/errors');
<ide> const {
<ide> ERR_INVALID_ARG_TYPE,
<ide> ERR_INVALID_CALLBACK,
<ide> const {
<ide> ERR_TLS_REQUIRED_SERVER_NAME,
<ide> ERR_TLS_SESSION_ATTACK,
<ide> ERR_TLS_SNI_FROM_SERVER
<del>} = require('internal/errors').codes;
<add>} = codes;
<ide> const { getOptionValue } = require('internal/options');
<ide> const { validateString } = require('internal/validators');
<ide> const traceTls = getOptionValue('--trace-tls');
<ide> const proxiedMethods = [
<ide> 'setSimultaneousAccepts', 'setBlocking',
<ide>
<ide> // PipeWrap
<del> 'setPendingInstances'
<add> 'setPendingInstances',
<ide> ];
<ide>
<ide> // Proxy HandleWrap, PipeWrap and TCPWrap methods
<ide> function onSocketClose(err) {
<ide> // Emit ECONNRESET
<ide> if (!this._controlReleased && !this[kErrorEmitted]) {
<ide> this[kErrorEmitted] = true;
<del> // eslint-disable-next-line no-restricted-syntax
<del> const connReset = new Error('socket hang up');
<del> connReset.code = 'ECONNRESET';
<add> const connReset = connResetException('socket hang up');
<ide> this._tlsOptions.server.emit('tlsClientError', connReset, this);
<ide> }
<ide> }
<ide> function onConnectEnd() {
<ide> if (!this._hadError) {
<ide> const options = this[kConnectOptions];
<ide> this._hadError = true;
<del> // eslint-disable-next-line no-restricted-syntax
<del> const error = new Error('Client network socket disconnected before ' +
<del> 'secure TLS connection was established');
<del> error.code = 'ECONNRESET';
<add> const error = connResetException('Client network socket disconnected ' +
<add> 'before secure TLS connection was ' +
<add> 'established');
<ide> error.path = options.path;
<ide> error.host = options.host;
<ide> error.port = options.port;
<ide><path>lib/internal/errors.js
<ide> function dnsException(code, syscall, hostname) {
<ide> return ex;
<ide> }
<ide>
<add>function connResetException(msg) {
<add> // eslint-disable-next-line no-restricted-syntax
<add> const ex = new Error(msg);
<add> ex.code = 'ECONNRESET';
<add> return ex;
<add>}
<add>
<ide> let maxStack_ErrorName;
<ide> let maxStack_ErrorMessage;
<ide> /**
<ide> module.exports = {
<ide> getMessage,
<ide> hideStackFrames,
<ide> isStackOverflowError,
<add> connResetException,
<ide> uvException,
<ide> uvExceptionWithHostPort,
<ide> SystemError, | 3 |
Python | Python | use np.ndindex, which seems just as efficient | 5307aeda11a5d567a966a16232860fd852734606 | <ide><path>numpy/lib/shape_base.py
<ide> )
<ide> from numpy.core.fromnumeric import product, reshape, transpose
<ide> from numpy.core import vstack, atleast_3d
<add>from numpy.lib.index_tricks import ndindex
<ide>
<ide>
<ide> __all__ = [
<ide> def apply_along_axis(func1d, axis, arr, *args, **kwargs):
<ide> dims_in = list(range(nd))
<ide> inarr_view = transpose(arr, dims_in[:axis] + dims_in[axis+1:] + [axis])
<ide>
<del> # number of iterations
<del> Ntot = product(inarr_view.shape[:nd-1])
<del>
<del> # current index
<del> ind = [0]*(nd - 1)
<add> # indices
<add> inds = ndindex(inarr_view.shape[:nd-1])
<ide>
<ide> # invoke the function on the first item
<del> res = func1d(inarr_view[tuple(ind)], *args, **kwargs)
<add> ind0 = next(inds)
<add> res = func1d(inarr_view[ind0], *args, **kwargs)
<ide> res = asanyarray(res)
<ide>
<ide> # insert as many axes as necessary to create the output
<ide> def apply_along_axis(func1d, axis, arr, *args, **kwargs):
<ide> outarr_view = transpose(outarr, dims_out[:axis] + dims_out[axis+res.ndim:] + dims_out[axis:axis+res.ndim])
<ide>
<ide> # save the first result
<del> outarr_view[tuple(ind)] = res
<del> k = 1
<del> while k < Ntot:
<del> # increment the index
<del> ind[-1] += 1
<del> n = -1
<del> while (ind[n] >= outshape[n]) and (n > (1-nd)):
<del> ind[n-1] += 1
<del> ind[n] = 0
<del> n -= 1
<del> outarr_view[tuple(ind)] = asanyarray(func1d(inarr_view[tuple(ind)], *args, **kwargs))
<del> k += 1
<add> outarr_view[ind0] = res
<add> for ind in inds:
<add> outarr_view[ind] = asanyarray(func1d(inarr_view[ind], *args, **kwargs))
<ide> return outarr
<ide>
<ide> | 1 |
Ruby | Ruby | print the linked_version [linux] | 06b9f1c50d62b8f60cf80e407492a3b202e67096 | <ide><path>Library/Homebrew/extend/os/linux/system_config.rb
<ide> def host_gcc_version
<ide> `#{gcc} --version 2>/dev/null`[/ (\d+\.\d+\.\d+)/, 1]
<ide> end
<ide>
<del> def formula_version(formula)
<add> def formula_linked_version(formula)
<ide> return "N/A" unless CoreTap.instance.installed?
<del> f = Formulary.factory formula
<del> return "N/A" unless f.installed?
<del> f.version
<add> Formulary.factory(formula).linked_version || "N/A"
<ide> rescue FormulaUnavailableError
<ide> return "N/A"
<ide> end
<ide> def dump_verbose_config(out = $stdout)
<ide> out.puts "OS: #{host_os_version}"
<ide> out.puts "/usr/bin/gcc: #{host_gcc_version}"
<ide> ["glibc", "gcc", "xorg"].each do |f|
<del> out.puts "#{f}: #{formula_version f}"
<add> out.puts "#{f}: #{formula_linked_version f}"
<ide> end
<ide> end
<ide> end | 1 |
Text | Text | fix import statement in docs | bdef29ebb10b2d8d7f2689ee5038433a01f8b8a2 | <ide><path>docs/docs/getting-started/integration.md
<ide> var myChart = new Chart(ctx, {...});
<ide> Chart.js 3 is tree-shakeable, so it is necessary to import and register the controllers, elements, scales and plugins you are going to use.
<ide>
<ide> ```javascript
<del>import Chart, LineController, Line, Point, LinearScale, CategoryScale, Title, Tooltip, Filler, Legend from 'chart.js';
<add>import { Chart, LineController, Line, Point, LinearScale, CategoryScale, Title, Tooltip, Filler, Legend } from 'chart.js';
<ide>
<ide> Chart.register(LineController, Line, Point, LinearScale, CategoryScale, Title, Tooltip, Filler, Legend);
<ide>
<ide><path>docs/docs/getting-started/v3-migration.md
<ide> Chart.js 3.0 introduces a number of breaking changes. Chart.js 2.0 was released
<ide> * Chart.js 3 is tree-shakeable. So if you are using it as an `npm` module in a project, you need to import and register the controllers, elements, scales and plugins you want to use. You will not have to call `register` if importing Chart.js via a `script` tag, but will not get the tree shaking benefits in this case. Here is an example of registering components:
<ide>
<ide> ```javascript
<del>import Chart, LineController, Line, Point, LinearScale, Title from `chart.js`
<add>import { Chart, LineController, Line, Point, LinearScale, Title } from `chart.js`
<ide>
<ide> Chart.register(LineController, Line, Point, LinearScale, Title);
<ide> | 2 |
PHP | PHP | reset select bindings when setting select | 70d7ba1175b6e54eb2abe82cea8f1e04fd7c4d69 | <ide><path>src/Illuminate/Database/Query/Builder.php
<ide> public function __construct(ConnectionInterface $connection,
<ide> public function select($columns = ['*'])
<ide> {
<ide> $this->columns = [];
<add> $this->bindings['select'] = [];
<ide>
<ide> $columns = is_array($columns) ? $columns : func_get_args();
<ide>
<ide><path>tests/Database/DatabaseQueryBuilderTest.php
<ide> public function testSubSelect()
<ide> $builder->selectSub(['foo'], 'sub');
<ide> }
<ide>
<add> public function testSubSelectResetBindings()
<add> {
<add> $builder = $this->getPostgresBuilder();
<add> $builder->from('one')->selectSub(function ($query) {
<add> $query->from('two')->select('baz')->where('subkey', '=', 'subval');
<add> }, 'sub');
<add>
<add> $this->assertEquals('select (select "baz" from "two" where "subkey" = ?) as "sub" from "one"', $builder->toSql());
<add> $this->assertEquals(['subval'], $builder->getBindings());
<add>
<add> $builder->select('*');
<add>
<add> $this->assertEquals('select * from "one"', $builder->toSql());
<add> $this->assertEquals([], $builder->getBindings());
<add> }
<add>
<ide> public function testSqlServerWhereDate()
<ide> {
<ide> $builder = $this->getSqlServerBuilder(); | 2 |
Javascript | Javascript | change assert.equal to assert.strictequal | 558fa1cf1006aa149ca8a0f42aaff0036c9fb33c | <ide><path>test/parallel/test-cluster-send-handle-twice.js
<ide> if (cluster.isMaster) {
<ide> for (var i = 0; i < workers.toStart; ++i) {
<ide> var worker = cluster.fork();
<ide> worker.on('exit', function(code, signal) {
<del> assert.equal(code, 0, 'Worker exited with an error code');
<add> assert.strictEqual(code, 0, 'Worker exited with an error code');
<ide> assert(!signal, 'Worker exited by a signal');
<ide> });
<ide> } | 1 |
Ruby | Ruby | support un m.49 region codes | 479544665b9e6edf66c7add1eb6b3c98d98de384 | <ide><path>Library/Homebrew/locale.rb
<ide> class Locale
<ide> class ParserError < StandardError
<ide> end
<ide>
<del> LANGUAGE_REGEX = /(?:[a-z]{2,3})/ # ISO 639-1 or ISO 639-2
<del> REGION_REGEX = /(?:[A-Z]{2})/ # ISO 3166-1
<del> SCRIPT_REGEX = /(?:[A-Z][a-z]{3})/ # ISO 15924
<add> LANGUAGE_REGEX = /(?:[a-z]{2,3})/ # ISO 639-1 or ISO 639-2
<add> REGION_REGEX = /(?:[A-Z]{2}|\d{3})/ # ISO 3166-1 or UN M.49
<add> SCRIPT_REGEX = /(?:[A-Z][a-z]{3})/ # ISO 15924
<ide>
<ide> LOCALE_REGEX = /\A((?:#{LANGUAGE_REGEX}|#{REGION_REGEX}|#{SCRIPT_REGEX})(?:\-|$)){1,3}\Z/
<ide>
<ide><path>Library/Homebrew/test/locale_spec.rb
<ide> expect(described_class.parse("zh-CN-Hans")).to eql(described_class.new("zh", "CN", "Hans"))
<ide> end
<ide>
<add> it "correctly parses a string with a UN M.49 region code" do
<add> expect(described_class.parse("es-419")).to eql(described_class.new("es", "419", nil))
<add> end
<add>
<ide> context "raises a ParserError when given" do
<ide> it "an empty string" do
<ide> expect { described_class.parse("") }.to raise_error(Locale::ParserError) | 2 |
Javascript | Javascript | fix offscreen orbitcontrols | 26f7cb8be721cd0cb4d4bc4ab4b488d97c97fa3e | <ide><path>threejs/offscreencanvas-worker-orbitcontrols.js
<ide> function noop() {
<ide> class ElementProxyReceiver extends EventDispatcher {
<ide> constructor() {
<ide> super();
<add> // because OrbitControls try to set style.touchAction;
<add> this.style = {};
<ide> }
<ide> get clientWidth() {
<ide> return this.width;
<ide> }
<ide> get clientHeight() {
<ide> return this.height;
<ide> }
<add> // OrbitControls call these as of r132. Maybe we should implement them
<add> setPointerCapture() { }
<add> releasePointerCapture() { }
<ide> getBoundingClientRect() {
<ide> return {
<ide> left: this.left, | 1 |
Javascript | Javascript | fix e2e test focussing | 8c08fcfb1b993f05ecbec94b0c44dd3757066b51 | <ide><path>src/ng/directive/input.js
<ide> var ngValueDirective = function() {
<ide>
<ide> it('should allow custom events', function() {
<ide> input.sendKeys(' hello');
<add> input.click();
<ide> expect(model.getText()).toEqual('say');
<ide> other.click();
<ide> expect(model.getText()).toEqual('say hello'); | 1 |
Python | Python | add ability to restore fine-tuned tf mdoel | 7de17404901853e2d4b64a7624082a57fca70ad1 | <ide><path>pytorch_pretrained_bert/convert_xlnet_checkpoint_to_pytorch.py
<ide>
<ide> from pytorch_pretrained_bert.modeling_xlnet import (CONFIG_NAME, WEIGHTS_NAME,
<ide> XLNetConfig, XLNetRunConfig,
<del> XLNetLMHeadModel, load_tf_weights_in_xlnet)
<add> XLNetLMHeadModel, XLNetForQuestionAnswering,
<add> XLNetForSequenceClassification,
<add> load_tf_weights_in_xlnet)
<ide>
<del>def convert_xlnet_checkpoint_to_pytorch(tf_checkpoint_path, bert_config_file, pytorch_dump_folder_path):
<add>GLUE_TASKS = ["cola", "mnli", "mnli-mm", "mrpc", "sst-2", "sts-b", "qqp", "qnli", "rte", "wnli"]
<add>
<add>
<add>def convert_xlnet_checkpoint_to_pytorch(tf_checkpoint_path, bert_config_file, pytorch_dump_folder_path, finetuning_task=None):
<ide> # Initialise PyTorch model
<ide> config = XLNetConfig.from_json_file(bert_config_file)
<del> print("Building PyTorch model from configuration: {}".format(str(config)))
<del> model = XLNetLMHeadModel(config)
<add> if finetuning_task is not None and finetuning_task.lower() in GLUE_TASKS:
<add> model_class = XLNetLMHeadModel
<add> elif finetuning_task is not None and 'squad' in finetuning_task.lower():
<add> model_class = XLNetForQuestionAnswering
<add> else:
<add> model_class = XLNetLMHeadModel
<add> print("Building PyTorch model {} from configuration: {}".format(str(model_class), str(config)))
<add> model = model_class(config)
<ide>
<ide> # Load weights from tf checkpoint
<del> load_tf_weights_in_xlnet(model, config, tf_checkpoint_path)
<add> load_tf_weights_in_xlnet(model, config, tf_checkpoint_path, finetuning_task)
<ide>
<ide> # Save pytorch-model
<ide> pytorch_weights_dump_path = os.path.join(pytorch_dump_folder_path, WEIGHTS_NAME)
<ide> def convert_xlnet_checkpoint_to_pytorch(tf_checkpoint_path, bert_config_file, py
<ide> required = True,
<ide> help = "The config json file corresponding to the pre-trained XLNet model. \n"
<ide> "This specifies the model architecture.")
<del> parser.add_argument("--pytorch_dump_folder_path",
<add> parser.add_argument("--pytorch_dump_folder_path",finetuning_task
<ide> default = None,
<ide> type = str,
<ide> required = True,
<ide> help = "Path to the folder to store the PyTorch model or dataset/vocab.")
<add> parser.add_argument("--finetuning_task",
<add> default = None,
<add> type = str,
<add> help = "Name of a task on which the XLNet TensorFloaw model was fine-tuned")
<ide> args = parser.parse_args()
<ide> convert_xlnet_checkpoint_to_pytorch(args.tf_checkpoint_path,
<ide> args.xlnet_config_file,
<del> args.pytorch_dump_folder_path)
<add> args.pytorch_dump_folder_path,
<add> args.finetuning_task)
<ide><path>pytorch_pretrained_bert/modeling_xlnet.py
<ide> TF_WEIGHTS_NAME = 'model.ckpt'
<ide>
<ide>
<del>def build_tf_xlnet_to_pytorch_map(model, config, tf_weights=None):
<add>def build_tf_xlnet_to_pytorch_map(model, config, tf_weights=None, finetuning_task=None):
<ide> """ A map of modules from TF to PyTorch.
<ide> I use a map to keep the PyTorch model as
<ide> identical to the original PyTorch model as possible.
<ide> def build_tf_xlnet_to_pytorch_map(model, config, tf_weights=None):
<ide> # We will load also the sequence summary
<ide> tf_to_pt_map['model/sequnece_summary/summary/kernel'] = model.sequence_summary.summary.weight
<ide> tf_to_pt_map['model/sequnece_summary/summary/bias'] = model.sequence_summary.summary.bias
<del> elif hasattr(model, 'proj_loss') and any('model/regression' in name for name in tf_weights.keys()):
<del> raise NotImplementedError
<add> elif hasattr(model, 'logits_proj') and finetuning_task is not None and any('model/regression' in name for name in tf_weights.keys()):
<add> tf_to_pt_map['model/regression_{}/logit/kernel'.format(finetuning_task)] = model.logits_proj.weight
<add> tf_to_pt_map['model/regression_{}/logit/bias'.format(finetuning_task)] = model.logits_proj.bias
<add>
<ide> # Now load the rest of the transformer
<ide> model = model.transformer
<ide>
<ide> # Embeddings and output
<ide> tf_to_pt_map.update({'model/transformer/word_embedding/lookup_table': model.word_embedding.weight,
<del> 'model/transformer/mask_emb/mask_emb': model.mask_emb})
<add> 'model/transformer/mask_emb/mask_emb': model.mask_emb})
<ide>
<ide> # Transformer blocks
<ide> for i, b in enumerate(model.layer):
<ide> def build_tf_xlnet_to_pytorch_map(model, config, tf_weights=None):
<ide> 'model/transformer/seg_embed': seg_embed_list})
<ide> return tf_to_pt_map
<ide>
<del>def load_tf_weights_in_xlnet(model, config, tf_path):
<add>def load_tf_weights_in_xlnet(model, config, tf_path, finetuning_task=None):
<ide> """ Load tf checkpoints in a pytorch model
<ide> """
<ide> try:
<ide> def load_tf_weights_in_xlnet(model, config, tf_path):
<ide> tf_weights[name] = array
<ide>
<ide> # Build TF to PyTorch weights loading map
<del> tf_to_pt_map = build_tf_xlnet_to_pytorch_map(model, config, tf_weights)
<add> tf_to_pt_map = build_tf_xlnet_to_pytorch_map(model, config, tf_weights, finetuning_task)
<ide>
<ide> for name, pointer in tf_to_pt_map.items():
<ide> print("Importing {}".format(name))
<ide> def __init__(self, config, summary_type="last", use_proj=True, num_labels=2,
<ide> self.sequence_summary = XLNetSequenceSummary(config, summary_type=summary_type,
<ide> use_proj=use_proj, output_attentions=output_attentions,
<ide> keep_multihead_output=keep_multihead_output)
<del> self.loss_proj = nn.Linear(config.d_model, num_labels if not is_regression else 1)
<add> self.logits_proj = nn.Linear(config.d_model, num_labels if not is_regression else 1)
<ide> self.apply(self.init_weights)
<ide>
<ide> def forward(self, inp_k, token_type_ids=None, input_mask=None, attention_mask=None,
<ide> def forward(self, inp_k, token_type_ids=None, input_mask=None, attention_mask=No
<ide> output_all_encoded_layers, head_mask)
<ide>
<ide> output = self.sequence_summary(output)
<del> logits = self.loss_proj(output)
<add> logits = self.logits_proj(output)
<ide>
<ide> if target is not None:
<ide> if self.is_regression: | 2 |
Go | Go | add validatecontextdirectory to utils/utils.go | 1dedcd0d376f57abae5cadd38116c1aca2821330 | <ide><path>utils/utils.go
<ide> func TreeSize(dir string) (size int64, err error) {
<ide> })
<ide> return
<ide> }
<add>
<add>// ValidateContextDirectory checks if all the contents of the directory
<add>// can be read and returns an error if some files can't be read
<add>// symlinks which point to non-existing files don't trigger an error
<add>func ValidateContextDirectory(srcPath string) error {
<add> var finalError error
<add>
<add> filepath.Walk(filepath.Join(srcPath, "."), func(filePath string, f os.FileInfo, err error) error {
<add> // skip this directory/file if it's not in the path, it won't get added to the context
<add> _, err = filepath.Rel(srcPath, filePath)
<add> if err != nil && os.IsPermission(err) {
<add> return nil
<add> }
<add>
<add> if _, err := os.Stat(filePath); err != nil && os.IsPermission(err) {
<add> finalError = fmt.Errorf("can't stat '%s'", filePath)
<add> return err
<add> }
<add> // skip checking if symlinks point to non-existing files, such symlinks can be useful
<add> lstat, _ := os.Lstat(filePath)
<add> if lstat.Mode()&os.ModeSymlink == os.ModeSymlink {
<add> return err
<add> }
<add>
<add> if !f.IsDir() {
<add> currentFile, err := os.Open(filePath)
<add> if err != nil && os.IsPermission(err) {
<add> finalError = fmt.Errorf("no permission to read from '%s'", filePath)
<add> return err
<add> } else {
<add> currentFile.Close()
<add> }
<add> }
<add> return nil
<add> })
<add> return finalError
<add>} | 1 |
Text | Text | fix small typos in create-subscription readme | 2e1cc2802709877fb2454163ba30e52a91feac8e | <ide><path>packages/create-subscription/README.md
<ide> const ReplaySubscription = createSubscription({
<ide>
<ide> Below is an example showing how `create-subscription` can be used with native Promises.
<ide>
<del>**Note** that it an initial render value of `undefined` is unavoidable due to the fact that Promises provide no way to synchronously read their current value.
<add>**Note** that an initial render value of `undefined` is unavoidable due to the fact that Promises provide no way to synchronously read their current value.
<ide>
<ide> **Note** the lack of a way to "unsubscribe" from a Promise can result in memory leaks as long as something has a reference to the Promise. This should be taken into consideration when determining whether Promises are appropriate to use in this way within your application.
<ide> | 1 |
Ruby | Ruby | remove unused line | 1f39b731c1b8e53bb9f91fe06dd26be71c134017 | <ide><path>activerecord/test/cases/adapters/postgresql/array_test.rb
<ide> def test_column
<ide>
<ide> ratings_column = PgArray.columns_hash['ratings']
<ide> assert_equal :integer, ratings_column.type
<del> type = PgArray.type_for_attribute("ratings")
<ide> assert ratings_column.array?
<ide> end
<ide> | 1 |
Go | Go | fix a bug when encoding a job environment to json | 434f06d03dc2825cb4f348a88ddc6d1aa17ea19c | <ide><path>api.go
<ide> func postContainersStart(srv *Server, version float64, w http.ResponseWriter, r
<ide> }
<ide> name := vars["name"]
<ide> job := srv.Eng.Job("start", name)
<add> if err := job.ImportEnv(HostConfig{}); err != nil {
<add> return fmt.Errorf("Couldn't initialize host configuration")
<add> }
<ide> // allow a nil body for backwards compatibility
<ide> if r.Body != nil {
<ide> if matchesContentType(r.Header.Get("Content-Type"), "application/json") {
<ide><path>engine/job.go
<ide> func (job *Job) DecodeEnv(src io.Reader) error {
<ide> }
<ide>
<ide> func (job *Job) EncodeEnv(dst io.Writer) error {
<del> return json.NewEncoder(dst).Encode(job.Environ())
<add> m := make(map[string]interface{})
<add> for k, v := range job.Environ() {
<add> var val interface{}
<add> if err := json.Unmarshal([]byte(v), &val); err == nil {
<add> m[k] = val
<add> } else {
<add> m[k] = v
<add> }
<add> }
<add> if err := json.NewEncoder(dst).Encode(&m); err != nil {
<add> return err
<add> }
<add> return nil
<ide> }
<ide>
<del>func (job *Job) ExportEnv(dst interface{}) error {
<add>func (job *Job) ExportEnv(dst interface{}) (err error) {
<ide> var buf bytes.Buffer
<ide> if err := job.EncodeEnv(&buf); err != nil {
<ide> return err | 2 |
Go | Go | replace diffpath with diffgetter | 58bec40d16265362fd4e41dbd652e6fba903794d | <ide><path>daemon/graphdriver/aufs/aufs.go
<ide> import (
<ide> "syscall"
<ide>
<ide> "github.com/Sirupsen/logrus"
<add> "github.com/vbatts/tar-split/tar/storage"
<ide>
<ide> "github.com/docker/docker/daemon/graphdriver"
<ide> "github.com/docker/docker/pkg/archive"
<ide> func (a *Driver) Diff(id, parent string) (archive.Archive, error) {
<ide> })
<ide> }
<ide>
<del>// DiffPath returns path to the directory that contains files for the layer
<del>// differences. Used for direct access for tar-split.
<del>func (a *Driver) DiffPath(id string) (string, func() error, error) {
<del> return path.Join(a.rootPath(), "diff", id), func() error { return nil }, nil
<add>type fileGetNilCloser struct {
<add> storage.FileGetter
<add>}
<add>
<add>func (f fileGetNilCloser) Close() error {
<add> return nil
<add>}
<add>
<add>// DiffGetter returns a FileGetCloser that can read files from the directory that
<add>// contains files for the layer differences. Used for direct access for tar-split.
<add>func (a *Driver) DiffGetter(id string) (graphdriver.FileGetCloser, error) {
<add> p := path.Join(a.rootPath(), "diff", id)
<add> return fileGetNilCloser{storage.NewPathFileGetter(p)}, nil
<ide> }
<ide>
<ide> func (a *Driver) applyDiff(id string, diff archive.Reader) error {
<ide><path>daemon/graphdriver/driver.go
<ide> import (
<ide> "strings"
<ide>
<ide> "github.com/Sirupsen/logrus"
<add> "github.com/vbatts/tar-split/tar/storage"
<ide>
<ide> "github.com/docker/docker/pkg/archive"
<ide> "github.com/docker/docker/pkg/idtools"
<ide> type Driver interface {
<ide> DiffSize(id, parent string) (size int64, err error)
<ide> }
<ide>
<add>// DiffGetterDriver is the interface for layered file system drivers that
<add>// provide a specialized function for getting file contents for tar-split.
<add>type DiffGetterDriver interface {
<add> Driver
<add> // DiffGetter returns an interface to efficiently retrieve the contents
<add> // of files in a layer.
<add> DiffGetter(id string) (FileGetCloser, error)
<add>}
<add>
<add>// FileGetCloser extends the storage.FileGetter interface with a Close method
<add>// for cleaning up.
<add>type FileGetCloser interface {
<add> storage.FileGetter
<add> // Close cleans up any resources associated with the FileGetCloser.
<add> Close() error
<add>}
<add>
<ide> func init() {
<ide> drivers = make(map[string]InitFunc)
<ide> }
<ide><path>daemon/graphdriver/windows/windows.go
<ide> import (
<ide> "github.com/docker/docker/pkg/idtools"
<ide> "github.com/docker/docker/pkg/ioutils"
<ide> "github.com/docker/docker/pkg/random"
<add> "github.com/vbatts/tar-split/tar/storage"
<ide> )
<ide>
<ide> // init registers the windows graph drivers to the register.
<ide> type Driver struct {
<ide> active map[string]int
<ide> }
<ide>
<add>var _ graphdriver.DiffGetterDriver = &Driver{}
<add>
<ide> // InitFilter returns a new Windows storage filter driver.
<ide> func InitFilter(home string, options []string, uidMaps, gidMaps []idtools.IDMap) (graphdriver.Driver, error) {
<ide> logrus.Debugf("WindowsGraphDriver InitFilter at %s", home)
<ide> func (d *Driver) setLayerChain(id string, chain []string) error {
<ide> return nil
<ide> }
<ide>
<del>// DiffPath returns a directory that contains files needed to construct layer diff.
<del>func (d *Driver) DiffPath(id string) (path string, release func() error, err error) {
<add>type fileGetDestroyCloser struct {
<add> storage.FileGetter
<add> d *Driver
<add> folderName string
<add>}
<add>
<add>func (f *fileGetDestroyCloser) Close() error {
<add> // TODO: activate layers and release here?
<add> return hcsshim.DestroyLayer(f.d.info, f.folderName)
<add>}
<add>
<add>// DiffGetter returns a FileGetCloser that can read files from the directory that
<add>// contains files for the layer differences. Used for direct access for tar-split.
<add>func (d *Driver) DiffGetter(id string) (fg graphdriver.FileGetCloser, err error) {
<ide> id, err = d.resolveID(id)
<ide> if err != nil {
<ide> return
<ide> func (d *Driver) DiffPath(id string) (path string, release func() error, err err
<ide> return
<ide> }
<ide>
<del> return tempFolder, func() error {
<del> // TODO: activate layers and release here?
<del> _, folderName := filepath.Split(tempFolder)
<del> return hcsshim.DestroyLayer(d.info, folderName)
<del> }, nil
<add> _, folderName := filepath.Split(tempFolder)
<add> return &fileGetDestroyCloser{storage.NewPathFileGetter(tempFolder), d, folderName}, nil
<ide> }
<ide><path>layer/layer_store.go
<ide> func (ls *layerStore) initMount(graphID, parent, mountLabel string, initFunc Mou
<ide> }
<ide>
<ide> func (ls *layerStore) assembleTarTo(graphID string, metadata io.ReadCloser, size *int64, w io.Writer) error {
<del> type diffPathDriver interface {
<del> DiffPath(string) (string, func() error, error)
<del> }
<del>
<del> diffDriver, ok := ls.driver.(diffPathDriver)
<add> diffDriver, ok := ls.driver.(graphdriver.DiffGetterDriver)
<ide> if !ok {
<ide> diffDriver = &naiveDiffPathDriver{ls.driver}
<ide> }
<ide>
<ide> defer metadata.Close()
<ide>
<ide> // get our relative path to the container
<del> fsPath, releasePath, err := diffDriver.DiffPath(graphID)
<add> fileGetCloser, err := diffDriver.DiffGetter(graphID)
<ide> if err != nil {
<ide> return err
<ide> }
<del> defer releasePath()
<add> defer fileGetCloser.Close()
<ide>
<ide> metaUnpacker := storage.NewJSONUnpacker(metadata)
<ide> upackerCounter := &unpackSizeCounter{metaUnpacker, size}
<del> fileGetter := storage.NewPathFileGetter(fsPath)
<del> logrus.Debugf("Assembling tar data for %s from %s", graphID, fsPath)
<del> return asm.WriteOutputTarStream(fileGetter, upackerCounter, w)
<add> logrus.Debugf("Assembling tar data for %s", graphID)
<add> return asm.WriteOutputTarStream(fileGetCloser, upackerCounter, w)
<ide> }
<ide>
<ide> func (ls *layerStore) Cleanup() error {
<ide> type naiveDiffPathDriver struct {
<ide> graphdriver.Driver
<ide> }
<ide>
<del>func (n *naiveDiffPathDriver) DiffPath(id string) (string, func() error, error) {
<add>type fileGetPutter struct {
<add> storage.FileGetter
<add> driver graphdriver.Driver
<add> id string
<add>}
<add>
<add>func (w *fileGetPutter) Close() error {
<add> return w.driver.Put(w.id)
<add>}
<add>
<add>func (n *naiveDiffPathDriver) DiffGetter(id string) (graphdriver.FileGetCloser, error) {
<ide> p, err := n.Driver.Get(id, "")
<ide> if err != nil {
<del> return "", nil, err
<add> return nil, err
<ide> }
<del> return p, func() error {
<del> return n.Driver.Put(id)
<del> }, nil
<add> return &fileGetPutter{storage.NewPathFileGetter(p), n.Driver, id}, nil
<ide> } | 4 |
Javascript | Javascript | allow nonce attribute | e39f51429b7e81b44ba38cbe3959fbd9a658cf48 | <ide><path>src/renderers/dom/shared/HTMLDOMPropertyConfig.js
<ide> var HTMLDOMPropertyConfig = {
<ide> multiple: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
<ide> muted: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
<ide> name: null,
<add> nonce: MUST_USE_ATTRIBUTE,
<ide> noValidate: HAS_BOOLEAN_VALUE,
<ide> open: HAS_BOOLEAN_VALUE,
<ide> optimum: null, | 1 |
Text | Text | use sha256 for example | 04959403ac23bc16d52fc52aafed80b574231b02 | <ide><path>share/doc/homebrew/Python-for-Formula-Authors.md
<ide> class Foo < Formula
<ide> url ...
<ide>
<ide> resource "six" do
<del> url "https://pypi.python.org/packages/source/s/six/six-1.8.0.tar.gz"
<del> sha1 "aa3b0659cbc85c6c7a91efc51f2d1007040070cd"
<add> url "https://pypi.python.org/packages/source/s/six/six-1.9.0.tar.gz"
<add> sha256 "e24052411fc4fbd1f672635537c3fc2330d9481b18c0317695b46259512c91d5"
<ide> end
<ide>
<del> resource "parsedatetime" do
<add> resource "parsedatetime" do
<ide> url "https://pypi.python.org/packages/source/p/parsedatetime/parsedatetime-1.4.tar.gz"
<del> sha1 "4b9189d38f819cc8144f30d91779716a696d97f8"
<add> sha256 "09bfcd8f3c239c75e77b3ff05d782ab2c1aed0892f250ce2adf948d4308fe9dc"
<ide> end
<ide>
<ide> def install | 1 |
Javascript | Javascript | add callback to fs.close() in test-fs-stat | 665695fbea4a4dc3c241e7f27738003d00218c78 | <ide><path>test/parallel/test-fs-stat.js
<ide> fs.open('.', 'r', undefined, common.mustCall(function(err, fd) {
<ide> fs.fstat(fd, common.mustCall(function(err, stats) {
<ide> assert.ifError(err);
<ide> assert.ok(stats.mtime instanceof Date);
<del> fs.close(fd);
<add> fs.close(fd, assert.ifError);
<ide> assert.strictEqual(this, global);
<ide> }));
<ide>
<ide> fs.open('.', 'r', undefined, common.mustCall(function(err, fd) {
<ide> console.dir(stats);
<ide> assert.ok(stats.mtime instanceof Date);
<ide> }
<del> fs.close(fd);
<add> fs.close(fd, assert.ifError);
<ide> }));
<ide>
<ide> console.log(`stating: ${__filename}`); | 1 |
Text | Text | note typescript migration | b900ad9b85ef44c6f83f86638d5ac6a9282694d9 | <ide><path>UPGRADING.md
<ide>
<ide> ## Breaking Changes
<ide>
<add>#### `@zeit/next-typescript` is no longer necessary
<add>
<add>Next.js will now ignore usage `@zeit/next-typescript` and warn you to remove it. Please remove this plugin from your `next.config.js`.
<add>
<add>Usage of [`fork-ts-checker-webpack-plugin`](https://github.com/Realytics/fork-ts-checker-webpack-plugin/issues) should also be removed from your `next.config.js`.
<add>
<ide> #### `next/dynamic` no longer renders "loading..." by default while loading
<ide>
<ide> Dynamic components will not render anything by default while loading. You can still customize this behavior by setting the `loading` property: | 1 |
Python | Python | fix typos and even more informative docs. | 2d3880dc359ef67e30dc6fd751fcfafef7aa281d | <ide><path>examples/neural_turing_machine_copy.py
<ide>
<ide> """
<ide> Copy Problem defined in Graves et. al [0]
<del>After about 3500 updates, the accuracy becomes jumps from around 50% to >90%.
<add>
<add>Training data is made of sequences with length 1 to 20.
<add>Test data are sequences of length 100.
<add>The model is tested every 500 weight updates.
<add>After about 3500 updates, the accuracy jumps from around 50% to >90%.
<ide>
<ide> Estimated compile time: 12 min
<ide> Estimated time to train Neural Turing Machine and 3 layer LSTM on an NVidia GTX 680: 2h
<ide>
<del>
<ide> [0]: http://arxiv.org/pdf/1410.5401v2.pdf
<ide> """
<ide> | 1 |
Java | Java | fix typo and polish | 42a95b8f35708612e40ad3b2ecd215da3216b6c1 | <ide><path>spring-test/src/main/java/org/springframework/test/web/reactive/server/WiretapConnector.java
<ide> public Mono<byte[]> getContent() {
<ide> //noinspection ConstantConditions
<ide> (this.publisher != null ? this.publisher : this.publisherNested)
<ide> .onErrorMap(ex -> new IllegalStateException(
<del> "Content was not been consumed and " +
<del> "an error was raised on attempt to produce it:", ex))
<add> "Content has not been consumed, and " +
<add> "an error was raised while attempting to produce it.", ex))
<ide> .subscribe();
<ide> }
<ide> return this.content; | 1 |
Javascript | Javascript | expose parsers freelist | 0003c701bcb1d916073f8893ee4cbe698515158d | <ide><path>lib/http.js
<ide> var parsers = new FreeList('parsers', 1000, function () {
<ide>
<ide> return parser;
<ide> });
<add>exports.parsers = parsers;
<ide>
<ide>
<ide> var CRLF = "\r\n"; | 1 |
Python | Python | remove `print()`'s in distutils template handling | 7f45b555df88dbf860de5f035a32dfc03b2e06d6 | <ide><path>numpy/distutils/conv_template.py
<ide> def resolve_includes(source):
<ide> if not os.path.isabs(fn):
<ide> fn = os.path.join(d, fn)
<ide> if os.path.isfile(fn):
<del> print('Including file', fn)
<ide> lines.extend(resolve_includes(fn))
<ide> else:
<ide> lines.append(line)
<ide><path>numpy/distutils/from_template.py
<ide> def resolve_includes(source):
<ide> if not os.path.isabs(fn):
<ide> fn = os.path.join(d, fn)
<ide> if os.path.isfile(fn):
<del> print('Including file', fn)
<ide> lines.extend(resolve_includes(fn))
<ide> else:
<ide> lines.append(line) | 2 |
Python | Python | use assertequal instead of assertequals | 81cd3a74609086a34ced5a5af65768f58cee2c87 | <ide><path>tests/template_tests/tests.py
<ide> def test_context_comparable(self):
<ide> # adds __eq__ in the future
<ide> request = RequestFactory().get('/')
<ide>
<del> self.assertEquals(
<add> self.assertEqual(
<ide> RequestContext(request, dict_=test_data),
<ide> RequestContext(request, dict_=test_data)
<ide> ) | 1 |
PHP | PHP | fix double semicolon | 92d9b11aeef140b1e39ed61ff5b266c814de19c5 | <ide><path>lib/Cake/Test/Case/Utility/DebuggerTest.php
<ide> public function testExportVarZero() {
<ide> 'false' => false,
<ide> 'szero' => '0',
<ide> 'zero' => 0
<del> );;
<add> );
<ide> $result = Debugger::exportVar($data);
<ide> $expected = <<<TEXT
<ide> array( | 1 |
PHP | PHP | improve layout more | 673abc89e249525c4d574b75cd3ee3678f55ca81 | <ide><path>templates/Error/duplicate_named_route.php
<ide>
<ide> <?php if (isset($attributes['duplicate'])): ?>
<ide> <h3>Duplicate Route</h3>
<del> <table cellspacing="0" cellpadding="0">
<add> <table cellspacing="0" cellpadding="0" width="100%">
<ide> <tr><th>Template</th><th>Defaults</th><th>Options</th></tr>
<ide> <?php $other = $attributes['duplicate']; ?>
<ide> <tr>
<del> <td width="25%"><?= h($other->template) ?></td>
<add> <td><?= h($other->template) ?></td>
<ide> <td><div class="cake-debug" data-open-all="true"><?= Debugger::exportVar($other->defaults) ?></div></td>
<del> <td width="20%"><div class="cake-debug" data-open-all="true"><?= Debugger::exportVar($other->options) ?></div></td>
<add> <td><div class="cake-debug" data-open-all="true"><?= Debugger::exportVar($other->options) ?></div></td>
<ide> </tr>
<ide> </table>
<ide> <?php endif; ?>
<ide><path>templates/Error/missing_route.php
<ide> <?php endif; ?>
<ide>
<ide> <h3>Connected Routes</h3>
<del><table cellspacing="0" cellpadding="0">
<add><table cellspacing="0" cellpadding="0" width="100%">
<ide> <tr><th>Template</th><th>Defaults</th><th>Options</th></tr>
<ide> <?php foreach (Router::routes() as $route): ?>
<ide> <tr>
<del> <td width="25%"><?= h($route->template) ?></td>
<add> <td><?= h($route->template) ?></td>
<ide> <td><div class="cake-debug" data-open-all="true"><?= Debugger::exportVar($route->defaults) ?></div></td>
<del> <td width="20%"><div class="cake-debug" data-open-all="true"><?= Debugger::exportVar($route->options) ?></div></td>
<add> <td><div class="cake-debug" data-open-all="true"><?= Debugger::exportVar($route->options) ?></div></td>
<ide> </tr>
<ide> <?php endforeach; ?>
<ide> </table> | 2 |
Javascript | Javascript | add back comments | dd6406ace23796cc668f9ffdabf4cc58df944210 | <ide><path>packages/next/taskfile-babel.js
<ide> module.exports = function(task) {
<ide> const options = {
<ide> ...babelOpts,
<ide> compact: true,
<del> comments: false,
<ide> babelrc: false,
<ide> configFile: false,
<ide> filename: file.base,
<ide> module.exports = function(task) {
<ide> // Workaround for noop.js loading
<ide> if (file.base === 'next-dev.js') {
<ide> output.code = output.code.replace(
<del> '__REPLACE_NOOP_IMPORT__',
<add> /__REPLACE_NOOP_IMPORT__/g,
<ide> `import('./dev/noop');`
<ide> )
<ide> } | 1 |
Java | Java | provide simple way to create serverrequest | 22edab852da456bea728daf84df09f0047e1d13f | <ide><path>spring-test/src/main/java/org/springframework/mock/web/reactive/function/server/MockServerRequest.java
<ide> import org.springframework.http.HttpRange;
<ide> import org.springframework.http.HttpRequest;
<ide> import org.springframework.http.MediaType;
<add>import org.springframework.http.codec.HttpMessageReader;
<ide> import org.springframework.http.codec.multipart.Part;
<ide> import org.springframework.http.server.PathContainer;
<ide> import org.springframework.http.server.RequestPath;
<ide> import org.springframework.util.LinkedMultiValueMap;
<ide> import org.springframework.util.MultiValueMap;
<ide> import org.springframework.web.reactive.function.BodyExtractor;
<add>import org.springframework.web.reactive.function.server.HandlerStrategies;
<ide> import org.springframework.web.reactive.function.server.ServerRequest;
<add>import org.springframework.web.server.ServerWebExchange;
<ide> import org.springframework.web.server.WebSession;
<ide> import org.springframework.web.util.UriBuilder;
<ide> import org.springframework.web.util.UriComponentsBuilder;
<ide> public class MockServerRequest implements ServerRequest {
<ide> @Nullable
<ide> private final InetSocketAddress remoteAddress;
<ide>
<add> private final List<HttpMessageReader<?>> messageReaders;
<add>
<add> @Nullable
<add> private final ServerWebExchange exchange;
<add>
<ide>
<ide> private MockServerRequest(HttpMethod method, URI uri, String contextPath, MockHeaders headers,
<ide> MultiValueMap<String, HttpCookie> cookies, @Nullable Object body,
<ide> Map<String, Object> attributes, MultiValueMap<String, String> queryParams,
<ide> Map<String, String> pathVariables, @Nullable WebSession session, @Nullable Principal principal,
<del> @Nullable InetSocketAddress remoteAddress) {
<add> @Nullable InetSocketAddress remoteAddress, List<HttpMessageReader<?>> messageReaders,
<add> @Nullable ServerWebExchange exchange) {
<ide>
<ide> this.method = method;
<ide> this.uri = uri;
<ide> private MockServerRequest(HttpMethod method, URI uri, String contextPath, MockHe
<ide> this.session = session;
<ide> this.principal = principal;
<ide> this.remoteAddress = remoteAddress;
<add> this.messageReaders = messageReaders;
<add> this.exchange = exchange;
<ide> }
<ide>
<ide>
<ide> public Optional<InetSocketAddress> remoteAddress() {
<ide> return Optional.ofNullable(this.remoteAddress);
<ide> }
<ide>
<add> @Override
<add> public List<HttpMessageReader<?>> messageReaders() {
<add> return this.messageReaders;
<add> }
<add>
<ide> @Override
<ide> @SuppressWarnings("unchecked")
<ide> public <S> S body(BodyExtractor<S, ? super ServerHttpRequest> extractor) {
<ide> public Mono<? extends Principal> principal() {
<ide> return Mono.justOrEmpty(this.principal);
<ide> }
<ide>
<del>
<ide> @Override
<ide> @SuppressWarnings("unchecked")
<ide> public Mono<MultiValueMap<String, String>> formData() {
<ide> public Mono<MultiValueMap<String, Part>> multipartData() {
<ide> return (Mono<MultiValueMap<String, Part>>) this.body;
<ide> }
<ide>
<add> @Override
<add> public ServerWebExchange exchange() {
<add> Assert.state(this.exchange != null, "No exchange");
<add> return this.exchange;
<add> }
<add>
<ide> public static Builder builder() {
<ide> return new BuilderImpl();
<ide> }
<ide> public interface Builder {
<ide>
<ide> Builder remoteAddress(InetSocketAddress remoteAddress);
<ide>
<add> Builder messageReaders(List<HttpMessageReader<?>> messageReaders);
<add>
<add> Builder exchange(ServerWebExchange exchange);
<add>
<ide> MockServerRequest body(Object body);
<ide>
<ide> MockServerRequest build();
<ide> private static class BuilderImpl implements Builder {
<ide> @Nullable
<ide> private InetSocketAddress remoteAddress;
<ide>
<add> private List<HttpMessageReader<?>> messageReaders = HandlerStrategies.withDefaults().messageReaders();
<add>
<add> @Nullable
<add> private ServerWebExchange exchange;
<add>
<ide> @Override
<ide> public Builder method(HttpMethod method) {
<ide> Assert.notNull(method, "'method' must not be null");
<ide> public Builder remoteAddress(InetSocketAddress remoteAddress) {
<ide> return this;
<ide> }
<ide>
<add> @Override
<add> public Builder messageReaders(List<HttpMessageReader<?>> messageReaders) {
<add> Assert.notNull(messageReaders, "'messageReaders' must not be null");
<add> this.messageReaders = messageReaders;
<add> return this;
<add> }
<add>
<add> @Override
<add> public Builder exchange(ServerWebExchange exchange) {
<add> Assert.notNull(exchange, "'exchange' must not be null");
<add> this.exchange = exchange;
<add> return this;
<add> }
<add>
<ide> @Override
<ide> public MockServerRequest body(Object body) {
<ide> this.body = body;
<ide> return new MockServerRequest(this.method, this.uri, this.contextPath, this.headers,
<ide> this.cookies, this.body, this.attributes, this.queryParams, this.pathVariables,
<del> this.session, this.principal, this.remoteAddress);
<add> this.session, this.principal, this.remoteAddress, this.messageReaders,
<add> this.exchange);
<ide> }
<ide>
<ide> @Override
<ide> public MockServerRequest build() {
<ide> return new MockServerRequest(this.method, this.uri, this.contextPath, this.headers,
<ide> this.cookies, null, this.attributes, this.queryParams, this.pathVariables,
<del> this.session, this.principal, this.remoteAddress);
<add> this.session, this.principal, this.remoteAddress, this.messageReaders,
<add> this.exchange);
<ide> }
<ide> }
<ide>
<ide><path>spring-webflux/src/main/java/org/springframework/web/reactive/function/server/DefaultServerRequest.java
<ide> public Optional<InetSocketAddress> remoteAddress() {
<ide> return Optional.ofNullable(request().getRemoteAddress());
<ide> }
<ide>
<add> @Override
<add> public List<HttpMessageReader<?>> messageReaders() {
<add> return this.messageReaders;
<add> }
<add>
<ide> @Override
<ide> public <T> T body(BodyExtractor<T, ? super ServerHttpRequest> extractor) {
<ide> return body(extractor, Collections.emptyMap());
<ide> private ServerHttpRequest request() {
<ide> return this.exchange.getRequest();
<ide> }
<ide>
<del> ServerWebExchange exchange() {
<add> @Override
<add> public ServerWebExchange exchange() {
<ide> return this.exchange;
<ide> }
<ide>
<ide><path>spring-webflux/src/main/java/org/springframework/web/reactive/function/server/DefaultServerRequestBuilder.java
<add>/*
<add> * Copyright 2002-2018 the original author or authors.
<add> *
<add> * Licensed under the Apache License, Version 2.0 (the "License");
<add> * you may not use this file except in compliance with the License.
<add> * You may obtain a copy of the License at
<add> *
<add> * http://www.apache.org/licenses/LICENSE-2.0
<add> *
<add> * Unless required by applicable law or agreed to in writing, software
<add> * distributed under the License is distributed on an "AS IS" BASIS,
<add> * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
<add> * See the License for the specific language governing permissions and
<add> * limitations under the License.
<add> */
<add>
<add>package org.springframework.web.reactive.function.server;
<add>
<add>import java.net.URI;
<add>import java.nio.charset.StandardCharsets;
<add>import java.security.Principal;
<add>import java.time.Instant;
<add>import java.util.Collections;
<add>import java.util.LinkedHashMap;
<add>import java.util.List;
<add>import java.util.Map;
<add>import java.util.function.Consumer;
<add>import java.util.function.Function;
<add>import java.util.regex.Matcher;
<add>import java.util.regex.Pattern;
<add>
<add>import reactor.core.publisher.Flux;
<add>import reactor.core.publisher.Mono;
<add>
<add>import org.springframework.context.ApplicationContext;
<add>import org.springframework.context.i18n.LocaleContext;
<add>import org.springframework.core.ResolvableType;
<add>import org.springframework.core.io.buffer.DataBuffer;
<add>import org.springframework.core.io.buffer.DataBufferFactory;
<add>import org.springframework.core.io.buffer.DataBufferUtils;
<add>import org.springframework.core.io.buffer.DefaultDataBufferFactory;
<add>import org.springframework.http.HttpCookie;
<add>import org.springframework.http.HttpHeaders;
<add>import org.springframework.http.HttpMethod;
<add>import org.springframework.http.InvalidMediaTypeException;
<add>import org.springframework.http.MediaType;
<add>import org.springframework.http.codec.HttpMessageReader;
<add>import org.springframework.http.codec.multipart.Part;
<add>import org.springframework.http.server.RequestPath;
<add>import org.springframework.http.server.reactive.ServerHttpRequest;
<add>import org.springframework.http.server.reactive.ServerHttpResponse;
<add>import org.springframework.lang.Nullable;
<add>import org.springframework.util.Assert;
<add>import org.springframework.util.CollectionUtils;
<add>import org.springframework.util.LinkedMultiValueMap;
<add>import org.springframework.util.MultiValueMap;
<add>import org.springframework.util.StringUtils;
<add>import org.springframework.web.server.ServerWebExchange;
<add>import org.springframework.web.server.WebSession;
<add>import org.springframework.web.util.UriUtils;
<add>
<add>/**
<add> * Default {@link ServerRequest.Builder} implementation.
<add> *
<add> * @author Arjen Poutsma
<add> * @since 5.1
<add> */
<add>class DefaultServerRequestBuilder implements ServerRequest.Builder {
<add>
<add> private final HttpHeaders headers = new HttpHeaders();
<add>
<add> private final MultiValueMap<String, HttpCookie> cookies = new LinkedMultiValueMap<>();
<add>
<add> private final Map<String, Object> attributes = new LinkedHashMap<>();
<add>
<add> private final List<HttpMessageReader<?>> messageReaders;
<add>
<add> private ServerWebExchange exchange;
<add>
<add> private HttpMethod method = HttpMethod.GET;
<add>
<add> @Nullable
<add> private URI uri;
<add>
<add> private Flux<DataBuffer> body = Flux.empty();
<add>
<add> public DefaultServerRequestBuilder(ServerRequest other) {
<add> Assert.notNull(other, "ServerRequest must not be null");
<add> this.messageReaders = other.messageReaders();
<add> this.exchange = other.exchange();
<add> method(other.method());
<add> uri(other.uri());
<add> headers(headers -> headers.addAll(other.headers().asHttpHeaders()));
<add> cookies(cookies -> cookies.addAll(other.cookies()));
<add> }
<add>
<add> @Override
<add> public ServerRequest.Builder method(HttpMethod method) {
<add> Assert.notNull(method, "'method' must not be null");
<add> this.method = method;
<add> return this;
<add> }
<add>
<add> @Override
<add> public ServerRequest.Builder uri(URI uri) {
<add> Assert.notNull(uri, "'uri' must not be null");
<add> this.uri = uri;
<add> return this;
<add> }
<add>
<add> @Override
<add> public ServerRequest.Builder header(String headerName, String... headerValues) {
<add> for (String headerValue : headerValues) {
<add> this.headers.add(headerName, headerValue);
<add> }
<add> return this;
<add> }
<add>
<add> @Override
<add> public ServerRequest.Builder headers(Consumer<HttpHeaders> headersConsumer) {
<add> Assert.notNull(headersConsumer, "'headersConsumer' must not be null");
<add> headersConsumer.accept(this.headers);
<add> return this;
<add> }
<add>
<add> @Override
<add> public ServerRequest.Builder cookie(String name, String... values) {
<add> for (String value : values) {
<add> this.cookies.add(name, new HttpCookie(name, value));
<add> }
<add> return this;
<add> }
<add>
<add> @Override
<add> public ServerRequest.Builder cookies(
<add> Consumer<MultiValueMap<String, HttpCookie>> cookiesConsumer) {
<add>
<add> Assert.notNull(cookiesConsumer, "'cookiesConsumer' must not be null");
<add> cookiesConsumer.accept(this.cookies);
<add> return this;
<add> }
<add>
<add> @Override
<add> public ServerRequest.Builder body(Flux<DataBuffer> body) {
<add> Assert.notNull(body, "'body' must not be null");
<add> releaseBody();
<add> this.body = body;
<add> return this;
<add> }
<add>
<add> @Override
<add> public ServerRequest.Builder body(String body) {
<add> Assert.notNull(body, "'body' must not be null");
<add> releaseBody();
<add> DataBufferFactory dataBufferFactory = new DefaultDataBufferFactory();
<add> this.body = Flux.just(body).
<add> map(s -> {
<add> byte[] bytes = body.getBytes(StandardCharsets.UTF_8);
<add> return dataBufferFactory.wrap(bytes);
<add> });
<add> return this;
<add> }
<add>
<add> private void releaseBody() {
<add> this.body.subscribe(DataBufferUtils.releaseConsumer());
<add> }
<add>
<add> @Override
<add> public ServerRequest.Builder attribute(String name, Object value) {
<add> Assert.notNull(name, "'name' must not be null");
<add> this.attributes.put(name, value);
<add> return this;
<add> }
<add>
<add> @Override
<add> public ServerRequest.Builder attributes(Consumer<Map<String, Object>> attributesConsumer) {
<add> Assert.notNull(attributesConsumer, "'attributesConsumer' must not be null");
<add> attributesConsumer.accept(this.attributes);
<add> return this;
<add> }
<add>
<add> @Override
<add> public ServerRequest build() {
<add> ServerHttpRequest serverHttpRequest = new BuiltServerHttpRequest(this.method, this.uri,
<add> this.headers, this.cookies, this.body);
<add> ServerWebExchange exchange = new DelegatingServerWebExchange(serverHttpRequest,
<add> this.exchange, this.messageReaders);
<add> return new DefaultServerRequest(exchange, this.messageReaders);
<add> }
<add>
<add> private static class BuiltServerHttpRequest implements ServerHttpRequest {
<add>
<add> private static final Pattern QUERY_PATTERN = Pattern.compile("([^&=]+)(=?)([^&]+)?");
<add>
<add>
<add> private final HttpMethod method;
<add>
<add> private final URI uri;
<add>
<add> private final RequestPath path;
<add>
<add> private final MultiValueMap<String, String> queryParams;
<add>
<add> private final HttpHeaders headers;
<add>
<add> private final MultiValueMap<String, HttpCookie> cookies;
<add>
<add> private final Flux<DataBuffer> body;
<add>
<add> public BuiltServerHttpRequest(HttpMethod method, URI uri,
<add> HttpHeaders headers,
<add> MultiValueMap<String, HttpCookie> cookies,
<add> Flux<DataBuffer> body) {
<add> this.method = method;
<add> this.uri = uri;
<add> this.path = RequestPath.parse(uri, null);
<add> this.headers = HttpHeaders.readOnlyHttpHeaders(headers);
<add> this.cookies = unmodifiableCopy(cookies);
<add> this.queryParams = parseQueryParams(uri);
<add> this.body = body;
<add> }
<add>
<add> private static <K, V> MultiValueMap<K, V> unmodifiableCopy(MultiValueMap<K, V> original) {
<add> return CollectionUtils.unmodifiableMultiValueMap(new LinkedMultiValueMap<>(original));
<add> }
<add>
<add> private static MultiValueMap<String, String> parseQueryParams(URI uri) {
<add> MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<>();
<add> String query = uri.getRawQuery();
<add> if (query != null) {
<add> Matcher matcher = QUERY_PATTERN.matcher(query);
<add> while (matcher.find()) {
<add> String name = UriUtils.decode(matcher.group(1), StandardCharsets.UTF_8);
<add> String eq = matcher.group(2);
<add> String value = matcher.group(3);
<add> if (value != null) {
<add> value = UriUtils.decode(value, StandardCharsets.UTF_8);
<add> }
<add> else {
<add> value = StringUtils.hasLength(eq) ? "" : null;
<add> }
<add> queryParams.add(name, value);
<add> }
<add> }
<add> return queryParams;
<add> }
<add>
<add> @Nullable
<add> @Override
<add> public HttpMethod getMethod() {
<add> return this.method;
<add> }
<add>
<add> @Override
<add> public String getMethodValue() {
<add> return this.method.name();
<add> }
<add>
<add> @Override
<add> public URI getURI() {
<add> return this.uri;
<add> }
<add>
<add> @Override
<add> public RequestPath getPath() {
<add> return this.path;
<add> }
<add>
<add> @Override
<add> public HttpHeaders getHeaders() {
<add> return this.headers;
<add> }
<add>
<add> @Override
<add> public MultiValueMap<String, HttpCookie> getCookies() {
<add> return this.cookies;
<add> }
<add>
<add> @Override
<add> public MultiValueMap<String, String> getQueryParams() {
<add> return this.queryParams;
<add> }
<add>
<add> @Override
<add> public Flux<DataBuffer> getBody() {
<add> return this.body;
<add> }
<add> }
<add>
<add> private static class DelegatingServerWebExchange implements ServerWebExchange {
<add>
<add> private static final ResolvableType FORM_DATA_TYPE =
<add> ResolvableType.forClassWithGenerics(MultiValueMap.class, String.class, String.class);
<add>
<add> private static final ResolvableType MULTIPART_DATA_TYPE = ResolvableType.forClassWithGenerics(
<add> MultiValueMap.class, String.class, Part.class);
<add>
<add> private static final Mono<MultiValueMap<String, String>> EMPTY_FORM_DATA =
<add> Mono.just(CollectionUtils.unmodifiableMultiValueMap(new LinkedMultiValueMap<String, String>(0)))
<add> .cache();
<add>
<add> private static final Mono<MultiValueMap<String, Part>> EMPTY_MULTIPART_DATA =
<add> Mono.just(CollectionUtils.unmodifiableMultiValueMap(new LinkedMultiValueMap<String, Part>(0)))
<add> .cache();
<add>
<add> private final ServerHttpRequest request;
<add>
<add> private final ServerWebExchange delegate;
<add>
<add> private final Mono<MultiValueMap<String, String>> formDataMono;
<add>
<add> private final Mono<MultiValueMap<String, Part>> multipartDataMono;
<add>
<add> public DelegatingServerWebExchange(ServerHttpRequest request, ServerWebExchange delegate,
<add> List<HttpMessageReader<?>> messageReaders) {
<add> this.request = request;
<add> this.delegate = delegate;
<add> this.formDataMono = initFormData(request, messageReaders);
<add> this.multipartDataMono = initMultipartData(request, messageReaders);
<add> }
<add>
<add> @SuppressWarnings("unchecked")
<add> private static Mono<MultiValueMap<String, String>> initFormData(ServerHttpRequest request,
<add> List<HttpMessageReader<?>> readers) {
<add>
<add> try {
<add> MediaType contentType = request.getHeaders().getContentType();
<add> if (MediaType.APPLICATION_FORM_URLENCODED.isCompatibleWith(contentType)) {
<add> return ((HttpMessageReader<MultiValueMap<String, String>>) readers.stream()
<add> .filter(reader -> reader.canRead(FORM_DATA_TYPE, MediaType.APPLICATION_FORM_URLENCODED))
<add> .findFirst()
<add> .orElseThrow(() -> new IllegalStateException("No form data HttpMessageReader.")))
<add> .readMono(FORM_DATA_TYPE, request, Collections.emptyMap())
<add> .switchIfEmpty(EMPTY_FORM_DATA)
<add> .cache();
<add> }
<add> }
<add> catch (InvalidMediaTypeException ex) {
<add> // Ignore
<add> }
<add> return EMPTY_FORM_DATA;
<add> }
<add>
<add> @SuppressWarnings("unchecked")
<add> private static Mono<MultiValueMap<String, Part>> initMultipartData(ServerHttpRequest request,
<add> List<HttpMessageReader<?>> readers) {
<add>
<add> try {
<add> MediaType contentType = request.getHeaders().getContentType();
<add> if (MediaType.MULTIPART_FORM_DATA.isCompatibleWith(contentType)) {
<add> return ((HttpMessageReader<MultiValueMap<String, Part>>) readers.stream()
<add> .filter(reader -> reader.canRead(MULTIPART_DATA_TYPE, MediaType.MULTIPART_FORM_DATA))
<add> .findFirst()
<add> .orElseThrow(() -> new IllegalStateException("No multipart HttpMessageReader.")))
<add> .readMono(MULTIPART_DATA_TYPE, request, Collections.emptyMap())
<add> .switchIfEmpty(EMPTY_MULTIPART_DATA)
<add> .cache();
<add> }
<add> }
<add> catch (InvalidMediaTypeException ex) {
<add> // Ignore
<add> }
<add> return EMPTY_MULTIPART_DATA;
<add> }
<add> @Override
<add> public ServerHttpRequest getRequest() {
<add> return this.request;
<add> }
<add>
<add> @Override
<add> public Mono<MultiValueMap<String, String>> getFormData() {
<add> return this.formDataMono;
<add> }
<add>
<add> @Override
<add> public Mono<MultiValueMap<String, Part>> getMultipartData() {
<add> return this.multipartDataMono;
<add> }
<add>
<add> // Delegating methods
<add>
<add> @Override
<add> public ServerHttpResponse getResponse() {
<add> return this.delegate.getResponse();
<add> }
<add>
<add> @Override
<add> public Map<String, Object> getAttributes() {
<add> return this.delegate.getAttributes();
<add> }
<add>
<add> @Override
<add> public Mono<WebSession> getSession() {
<add> return this.delegate.getSession();
<add> }
<add>
<add> @Override
<add> public <T extends Principal> Mono<T> getPrincipal() {
<add> return this.delegate.getPrincipal();
<add> }
<add>
<add>
<add> @Override
<add> public LocaleContext getLocaleContext() {
<add> return this.delegate.getLocaleContext();
<add> }
<add>
<add> @Nullable
<add> @Override
<add> public ApplicationContext getApplicationContext() {
<add> return this.delegate.getApplicationContext();
<add> }
<add>
<add> @Override
<add> public boolean isNotModified() {
<add> return this.delegate.isNotModified();
<add> }
<add>
<add> @Override
<add> public boolean checkNotModified(Instant lastModified) {
<add> return this.delegate.checkNotModified(lastModified);
<add> }
<add>
<add> @Override
<add> public boolean checkNotModified(String etag) {
<add> return this.delegate.checkNotModified(etag);
<add> }
<add>
<add> @Override
<add> public boolean checkNotModified(@Nullable String etag, Instant lastModified) {
<add> return this.delegate.checkNotModified(etag, lastModified);
<add> }
<add>
<add> @Override
<add> public String transformUrl(String url) {
<add> return this.delegate.transformUrl(url);
<add> }
<add>
<add> @Override
<add> public void addUrlTransformer(Function<String, String> transformer) {
<add> this.delegate.addUrlTransformer(transformer);
<add> }
<add> }
<add>}
<ide><path>spring-webflux/src/main/java/org/springframework/web/reactive/function/server/RequestPredicates.java
<ide> import org.springframework.http.HttpCookie;
<ide> import org.springframework.http.HttpMethod;
<ide> import org.springframework.http.MediaType;
<add>import org.springframework.http.codec.HttpMessageReader;
<ide> import org.springframework.http.codec.multipart.Part;
<ide> import org.springframework.http.server.PathContainer;
<ide> import org.springframework.http.server.reactive.ServerHttpRequest;
<ide> import org.springframework.lang.Nullable;
<ide> import org.springframework.util.Assert;
<ide> import org.springframework.util.MultiValueMap;
<ide> import org.springframework.web.reactive.function.BodyExtractor;
<add>import org.springframework.web.server.ServerWebExchange;
<ide> import org.springframework.web.server.WebSession;
<ide> import org.springframework.web.util.UriBuilder;
<ide> import org.springframework.web.util.UriUtils;
<ide> public Optional<InetSocketAddress> remoteAddress() {
<ide> return this.request.remoteAddress();
<ide> }
<ide>
<add> @Override
<add> public List<HttpMessageReader<?>> messageReaders() {
<add> return this.request.messageReaders();
<add> }
<add>
<ide> @Override
<ide> public <T> T body(BodyExtractor<T, ? super ServerHttpRequest> extractor) {
<ide> return this.request.body(extractor);
<ide> public Mono<MultiValueMap<String, Part>> multipartData() {
<ide> return this.request.multipartData();
<ide> }
<ide>
<add> @Override
<add> public ServerWebExchange exchange() {
<add> return this.request.exchange();
<add> }
<add>
<ide> @Override
<ide> public String toString() {
<ide> return method() + " " + path();
<ide><path>spring-webflux/src/main/java/org/springframework/web/reactive/function/server/ServerRequest.java
<ide> import java.util.Map;
<ide> import java.util.Optional;
<ide> import java.util.OptionalLong;
<add>import java.util.function.Consumer;
<ide>
<ide> import reactor.core.publisher.Flux;
<ide> import reactor.core.publisher.Mono;
<ide>
<ide> import org.springframework.core.ParameterizedTypeReference;
<add>import org.springframework.core.io.buffer.DataBuffer;
<ide> import org.springframework.http.HttpCookie;
<ide> import org.springframework.http.HttpHeaders;
<ide> import org.springframework.http.HttpMethod;
<ide> import org.springframework.http.server.PathContainer;
<ide> import org.springframework.http.server.reactive.ServerHttpRequest;
<ide> import org.springframework.lang.Nullable;
<add>import org.springframework.util.Assert;
<ide> import org.springframework.util.CollectionUtils;
<ide> import org.springframework.util.MultiValueMap;
<ide> import org.springframework.web.reactive.function.BodyExtractor;
<ide> default PathContainer pathContainer() {
<ide> */
<ide> Optional<InetSocketAddress> remoteAddress();
<ide>
<add> /**
<add> * Return the readers used to convert the body of this request.
<add> */
<add> List<HttpMessageReader<?>> messageReaders();
<add>
<ide> /**
<ide> * Extract the body with the given {@code BodyExtractor}.
<ide> * @param extractor the {@code BodyExtractor} that reads from the request
<ide> default String pathVariable(String name) {
<ide> */
<ide> Mono<MultiValueMap<String, Part>> multipartData();
<ide>
<add> /**
<add> * Returns the web exchange that this request is based on. Manipulating the exchange directly,
<add> * instead of using the methods provided on {@code ServerRequest} and {@code ServerResponse},
<add> * can lead to irregular results.
<add> *
<add> * @return the web exchange
<add> */
<add> ServerWebExchange exchange();
<ide>
<add> // Static methods
<ide>
<ide> /**
<ide> * Create a new {@code ServerRequest} based on the given {@code ServerWebExchange} and
<ide> static ServerRequest create(ServerWebExchange exchange, List<HttpMessageReader<?
<ide> return new DefaultServerRequest(exchange, messageReaders);
<ide> }
<ide>
<add> /**
<add> * Create a builder with the status, headers, and cookies of the given request.
<add> * @param other the response to copy the status, headers, and cookies from
<add> * @return the created builder
<add> */
<add> static Builder from(ServerRequest other) {
<add> Assert.notNull(other, "'other' must not be null");
<add> return new DefaultServerRequestBuilder(other);
<add> }
<ide>
<ide> /**
<ide> * Represents the headers of the HTTP request.
<ide> interface Headers {
<ide> HttpHeaders asHttpHeaders();
<ide> }
<ide>
<add>
<add> /**
<add> * Defines a builder for a request.
<add> */
<add> interface Builder {
<add>
<add> /**
<add> * Set the method of the request.
<add> * @param method the new method
<add> * @return this builder
<add> */
<add> Builder method(HttpMethod method);
<add>
<add> /**
<add> * Set the uri of the request.
<add> * @param uri the new uri
<add> * @return this builder
<add> */
<add> Builder uri(URI uri);
<add>
<add> /**
<add> * Add the given header value(s) under the given name.
<add> * @param headerName the header name
<add> * @param headerValues the header value(s)
<add> * @return this builder
<add> * @see HttpHeaders#add(String, String)
<add> */
<add> Builder header(String headerName, String... headerValues);
<add>
<add> /**
<add> * Manipulate this request's headers with the given consumer. The
<add> * headers provided to the consumer are "live", so that the consumer can be used to
<add> * {@linkplain HttpHeaders#set(String, String) overwrite} existing header values,
<add> * {@linkplain HttpHeaders#remove(Object) remove} values, or use any of the other
<add> * {@link HttpHeaders} methods.
<add> * @param headersConsumer a function that consumes the {@code HttpHeaders}
<add> * @return this builder
<add> */
<add> Builder headers(Consumer<HttpHeaders> headersConsumer);
<add>
<add> /**
<add> * Add a cookie with the given name and value(s).
<add> * @param name the cookie name
<add> * @param values the cookie value(s)
<add> * @return this builder
<add> */
<add> Builder cookie(String name, String... values);
<add>
<add> /**
<add> * Manipulate this request's cookies with the given consumer. The
<add> * map provided to the consumer is "live", so that the consumer can be used to
<add> * {@linkplain MultiValueMap#set(Object, Object) overwrite} existing header values,
<add> * {@linkplain MultiValueMap#remove(Object) remove} values, or use any of the other
<add> * {@link MultiValueMap} methods.
<add> * @param cookiesConsumer a function that consumes the cookies map
<add> * @return this builder
<add> */
<add> Builder cookies(Consumer<MultiValueMap<String, HttpCookie>> cookiesConsumer);
<add>
<add> /**
<add> * Sets the body of the request. Calling this methods will
<add> * {@linkplain org.springframework.core.io.buffer.DataBufferUtils#release(DataBuffer) release}
<add> * the existing body of the builder.
<add> * @param body the new body.
<add> * @return this builder
<add> */
<add> Builder body(Flux<DataBuffer> body);
<add>
<add> /**
<add> * Sets the body of the request to the UTF-8 encoded bytes of the given string.
<add> * Calling this methods will
<add> * {@linkplain org.springframework.core.io.buffer.DataBufferUtils#release(DataBuffer) release}
<add> * the existing body of the builder.
<add> * @param body the new body.
<add> * @return this builder
<add> */
<add> Builder body(String body);
<add>
<add> /**
<add> * Adds an attribute with the given name and value.
<add> * @param name the attribute name
<add> * @param value the attribute value
<add> * @return this builder
<add> */
<add> Builder attribute(String name, Object value);
<add>
<add> /**
<add> * Manipulate this request's attributes with the given consumer. The map provided to the
<add> * consumer is "live", so that the consumer can be used to
<add> * {@linkplain Map#put(Object, Object) overwrite} existing header values,
<add> * {@linkplain Map#remove(Object) remove} values, or use any of the other
<add> * {@link Map} methods.
<add> * @param attributesConsumer a function that consumes the attributes map
<add> * @return this builder
<add> */
<add> Builder attributes(Consumer<Map<String, Object>> attributesConsumer);
<add>
<add> /**
<add> * Builds the request.
<add> * @return the built request
<add> */
<add> ServerRequest build();
<add> }
<add>
<ide> }
<ide><path>spring-webflux/src/main/java/org/springframework/web/reactive/function/server/support/ServerRequestWrapper.java
<ide> import org.springframework.http.HttpMethod;
<ide> import org.springframework.http.HttpRange;
<ide> import org.springframework.http.MediaType;
<add>import org.springframework.http.codec.HttpMessageReader;
<ide> import org.springframework.http.codec.multipart.Part;
<ide> import org.springframework.http.server.PathContainer;
<ide> import org.springframework.http.server.reactive.ServerHttpRequest;
<ide> import org.springframework.util.Assert;
<ide> import org.springframework.util.MultiValueMap;
<ide> import org.springframework.web.reactive.function.BodyExtractor;
<ide> import org.springframework.web.reactive.function.server.ServerRequest;
<add>import org.springframework.web.server.ServerWebExchange;
<ide> import org.springframework.web.server.WebSession;
<ide> import org.springframework.web.util.UriBuilder;
<ide>
<ide> public Optional<InetSocketAddress> remoteAddress() {
<ide> return this.delegate.remoteAddress();
<ide> }
<ide>
<add> @Override
<add> public List<HttpMessageReader<?>> messageReaders() {
<add> return this.delegate.messageReaders();
<add> }
<add>
<ide> @Override
<ide> public <T> T body(BodyExtractor<T, ? super ServerHttpRequest> extractor) {
<ide> return this.delegate.body(extractor);
<ide> public Mono<MultiValueMap<String, Part>> multipartData() {
<ide> return this.delegate.multipartData();
<ide> }
<ide>
<add> @Override
<add> public ServerWebExchange exchange() {
<add> return this.delegate.exchange();
<add> }
<ide>
<ide> /**
<ide> * Implementation of the {@code Headers} interface that can be subclassed
<ide><path>spring-webflux/src/test/java/org/springframework/web/reactive/function/server/DefaultServerRequestBuilderTests.java
<add>/*
<add> * Copyright 2002-2018 the original author or authors.
<add> *
<add> * Licensed under the Apache License, Version 2.0 (the "License");
<add> * you may not use this file except in compliance with the License.
<add> * You may obtain a copy of the License at
<add> *
<add> * http://www.apache.org/licenses/LICENSE-2.0
<add> *
<add> * Unless required by applicable law or agreed to in writing, software
<add> * distributed under the License is distributed on an "AS IS" BASIS,
<add> * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
<add> * See the License for the specific language governing permissions and
<add> * limitations under the License.
<add> */
<add>
<add>package org.springframework.web.reactive.function.server;
<add>
<add>import java.nio.charset.StandardCharsets;
<add>
<add>import org.junit.Before;
<add>import org.junit.Test;
<add>import reactor.core.publisher.Flux;
<add>import reactor.test.StepVerifier;
<add>
<add>import org.springframework.core.io.buffer.DataBuffer;
<add>import org.springframework.core.io.buffer.DataBufferFactory;
<add>import org.springframework.core.io.buffer.DefaultDataBufferFactory;
<add>import org.springframework.http.HttpMethod;
<add>import org.springframework.http.ResponseCookie;
<add>import org.springframework.mock.http.server.reactive.test.MockServerHttpRequest;
<add>import org.springframework.mock.web.test.server.MockServerWebExchange;
<add>
<add>import static org.junit.Assert.*;
<add>
<add>/**
<add> * @author Arjen Poutsma
<add> */
<add>public class DefaultServerRequestBuilderTests {
<add>
<add> private DataBufferFactory dataBufferFactory;
<add>
<add> @Before
<add> public void createBufferFactory() {
<add> this.dataBufferFactory = new DefaultDataBufferFactory();
<add> }
<add>
<add> @Test
<add> public void from() throws Exception {
<add>
<add> MockServerHttpRequest request = MockServerHttpRequest.post("http://example.com")
<add> .header("foo", "bar")
<add> .build();
<add> MockServerWebExchange exchange = MockServerWebExchange.from(request);
<add>
<add> ServerRequest other =
<add> ServerRequest.create(exchange, HandlerStrategies.withDefaults().messageReaders());
<add>
<add> Flux<DataBuffer> body = Flux.just("baz")
<add> .map(s -> s.getBytes(StandardCharsets.UTF_8))
<add> .map(dataBufferFactory::wrap);
<add>
<add> ServerRequest result = ServerRequest.from(other)
<add> .method(HttpMethod.HEAD)
<add> .headers(httpHeaders -> httpHeaders.set("foo", "baar"))
<add> .cookies(cookies -> cookies.set("baz", ResponseCookie.from("baz", "quux").build()))
<add> .body(body)
<add> .build();
<add>
<add> assertEquals(HttpMethod.HEAD, result.method());
<add> assertEquals(1, result.headers().asHttpHeaders().size());
<add> assertEquals("baar", result.headers().asHttpHeaders().getFirst("foo"));
<add> assertEquals(1, result.cookies().size());
<add> assertEquals("quux", result.cookies().getFirst("baz").getValue());
<add>
<add> StepVerifier.create(result.bodyToFlux(String.class))
<add> .expectNext("baz")
<add> .verifyComplete();
<add> }
<add>
<add>}
<ide>\ No newline at end of file
<ide><path>spring-webflux/src/test/java/org/springframework/web/reactive/function/server/MockServerRequest.java
<ide> import org.springframework.http.HttpRange;
<ide> import org.springframework.http.HttpRequest;
<ide> import org.springframework.http.MediaType;
<add>import org.springframework.http.codec.HttpMessageReader;
<ide> import org.springframework.http.codec.multipart.Part;
<ide> import org.springframework.http.server.PathContainer;
<ide> import org.springframework.http.server.RequestPath;
<ide> import org.springframework.util.LinkedMultiValueMap;
<ide> import org.springframework.util.MultiValueMap;
<ide> import org.springframework.web.reactive.function.BodyExtractor;
<add>import org.springframework.web.server.ServerWebExchange;
<ide> import org.springframework.web.server.WebSession;
<ide> import org.springframework.web.util.UriBuilder;
<ide> import org.springframework.web.util.UriComponentsBuilder;
<ide> public class MockServerRequest implements ServerRequest {
<ide> @Nullable
<ide> private final InetSocketAddress remoteAddress;
<ide>
<add> private final List<HttpMessageReader<?>> messageReaders;
<add>
<add> @Nullable
<add> private final ServerWebExchange exchange;
<add>
<ide>
<ide> private MockServerRequest(HttpMethod method, URI uri, String contextPath, MockHeaders headers,
<ide> MultiValueMap<String, HttpCookie> cookies, @Nullable Object body,
<ide> Map<String, Object> attributes, MultiValueMap<String, String> queryParams,
<ide> Map<String, String> pathVariables, @Nullable WebSession session, @Nullable Principal principal,
<del> @Nullable InetSocketAddress remoteAddress) {
<add> @Nullable InetSocketAddress remoteAddress, List<HttpMessageReader<?>> messageReaders,
<add> @Nullable ServerWebExchange exchange) {
<ide>
<ide> this.method = method;
<ide> this.uri = uri;
<ide> private MockServerRequest(HttpMethod method, URI uri, String contextPath, MockHe
<ide> this.session = session;
<ide> this.principal = principal;
<ide> this.remoteAddress = remoteAddress;
<add> this.messageReaders = messageReaders;
<add> this.exchange = exchange;
<ide> }
<ide>
<ide>
<ide> public Optional<InetSocketAddress> remoteAddress() {
<ide> return Optional.ofNullable(this.remoteAddress);
<ide> }
<ide>
<add> @Override
<add> public List<HttpMessageReader<?>> messageReaders() {
<add> return this.messageReaders;
<add> }
<add>
<ide> @Override
<ide> @SuppressWarnings("unchecked")
<ide> public <S> S body(BodyExtractor<S, ? super ServerHttpRequest> extractor) {
<ide> public Mono<MultiValueMap<String, Part>> multipartData() {
<ide> return (Mono<MultiValueMap<String, Part>>) this.body;
<ide> }
<ide>
<add> @Override
<add> public ServerWebExchange exchange() {
<add> Assert.state(this.exchange != null, "No exchange");
<add> return this.exchange;
<add> }
<add>
<ide> public static Builder builder() {
<ide> return new BuilderImpl();
<ide> }
<ide> public interface Builder {
<ide> Builder session(WebSession session);
<ide>
<ide> /**
<del> * @deprecated in favor of {@link #principal(Principal)}
<add> * @deprecated in favor of {@link #principal(Principal)}
<ide> */
<ide> @Deprecated
<ide> Builder session(Principal principal);
<ide> public interface Builder {
<ide>
<ide> Builder remoteAddress(InetSocketAddress remoteAddress);
<ide>
<add> Builder messageReaders(List<HttpMessageReader<?>> messageReaders);
<add>
<add> Builder exchange(ServerWebExchange exchange);
<add>
<ide> MockServerRequest body(Object body);
<ide>
<ide> MockServerRequest build();
<ide> private static class BuilderImpl implements Builder {
<ide> @Nullable
<ide> private InetSocketAddress remoteAddress;
<ide>
<add> private List<HttpMessageReader<?>> messageReaders = HandlerStrategies.withDefaults().messageReaders();
<add>
<add> @Nullable
<add> private ServerWebExchange exchange;
<add>
<ide> @Override
<ide> public Builder method(HttpMethod method) {
<ide> Assert.notNull(method, "'method' must not be null");
<ide> public Builder session(WebSession session) {
<ide> }
<ide>
<ide> @Override
<add> @Deprecated
<ide> public Builder session(Principal principal) {
<ide> return principal(principal);
<ide> }
<ide> public Builder remoteAddress(InetSocketAddress remoteAddress) {
<ide> return this;
<ide> }
<ide>
<add> @Override
<add> public Builder messageReaders(List<HttpMessageReader<?>> messageReaders) {
<add> Assert.notNull(messageReaders, "'messageReaders' must not be null");
<add> this.messageReaders = messageReaders;
<add> return this;
<add> }
<add>
<add> @Override
<add> public Builder exchange(ServerWebExchange exchange) {
<add> Assert.notNull(exchange, "'exchange' must not be null");
<add> this.exchange = exchange;
<add> return this;
<add> }
<add>
<ide> @Override
<ide> public MockServerRequest body(Object body) {
<ide> this.body = body;
<ide> return new MockServerRequest(this.method, this.uri, this.contextPath, this.headers,
<ide> this.cookies, this.body, this.attributes, this.queryParams, this.pathVariables,
<del> this.session, this.principal, this.remoteAddress);
<add> this.session, this.principal, this.remoteAddress, this.messageReaders,
<add> this.exchange);
<ide> }
<ide>
<ide> @Override
<ide> public MockServerRequest build() {
<ide> return new MockServerRequest(this.method, this.uri, this.contextPath, this.headers,
<ide> this.cookies, null, this.attributes, this.queryParams, this.pathVariables,
<del> this.session, this.principal, this.remoteAddress);
<add> this.session, this.principal, this.remoteAddress, this.messageReaders,
<add> this.exchange);
<ide> }
<ide> }
<ide> | 8 |
Ruby | Ruby | prevent string polymorphic route arguments | c4c21a9f8d7c9c8ca6570bdb82d64e2dc860e62c | <ide><path>actionpack/lib/action_dispatch/routing/polymorphic_routes.rb
<ide> def handle_list(list)
<ide>
<ide> args = []
<ide>
<del> route = record_list.map { |parent|
<add> route = record_list.map do |parent|
<ide> case parent
<del> when Symbol, String
<add> when Symbol
<ide> parent.to_s
<add> when String
<add> raise(ArgumentError, "Please use symbols for polymorphic route arguments.")
<ide> when Class
<ide> args << parent
<ide> parent.model_name.singular_route_key
<ide> else
<ide> args << parent.to_model
<ide> parent.to_model.model_name.singular_route_key
<ide> end
<del> }
<add> end
<ide>
<ide> route <<
<ide> case record
<del> when Symbol, String
<add> when Symbol
<ide> record.to_s
<add> when String
<add> raise(ArgumentError, "Please use symbols for polymorphic route arguments.")
<ide> when Class
<ide> @key_strategy.call record.model_name
<ide> else
<ide><path>actionpack/test/controller/redirect_test.rb
<ide> def redirect_to_nil
<ide> redirect_to nil
<ide> end
<ide>
<add> def redirect_to_polymorphic
<add> redirect_to [:internal, Workshop.new(5)]
<add> end
<add>
<add> def redirect_to_polymorphic_string_args
<add> redirect_to ["internal", Workshop.new(5)]
<add> end
<add>
<ide> def redirect_to_params
<ide> redirect_to ActionController::Parameters.new(status: 200, protocol: "javascript", f: "%0Aeval(name)")
<ide> end
<ide> def test_redirect_to_record
<ide> end
<ide> end
<ide>
<add> def test_polymorphic_redirect
<add> with_routing do |set|
<add> set.draw do
<add> namespace :internal do
<add> resources :workshops
<add> end
<add>
<add> ActiveSupport::Deprecation.silence do
<add> get ":controller/:action"
<add> end
<add> end
<add>
<add> get :redirect_to_polymorphic
<add> assert_equal "http://test.host/internal/workshops/5", redirect_to_url
<add> assert_redirected_to [:internal, Workshop.new(5)]
<add> end
<add> end
<add>
<add> def test_polymorphic_redirect_with_string_args
<add> with_routing do |set|
<add> set.draw do
<add> namespace :internal do
<add> resources :workshops
<add> end
<add>
<add> ActiveSupport::Deprecation.silence do
<add> get ":controller/:action"
<add> end
<add> end
<add>
<add> error = assert_raises(ArgumentError) do
<add> get :redirect_to_polymorphic_string_args
<add> end
<add> assert_equal("Please use symbols for polymorphic route arguments.", error.message)
<add> end
<add> end
<add>
<ide> def test_redirect_to_nil
<ide> error = assert_raise(ActionController::ActionControllerError) do
<ide> get :redirect_to_nil
<ide><path>actionview/test/activerecord/polymorphic_routes_test.rb
<ide> def test_with_array_containing_single_name
<ide> end
<ide> end
<ide>
<del> def test_with_array_containing_single_string_name
<del> with_test_routes do
<del> assert_url "http://example.com/projects", ["projects"]
<del> end
<del> end
<del>
<ide> def test_with_array_containing_symbols
<ide> with_test_routes do
<ide> assert_url "http://example.com/series/new", [:new, :series]
<ide> def test_nested_routing_to_a_model_delegate
<ide> end
<ide> end
<ide>
<add> def test_string_route_arguments
<add> with_admin_test_routes do
<add> error = assert_raises(ArgumentError) do
<add> polymorphic_url(["admin", @project])
<add> end
<add>
<add> assert_equal("Please use symbols for polymorphic route arguments.", error.message)
<add>
<add> error = assert_raises(ArgumentError) do
<add> polymorphic_url([@project, "bid"])
<add> end
<add>
<add> assert_equal("Please use symbols for polymorphic route arguments.", error.message)
<add> end
<add> end
<add>
<ide> def with_namespaced_routes(name)
<ide> with_routing do |set|
<ide> set.draw do | 3 |
Python | Python | fix missing `type` in identity test | 7c7ad152867928a3b4b6d5d5ff6c5e266360c6be | <ide><path>numpy/core/tests/test_nditer.py
<ide> class MyNDArray(np.ndarray):
<ide> [['readonly'], ['readonly'],
<ide> ['writeonly', 'allocate', 'no_subtype']])
<ide> assert_equal(type(b), type(i.operands[2]))
<del> assert_(type(a) is not (i.operands[2]))
<add> assert_(type(a) is not type(i.operands[2]))
<ide> assert_equal(i.operands[2].shape, (2, 2))
<ide>
<ide> def test_iter_allocate_output_errors(): | 1 |
Javascript | Javascript | reset tooltip when calling chart.update | 13e9676625723a4c6d4e8232b2fe3fa02421d38b | <ide><path>src/core/core.controller.js
<ide> module.exports = function(Chart) {
<ide>
<ide> me.updateDatasets();
<ide>
<add> // Need to reset tooltip in case it is displayed with elements that are removed
<add> // after update.
<add> me.tooltip.initialize();
<add>
<add> // Last active contains items that were previously in the tooltip.
<add> // When we reset the tooltip, we need to clear it
<add> me.lastActive = [];
<add>
<ide> // Do this before render so that any plugins that need final scale updates can use it
<ide> plugins.notify(me, 'afterUpdate');
<ide>
<ide><path>src/core/core.tooltip.js
<ide> module.exports = function(Chart) {
<ide> Chart.Tooltip = Element.extend({
<ide> initialize: function() {
<ide> this._model = getBaseModel(this._options);
<add> this._lastActive = [];
<ide> },
<ide>
<ide> // Get the title
<ide><path>test/specs/core.controller.tests.js
<ide> describe('Chart', function() {
<ide> expect(chart.tooltip._options).toEqual(jasmine.objectContaining(newTooltipConfig));
<ide> });
<ide>
<add> it ('should reset the tooltip on update', function() {
<add> var chart = acquireChart({
<add> type: 'line',
<add> data: {
<add> labels: ['A', 'B', 'C', 'D'],
<add> datasets: [{
<add> data: [10, 20, 30, 100]
<add> }]
<add> },
<add> options: {
<add> responsive: true,
<add> tooltip: {
<add> mode: 'nearest'
<add> }
<add> }
<add> });
<add>
<add> // Trigger an event over top of a point to
<add> // put an item into the tooltip
<add> var meta = chart.getDatasetMeta(0);
<add> var point = meta.data[1];
<add>
<add> var node = chart.canvas;
<add> var rect = node.getBoundingClientRect();
<add>
<add> var evt = new MouseEvent('mousemove', {
<add> view: window,
<add> bubbles: true,
<add> cancelable: true,
<add> clientX: rect.left + point._model.x,
<add> clientY: 0
<add> });
<add>
<add> // Manually trigger rather than having an async test
<add> node.dispatchEvent(evt);
<add>
<add> // Check and see if tooltip was displayed
<add> var tooltip = chart.tooltip;
<add>
<add> expect(chart.lastActive).toEqual([point]);
<add> expect(tooltip._lastActive).toEqual([]);
<add>
<add> // Update and confirm tooltip is reset
<add> chart.update();
<add> expect(chart.lastActive).toEqual([]);
<add> expect(tooltip._lastActive).toEqual([]);
<add> });
<add>
<ide> it ('should update the metadata', function() {
<ide> var cfg = {
<ide> data: { | 3 |
Go | Go | add satoshi nakamoto to names generator | 4bfd23b7ee5f053a4e45b4b016144690c683ce1e | <ide><path>pkg/namesgenerator/names-generator.go
<ide> var (
<ide> // Mildred Sanderson - American mathematician best known for Sanderson's theorem concerning modular invariants. https://en.wikipedia.org/wiki/Mildred_Sanderson
<ide> "sanderson",
<ide>
<add> // Satoshi Nakamoto is the name used by the unknown person or group of people who developed bitcoin, authored the bitcoin white paper, and created and deployed bitcoin's original reference implementation. https://en.wikipedia.org/wiki/Satoshi_Nakamoto
<add> "satoshi",
<add>
<ide> // Adi Shamir - Israeli cryptographer whose numerous inventions and contributions to cryptography include the Ferge Fiat Shamir identification scheme, the Rivest Shamir Adleman (RSA) public-key cryptosystem, the Shamir's secret sharing scheme, the breaking of the Merkle-Hellman cryptosystem, the TWINKLE and TWIRL factoring devices and the discovery of differential cryptanalysis (with Eli Biham). https://en.wikipedia.org/wiki/Adi_Shamir
<ide> "shamir",
<ide> | 1 |
PHP | PHP | ensure non empty locale when generating cache key | 201130ea158a0ba555121afe866171da0f0b535f | <ide><path>src/I18n/DateFormatTrait.php
<ide> public function i18nFormat($format = null, $timezone = null, $locale = null)
<ide> *
<ide> * @param \DateTime $date Date.
<ide> * @param string|int|array $format Format.
<del> * @param string $locale The locale name in which the date should be displayed.
<add> * @param string|null $locale The locale name in which the date should be displayed.
<ide> * @return string
<ide> */
<ide> protected function _formatObject($date, $format, $locale)
<ide> protected function _formatObject($date, $format, $locale)
<ide> $calendar = IntlDateFormatter::GREGORIAN;
<ide> }
<ide>
<add> if ($locale === null) {
<add> $locale = I18n::getLocale();
<add> }
<add>
<ide> $timezone = $date->getTimezone()->getName();
<ide> $key = "{$locale}.{$dateFormat}.{$timeFormat}.{$timezone}.{$calendar}.{$pattern}";
<ide>
<ide><path>tests/TestCase/I18n/TimeTest.php
<ide> public function testI18nFormat($class)
<ide> $this->assertTimeFormat($expected, $result);
<ide> }
<ide>
<add> /**
<add> * testI18nFormatUsingSystemLocale
<add> *
<add> * @return void
<add> */
<add> public function testI18nFormatUsingSystemLocale()
<add> {
<add> // Unset default locale for the Time class to ensure system's locale is used.
<add> Time::setDefaultLocale();
<add> $locale = I18n::getLocale();
<add>
<add> $time = new Time(1556864870);
<add> I18n::setLocale('ar');
<add> $this->assertEquals('٢٠١٩-٠٥-٠٣', $time->i18nFormat('yyyy-MM-dd'));
<add>
<add> I18n::setLocale('en');
<add> $this->assertEquals('2019-05-03', $time->i18nFormat('yyyy-MM-dd'));
<add>
<add> I18n::setLocale($locale);
<add> }
<add>
<ide> /**
<ide> * test formatting dates with offset style timezone
<ide> * | 2 |
Text | Text | remove references to 'source repository' | b143c05d64c4532b090d1f718ab93b4f7b1c466c | <ide><path>docs/reference/builder.md
<ide> parent = "mn_reference"
<ide>
<ide> # Dockerfile reference
<ide>
<del>**Docker can build images automatically** by reading the instructions
<del>from a `Dockerfile`. A `Dockerfile` is a text document that contains all
<del>the commands you would normally execute manually in order to build a
<del>Docker image. By calling `docker build` from your terminal, you can have
<del>Docker build your image step by step, executing the instructions
<del>successively.
<del>
<del>This page discusses the specifics of all the instructions you can use in your
<del>`Dockerfile`. To further help you write a clear, readable, maintainable
<del>`Dockerfile`, we've also written a [`Dockerfile` Best Practices
<del>guide](/articles/dockerfile_best-practices). Lastly, you can test your
<del>Dockerfile knowledge with the [Dockerfile tutorial](/userguide/level1).
<add>Docker can build images automatically by reading the instructions from a
<add>`Dockerfile`. A `Dockerfile` is a text document that contains all the commands a
<add>user could call on the command line to assemble an image. Using `docker build`
<add>users can create an automated build that executes several command-line
<add>instructions in succession.
<add>
<add>This page describes the commands you can use in a `Dockerfile`. When you are
<add>done reading this page, refer to the [`Dockerfile` Best
<add>Practices](/articles/dockerfile_best-practices) for a tip-oriented guide.
<ide>
<ide> ## Usage
<ide>
<del>To [*build*](/reference/commandline/build) an image from a source repository,
<del>create a description file called `Dockerfile` at the root of your repository.
<del>This file will describe the steps to assemble the image.
<add>The [`docker build`](/reference/commandline/build/) command builds an image from
<add>a `Dockerfile` and a *context*. The build's context is the files at a specified
<add>location `PATH` or `URL`. The `PATH` is a directory on your local filesystem.
<add>The `URL` is a the location of a Git repository.
<ide>
<del>Then call `docker build` with the path of your source repository as the argument
<del>(for example, `.`):
<add>A context is processed recursively. So, a `PATH` includes any subdirectories and
<add>the `URL` includes the repository and its submodules. A simple build command
<add>that uses the current directory as context:
<ide>
<ide> $ docker build .
<add> Sending build context to Docker daemon 6.51 MB
<add> ...
<add>
<add>The build is run by the Docker daemon, not by the CLI. The first thing a build
<add>process does is send the entire context (recursively) to the daemon. In most
<add>cases, it's best to start with an empty directory as context and keep your
<add>Dockerfile in that directory. Add only the files needed for building the
<add>Dockerfile.
<add>
<add>>**Warning**: Do not use your root directory, `/`, as the `PATH` as it causes
<add>>the build to transfer the entire contents of your hard drive to the Docker
<add>>daemon.
<add>
<add>To use a file in the build context, the `Dockerfile` refers to the file with
<add>an instruction, for example, a `COPY` instruction. To increase the build's
<add>performance, exclude files and directories by adding a `.dockerignore` file to
<add>the context directory. For information about how to [create a `.dockerignore`
<add>file](#dockerignore-file) see the documentation on this page.
<ide>
<del>The path to the source repository defines where to find the *context* of
<del>the build. The build is run by the Docker daemon, not by the CLI, so the
<del>whole context must be transferred to the daemon. The Docker CLI reports
<del>"Sending build context to Docker daemon" when the context is sent to the daemon.
<del>
<del>> **Warning**
<del>> Avoid using your root directory, `/`, as the root of the source repository. The
<del>> `docker build` command will use whatever directory contains the Dockerfile as the build
<del>> context (including all of its subdirectories). The build context will be sent to the
<del>> Docker daemon before building the image, which means if you use `/` as the source
<del>> repository, the entire contents of your hard drive will get sent to the daemon (and
<del>> thus to the machine running the daemon). You probably don't want that.
<del>
<del>In most cases, it's best to put each Dockerfile in an empty directory. Then,
<del>only add the files needed for building the Dockerfile to the directory. To
<del>increase the build's performance, you can exclude files and directories by
<del>adding a `.dockerignore` file to the directory. For information about how to
<del>[create a `.dockerignore` file](#dockerignore-file) on this page.
<add>Traditionally, the `Dockerfile` is called `Dockerfile` and located in the root
<add>of the context. You use the `-f` flag with `docker build` to point to a Dockerfile
<add>anywhere in your file system.
<ide>
<ide> You can specify a repository and tag at which to save the new image if
<ide> the build succeeds:
<ide> as well as:
<ide> > variable, even when combined with any of the instructions listed above.
<ide>
<ide> Environment variable substitution will use the same value for each variable
<del>throughout the entire command. In other words, in this example:
<add>throughout the entire command. In other words, in this example:
<ide>
<ide> ENV abc=hello
<ide> ENV abc=bye def=$abc
<ide> ENV ghi=$abc
<ide>
<del>will result in `def` having a value of `hello`, not `bye`. However,
<add>will result in `def` having a value of `hello`, not `bye`. However,
<ide> `ghi` will have a value of `bye` because it is not part of the same command
<ide> that set `abc` to `bye`.
<ide>
<ide> expansion) is done using Go's
<ide>
<ide> You can specify exceptions to exclusion rules. To do this, simply prefix a
<ide> pattern with an `!` (exclamation mark) in the same way you would in a
<del>`.gitignore` file. Currently there is no support for regular expressions.
<add>`.gitignore` file. Currently there is no support for regular expressions.
<ide> Formats like `[^temp*]` are ignored.
<ide>
<ide> The following is an example `.dockerignore` file:
<ide> commands using a base image that does not contain `/bin/sh`.
<ide>
<ide> The cache for `RUN` instructions isn't invalidated automatically during
<ide> the next build. The cache for an instruction like
<del>`RUN apt-get dist-upgrade -y` will be reused during the next build. The
<add>`RUN apt-get dist-upgrade -y` will be reused during the next build. The
<ide> cache for `RUN` instructions can be invalidated by using the `--no-cache`
<ide> flag, for example `docker build --no-cache`.
<ide>
<ide> The `VOLUME` instruction creates a mount point with the specified name
<ide> and marks it as holding externally mounted volumes from native host or other
<ide> containers. The value can be a JSON array, `VOLUME ["/var/log/"]`, or a plain
<ide> string with multiple arguments, such as `VOLUME /var/log` or `VOLUME /var/log
<del>/var/db`. For more information/examples and mounting instructions via the
<add>/var/db`. For more information/examples and mounting instructions via the
<ide> Docker client, refer to
<ide> [*Share Directories via Volumes*](/userguide/dockervolumes/#mount-a-host-directory-as-a-data-volume)
<ide> documentation. | 1 |
Text | Text | fix spelling errors and grammar issues | c4d2e8eef218677d44e542fdf1b41d6b6fe027b7 | <ide><path>guides/source/contributing_to_ruby_on_rails.md
<ide> Please don't put "feature request" items into GitHub Issues. If there's a new
<ide> feature that you want to see added to Ruby on Rails, you'll need to write the
<ide> code yourself - or convince someone else to partner with you to write the code.
<ide> Later in this guide you'll find detailed instructions for proposing a patch to
<del>Ruby on Rails. If you enter a wishlist item in GitHub Issues with no code, you
<add>Ruby on Rails. If you enter a wish list item in GitHub Issues with no code, you
<ide> can expect it to be marked "invalid" as soon as it's reviewed.
<ide>
<ide> Sometimes, the line between 'bug' and 'feature' is a hard one to draw.
<ide> In case you can't use the Rails development box, see section above, check [this
<ide>
<ide> ### Clone the Rails Repository ###
<ide>
<del>To do to be able to contribute code, you need to clone the Rails repository:
<add>To be able to contribute code, you need to clone the Rails repository:
<ide>
<ide> ```bash
<ide> $ git clone git://github.com/rails/rails.git
<ide> $ cd rails
<ide> $ bundle exec rake test
<ide> ```
<ide> #### Particular component of Rails
<del>To run tests only for particular component(ActionPack, ActiveRecord etc). For example, to run `ActionMailer` test do
<add>To run tests only for particular component(ActionPack, ActiveRecord, etc.). For
<add>example, to run `ActionMailer` tests you can:
<add>
<ide> ```bash
<ide> $ cd actionmailer
<ide> $ bundle exec rake test
<ide> $ ARCONN=sqlite3 ruby -Itest test/cases/associations/has_many_associations_test.
<ide>
<ide> You can invoke `test_jdbcmysql`, `test_jdbcsqlite3` or `test_jdbcpostgresql` also. See the file `activerecord/RUNNING_UNIT_TESTS.rdoc` for information on running more targeted database tests, or the file `ci/travis.rb` for the test suite run by the continuous integration server.
<ide>
<del>#### Single Test seprately
<del>to run just one test. for example, to run `LayoutMailerTest` you can do:
<add>#### Single Test separately
<add>to run just one test. For example, to run `LayoutMailerTest` you can:
<add>
<ide> ```bash
<ide> $ cd actionmailer
<ide> $ ruby -w -Ilib:test test/mail_layout_test.rb
<ide> Your name can be added directly after the last word if you don't provide any cod
<ide> You should not be the only person who looks at the code before you submit it.
<ide> If you know someone else who uses Rails, try asking them if they'll check out
<ide> your work. If you don't know anyone else using Rails, try hopping into the IRC
<del>room or posting about your idea to the rails-core mailing list. Doing this in
<del>private before you push a patch out publicly is the “smoke test” for a patch:
<del>if you can’t convince one other developer of the beauty of your code, you’re
<add>room or posting about your idea to the rails-core mailing list. Doing this in
<add>private before you push a patch out publicly is the "smoke test" for a patch:
<add>if you can't convince one other developer of the beauty of your code, you’re
<ide> unlikely to convince the core team either.
<ide>
<ide> ### Commit Your Changes ### | 1 |
Javascript | Javascript | fix loading of the font widths | 8aab1a7a7ba92573cce69d6bb60e6bbefac408a4 | <ide><path>src/evaluator.js
<ide> var PartialEvaluator = (function PartialEvaluatorClosure() {
<ide> if (widths) {
<ide> var start = 0, end = 0;
<ide> for (var i = 0, ii = widths.length; i < ii; i++) {
<del> var code = widths[i];
<add> var code = xref.fetchIfRef(widths[i]);
<ide> if (isArray(code)) {
<ide> for (var j = 0, jj = code.length; j < jj; j++)
<ide> glyphsWidths[start++] = code[j]; | 1 |
Text | Text | remove image from challenge | 96bed09af63edbd1baf1a1b96f81d4e8e6a6cb2d | <ide><path>curriculum/challenges/english/01-responsive-web-design/applied-visual-design/move-a-relatively-positioned-element-with-css-offsets.md
<ide> dashedName: move-a-relatively-positioned-element-with-css-offsets
<ide>
<ide> The CSS offsets of `top` or `bottom`, and `left` or `right` tell the browser how far to offset an item relative to where it would sit in the normal flow of the document. You're offsetting an element away from a given spot, which moves the element away from the referenced side (effectively, the opposite direction). As you saw in the last challenge, using the `top` offset moved the `h2` downwards. Likewise, using a `left` offset moves an item to the right.
<ide>
<del><img src='https://cdn-media-1.freecodecamp.org/imgr/eWWi3gZ.gif' alt=''>
<del>
<ide> # --instructions--
<ide>
<ide> Use CSS offsets to move the `h2` 15 pixels to the right and 10 pixels up. | 1 |
Python | Python | fix gelu test for torch 1.10 | 1e53faeb2ef7f3b6e68a4d10113cd889c95acc4f | <ide><path>tests/test_activations.py
<ide> class TestActivations(unittest.TestCase):
<ide> def test_gelu_versions(self):
<ide> x = torch.tensor([-100, -1, -0.1, 0, 0.1, 1.0, 100])
<ide> torch_builtin = get_activation("gelu")
<del> self.assertTrue(torch.eq(_gelu_python(x), torch_builtin(x)).all().item())
<del> self.assertFalse(torch.eq(_gelu_python(x), gelu_new(x)).all().item())
<add> self.assertTrue(torch.allclose(_gelu_python(x), torch_builtin(x)))
<add> self.assertFalse(torch.allclose(_gelu_python(x), gelu_new(x)))
<ide>
<ide> def test_get_activation(self):
<ide> get_activation("swish") | 1 |
Text | Text | add missing word in frameerror event docs | ad4d626bb9e2e8be93cd31b569048c7278ed5d35 | <ide><path>doc/api/http2.md
<ide> added: v8.4.0
<ide>
<ide> The `'frameError'` event is emitted when an error occurs while attempting to
<ide> send a frame on the session. If the frame that could not be sent is associated
<del>with a specific `Http2Stream`, an attempt to emit `'frameError'` event on the
<add>with a specific `Http2Stream`, an attempt to emit a `'frameError'` event on the
<ide> `Http2Stream` is made.
<ide>
<ide> If the `'frameError'` event is associated with a stream, the stream will be | 1 |
Text | Text | replace head of readme with updated text | 7ed09a36ec702c249b6e470194c20b118057e836 | <ide><path>README.md
<del>
<ide> Node.js
<del>=====
<add>=======
<ide>
<ide> [](https://gitter.im/nodejs/node?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
<ide>
<del>This repository began as a GitHub fork of
<del>[joyent/node](https://github.com/joyent/node).
<del>
<del>Node.js contributions, releases, and contributorship are under an
<del>[open governance model](./GOVERNANCE.md).
<del>We intend to land, with increasing regularity, releases which are
<del>compatible with the npm ecosystem that has been built to date for
<del>Node.js.
<add>The Node.js project is supported by the
<add>[Node.js Foundation](https://nodejs.org/en/foundation/). Contributions,
<add>policies and releases are managed under an
<add>[open governance model](./GOVERNANCE.md). We are also bound by a
<add>[Code of Conduct](./CODE_OF_CONDUCT.md).
<ide>
<del>We also have a Code of Conduct. [Please read it.](./CODE_OF_CONDUCT.md)
<add>If you need help using or installing Node.js, please use the
<add>[nodejs/help](https://github.com/nodejs/help) issue tracker.
<ide>
<ide> ## Download
<ide> | 1 |
Go | Go | extract loading options to a function | cd58d11b2ab10131b9ab8e835c39ffd6e53917e3 | <ide><path>volume/local/local.go
<ide> func New(scope string, rootIdentity idtools.Identity) (*Root, error) {
<ide> // unclean shutdown). This is a no-op on windows
<ide> unmount(v.path)
<ide>
<del> if b, err := os.ReadFile(filepath.Join(v.rootPath, "opts.json")); err == nil {
<del> opts := optsConfig{}
<del> if err := json.Unmarshal(b, &opts); err != nil {
<del> return nil, errors.Wrapf(err, "error while unmarshaling volume options for volume: %s", name)
<del> }
<del> // Make sure this isn't an empty optsConfig.
<del> // This could be empty due to buggy behavior in older versions of Docker.
<del> if !reflect.DeepEqual(opts, optsConfig{}) {
<del> v.opts = &opts
<del> }
<add> if err := v.loadOpts(); err != nil {
<add> return nil, err
<ide> }
<ide> r.volumes[name] = v
<ide> }
<ide> func (v *localVolume) Status() map[string]interface{} {
<ide> return nil
<ide> }
<ide>
<add>func (v *localVolume) loadOpts() error {
<add> b, err := os.ReadFile(filepath.Join(v.rootPath, "opts.json"))
<add> if err != nil {
<add> if !errors.Is(err, os.ErrNotExist) {
<add> logrus.WithError(err).Warnf("error while loading volume options for volume: %s", v.name)
<add> }
<add> return nil
<add> }
<add> opts := optsConfig{}
<add> if err := json.Unmarshal(b, &opts); err != nil {
<add> return errors.Wrapf(err, "error while unmarshaling volume options for volume: %s", v.name)
<add> }
<add> // Make sure this isn't an empty optsConfig.
<add> // This could be empty due to buggy behavior in older versions of Docker.
<add> if !reflect.DeepEqual(opts, optsConfig{}) {
<add> v.opts = &opts
<add> }
<add> return nil
<add>}
<add>
<ide> func (v *localVolume) saveOpts() error {
<ide> var b []byte
<ide> b, err := json.Marshal(v.opts) | 1 |
Java | Java | fix handling of required payload | 52c3f713bf0f467a43fa55c9be425447d371531b | <ide><path>spring-messaging/src/main/java/org/springframework/messaging/handler/annotation/support/MethodArgumentNotValidException.java
<ide> import org.springframework.validation.ObjectError;
<ide>
<ide> /**
<del> * Exception to be thrown when validation on an method parameter annotated with {@code @Valid} fails.
<add> * Exception to be thrown when a method argument is not valid. For instance, this
<add> * can be issued if a validation on a method parameter annotated with
<add> * {@code @Valid} fails.
<add> *
<ide> * @author Brian Clozel
<ide> * @since 4.0.1
<ide> */
<ide> @SuppressWarnings("serial")
<ide> public class MethodArgumentNotValidException extends MessagingException {
<ide>
<del> private final MethodParameter parameter;
<del>
<del> private final BindingResult bindingResult;
<del>
<add> /**
<add> * Create a new message with the given description.
<add> * @see #getMessage()
<add> */
<add> public MethodArgumentNotValidException(Message<?> message, String description) {
<add> super(message, description);
<add> }
<ide>
<del> public MethodArgumentNotValidException(Message<?> message, MethodParameter parameter, BindingResult bindingResult) {
<del> super(message);
<del> this.parameter = parameter;
<del> this.bindingResult = bindingResult;
<add> /**
<add> * Create a new instance with a failed validation described by
<add> * the given {@link BindingResult}.
<add> */
<add> public MethodArgumentNotValidException(Message<?> message,
<add> MethodParameter parameter, BindingResult bindingResult) {
<add> this(message, generateMessage(parameter, bindingResult));
<ide> }
<ide>
<del> @Override
<del> public String getMessage() {
<add> private static String generateMessage(MethodParameter parameter, BindingResult bindingResult) {
<ide> StringBuilder sb = new StringBuilder("Validation failed for parameter at index ")
<del> .append(this.parameter.getParameterIndex()).append(" in method: ")
<del> .append(this.parameter.getMethod().toGenericString())
<del> .append(", with ").append(this.bindingResult.getErrorCount()).append(" error(s): ");
<del> for (ObjectError error : this.bindingResult.getAllErrors()) {
<add> .append(parameter.getParameterIndex()).append(" in method: ")
<add> .append(parameter.getMethod().toGenericString())
<add> .append(", with ").append(bindingResult.getErrorCount()).append(" error(s): ");
<add> for (ObjectError error : bindingResult.getAllErrors()) {
<ide> sb.append("[").append(error).append("] ");
<ide> }
<ide> return sb.toString();
<ide><path>spring-messaging/src/main/java/org/springframework/messaging/handler/annotation/support/PayloadArgumentResolver.java
<ide> *
<ide> * @author Rossen Stoyanchev
<ide> * @author Brian Clozel
<add> * @author Stephane Nicoll
<ide> * @since 4.0
<ide> */
<ide> public class PayloadArgumentResolver implements HandlerMethodArgumentResolver {
<ide> public boolean supportsParameter(MethodParameter parameter) {
<ide>
<ide> @Override
<ide> public Object resolveArgument(MethodParameter parameter, Message<?> message) throws Exception {
<del>
<del> Class<?> sourceClass = message.getPayload().getClass();
<del> Class<?> targetClass = parameter.getParameterType();
<del>
<del> if (ClassUtils.isAssignable(targetClass,sourceClass)) {
<del> return message.getPayload();
<del> }
<del>
<ide> Payload annot = parameter.getParameterAnnotation(Payload.class);
<add> if ((annot != null) && StringUtils.hasText(annot.value())) {
<add> throw new IllegalStateException("@Payload SpEL expressions not supported by this resolver.");
<add> }
<ide>
<del> if (isEmptyPayload(message)) {
<del> if ((annot != null) && !annot.required()) {
<add> Object target = getTargetPayload(parameter, message);
<add> if (annot != null && isEmptyPayload(target)) {
<add> if (annot.required()) {
<add> throw new MethodArgumentNotValidException(message, createPayloadRequiredExceptionMessage(parameter, target));
<add> }
<add> else {
<ide> return null;
<ide> }
<ide> }
<ide>
<del> if ((annot != null) && StringUtils.hasText(annot.value())) {
<del> throw new IllegalStateException("@Payload SpEL expressions not supported by this resolver.");
<add> if (annot != null) { // Only validate @Payload
<add> validate(message, parameter, target);
<ide> }
<del>
<del> Object target = this.converter.fromMessage(message, targetClass);
<del> validate(message, parameter, target);
<del>
<ide> return target;
<ide> }
<ide>
<del> protected boolean isEmptyPayload(Message<?> message) {
<del> Object payload = message.getPayload();
<del> if (payload instanceof byte[]) {
<del> return ((byte[]) message.getPayload()).length == 0;
<add> /**
<add> * Return the target payload to handle for the specified message. Can either
<add> * be the payload itself if the parameter type supports it or the converted
<add> * one otherwise. While the payload of a {@link Message} cannot be null by
<add> * design, this method may return a {@code null} payload if the conversion
<add> * result is {@code null}.
<add> */
<add> protected Object getTargetPayload(MethodParameter parameter, Message<?> message) {
<add> Class<?> sourceClass = message.getPayload().getClass();
<add> Class<?> targetClass = parameter.getParameterType();
<add> if (ClassUtils.isAssignable(targetClass,sourceClass)) {
<add> return message.getPayload();
<add> }
<add> return this.converter.fromMessage(message, targetClass);
<add> }
<add>
<add> /**
<add> * Specify if the given {@code payload} is empty.
<add> * @param payload the payload to check (can be {@code null})
<add> */
<add> protected boolean isEmptyPayload(Object payload) {
<add> if (payload == null) {
<add> return true;
<add> }
<add> else if (payload instanceof byte[]) {
<add> return ((byte[]) payload).length == 0;
<ide> }
<ide> else if (payload instanceof String) {
<ide> return ((String) payload).trim().equals("");
<ide> else if (this.validator != null) {
<ide> }
<ide> }
<ide>
<add> private String createPayloadRequiredExceptionMessage(MethodParameter parameter, Object payload) {
<add> String name = parameter.getParameterName() != null
<add> ? parameter.getParameterName() : "arg" + parameter.getParameterIndex();
<add> StringBuilder sb = new StringBuilder("Payload parameter '").append(name)
<add> .append(" at index ").append(parameter.getParameterIndex()).append(" ");
<add> if (payload == null) {
<add> sb.append("could not be converted to '").append(parameter.getParameterType().getName())
<add> .append("' and is required");
<add> }
<add> else {
<add> sb.append("is required");
<add> }
<add> return sb.toString();
<add> }
<add>
<ide> }
<ide><path>spring-messaging/src/test/java/org/springframework/messaging/handler/annotation/support/PayloadArgumentResolverTests.java
<ide>
<ide> package org.springframework.messaging.handler.annotation.support;
<ide>
<add>import static org.junit.Assert.*;
<add>
<ide> import java.lang.reflect.Method;
<add>import java.util.Locale;
<ide>
<ide> import org.junit.Before;
<add>import org.junit.Rule;
<ide> import org.junit.Test;
<add>import org.junit.rules.ExpectedException;
<add>
<ide> import org.springframework.core.LocalVariableTableParameterNameDiscoverer;
<ide> import org.springframework.core.MethodParameter;
<ide> import org.springframework.messaging.Message;
<add>import org.springframework.messaging.converter.StringMessageConverter;
<ide> import org.springframework.messaging.handler.annotation.Payload;
<ide> import org.springframework.messaging.support.MessageBuilder;
<del>import org.springframework.messaging.converter.StringMessageConverter;
<del>import org.springframework.util.StringUtils;
<add>import org.springframework.util.Assert;
<ide> import org.springframework.validation.Errors;
<ide> import org.springframework.validation.Validator;
<ide> import org.springframework.validation.annotation.Validated;
<ide>
<del>import static org.junit.Assert.*;
<del>
<ide> /**
<ide> * Test fixture for {@link PayloadArgumentResolver}.
<ide> *
<ide> * @author Rossen Stoyanchev
<ide> * @author Brian Clozel
<add> * @author Stephane Nicoll
<ide> */
<ide> public class PayloadArgumentResolverTests {
<ide>
<add> @Rule
<add> public final ExpectedException thrown = ExpectedException.none();
<add>
<ide> private PayloadArgumentResolver resolver;
<ide>
<del> private MethodParameter param;
<del> private MethodParameter paramNotRequired;
<del> private MethodParameter paramWithSpelExpression;
<add> private Method payloadMethod;
<add> private Method simpleMethod;
<ide> private MethodParameter paramValidated;
<ide>
<del>
<ide> @Before
<ide> public void setup() throws Exception {
<del>
<ide> this.resolver = new PayloadArgumentResolver(new StringMessageConverter(), testValidator());
<ide>
<del> Method method = PayloadArgumentResolverTests.class.getDeclaredMethod("handleMessage",
<del> String.class, String.class, String.class, String.class);
<add> payloadMethod = PayloadArgumentResolverTests.class.getDeclaredMethod("handleMessage",
<add> String.class, String.class, Locale.class, String.class, String.class);
<add> simpleMethod = PayloadArgumentResolverTests.class.getDeclaredMethod("handleAnotherMessage",
<add> String.class, String.class);
<ide>
<del> this.param = new MethodParameter(method , 0);
<del> this.paramNotRequired = new MethodParameter(method , 1);
<del> this.paramWithSpelExpression = new MethodParameter(method , 2);
<del> this.paramValidated = new MethodParameter(method , 3);
<add> this.paramValidated = getMethodParameter(payloadMethod, 4);
<ide> this.paramValidated.initParameterNameDiscovery(new LocalVariableTableParameterNameDiscoverer());
<ide> }
<ide>
<ide>
<ide> @Test
<ide> public void resolveRequired() throws Exception {
<ide> Message<?> message = MessageBuilder.withPayload("ABC".getBytes()).build();
<del> Object actual = this.resolver.resolveArgument(this.param, message);
<add> Object actual = this.resolver.resolveArgument(getMethodParameter(payloadMethod, 0), message);
<ide>
<ide> assertEquals("ABC", actual);
<ide> }
<ide>
<add> @Test
<add> public void resolveRequiredEmpty() throws Exception {
<add> Message<?> message = MessageBuilder.withPayload("").build();
<add>
<add> thrown.expect(MethodArgumentNotValidException.class); // Required but empty
<add> this.resolver.resolveArgument(getMethodParameter(payloadMethod, 0), message);
<add> }
<add>
<ide> @Test
<ide> public void resolveNotRequired() throws Exception {
<add> MethodParameter paramNotRequired = getMethodParameter(payloadMethod, 1);
<ide>
<ide> Message<?> emptyByteArrayMessage = MessageBuilder.withPayload(new byte[0]).build();
<del> assertNull(this.resolver.resolveArgument(this.paramNotRequired, emptyByteArrayMessage));
<add> assertNull(this.resolver.resolveArgument(paramNotRequired, emptyByteArrayMessage));
<add>
<add> Message<?> emptyStringMessage = MessageBuilder.withPayload("").build();
<add> assertNull(this.resolver.resolveArgument(paramNotRequired, emptyStringMessage));
<ide>
<ide> Message<?> notEmptyMessage = MessageBuilder.withPayload("ABC".getBytes()).build();
<del> assertEquals("ABC", this.resolver.resolveArgument(this.paramNotRequired, notEmptyMessage));
<add> assertEquals("ABC", this.resolver.resolveArgument(paramNotRequired, notEmptyMessage));
<ide> }
<ide>
<del> @Test(expected=IllegalStateException.class)
<add> @Test
<add> public void resolveNonConvertibleParam() throws Exception {
<add> Message<?> notEmptyMessage = MessageBuilder.withPayload(123).build();
<add>
<add> // Could not convert from int to Locale so will be "empty" after conversion
<add> thrown.expect(MethodArgumentNotValidException.class);
<add> thrown.expectMessage(Locale.class.getName()); // reference to the type that could not be converted
<add> this.resolver.resolveArgument(getMethodParameter(payloadMethod, 2), notEmptyMessage);
<add> }
<add>
<add> @Test
<ide> public void resolveSpelExpressionNotSupported() throws Exception {
<ide> Message<?> message = MessageBuilder.withPayload("ABC".getBytes()).build();
<del> this.resolver.resolveArgument(this.paramWithSpelExpression, message);
<add>
<add> thrown.expect(IllegalStateException.class);
<add> this.resolver.resolveArgument(getMethodParameter(payloadMethod, 3), message);
<ide> }
<ide>
<ide> @Test
<ide> public void resolveValidation() throws Exception {
<ide> this.resolver.resolveArgument(this.paramValidated, message);
<ide> }
<ide>
<del> @Test(expected=MethodArgumentNotValidException.class)
<add> @Test
<ide> public void resolveFailValidation() throws Exception {
<del> Message<?> message = MessageBuilder.withPayload("".getBytes()).build();
<add> // See testValidator()
<add> Message<?> message = MessageBuilder.withPayload("invalidValue".getBytes()).build();
<add>
<add> thrown.expect(MethodArgumentNotValidException.class);
<ide> this.resolver.resolveArgument(this.paramValidated, message);
<ide> }
<ide>
<add> @Test
<add> public void resolveFailValidationNoConversionNecessary() throws Exception {
<add> Message<?> message = MessageBuilder.withPayload("invalidValue").build();
<add>
<add> thrown.expect(MethodArgumentNotValidException.class);
<add> this.resolver.resolveArgument(this.paramValidated, message);
<add> }
<add>
<add> @Test
<add> public void resolveNonAnnotatedParameter() throws Exception {
<add> MethodParameter paramNotRequired = getMethodParameter(simpleMethod, 0);
<add>
<add> Message<?> emptyByteArrayMessage = MessageBuilder.withPayload(new byte[0]).build();
<add> assertEquals("", this.resolver.resolveArgument(paramNotRequired, emptyByteArrayMessage));
<add>
<add> Message<?> emptyStringMessage = MessageBuilder.withPayload("").build();
<add> assertEquals("", this.resolver.resolveArgument(paramNotRequired, emptyStringMessage));
<add>
<add>
<add> Message<?> notEmptyMessage = MessageBuilder.withPayload("ABC".getBytes()).build();
<add> assertEquals("ABC", this.resolver.resolveArgument(paramNotRequired, notEmptyMessage));
<add> }
<add>
<add> @Test
<add> public void resolveNonAnnotatedParameterFailValidation() throws Exception {
<add> // See testValidator()
<add> Message<?> message = MessageBuilder.withPayload("invalidValue".getBytes()).build();
<add>
<add> assertEquals("invalidValue", this.resolver.resolveArgument(getMethodParameter(simpleMethod, 1), message));
<add> }
<add>
<ide> private Validator testValidator() {
<ide>
<ide> return new Validator() {
<ide> public boolean supports(Class<?> clazz) {
<ide> @Override
<ide> public void validate(Object target, Errors errors) {
<ide> String value = (String) target;
<del> if (StringUtils.isEmpty(value.toString())) {
<del> errors.reject("empty value");
<add> if ("invalidValue".equals(value)) {
<add> errors.reject("invalid value");
<ide> }
<ide> }
<ide> };
<ide> }
<ide>
<add> private MethodParameter getMethodParameter(Method method, int index) {
<add> Assert.notNull(method, "Method must be set");
<add> return new MethodParameter(method, index);
<add> }
<add>
<ide> @SuppressWarnings("unused")
<ide> private void handleMessage(
<ide> @Payload String param,
<ide> @Payload(required=false) String paramNotRequired,
<add> @Payload(required=true) Locale nonConvertibleRequiredParam,
<ide> @Payload("foo.bar") String paramWithSpelExpression,
<ide> @Validated @Payload String validParam) {
<ide> }
<ide>
<add> @SuppressWarnings("unused")
<add> private void handleAnotherMessage(
<add> String param,
<add> @Validated String validParam) {
<add> }
<add>
<ide> }
<ide><path>spring-messaging/src/test/java/org/springframework/messaging/simp/annotation/support/SimpAnnotationMethodMessageHandlerTests.java
<ide> import org.springframework.messaging.simp.annotation.SubscribeMapping;
<ide> import org.springframework.messaging.support.MessageBuilder;
<ide> import org.springframework.stereotype.Controller;
<del>import org.springframework.util.StringUtils;
<ide> import org.springframework.validation.Errors;
<ide> import org.springframework.validation.Validator;
<ide> import org.springframework.validation.annotation.Validated;
<ide> */
<ide> public class SimpAnnotationMethodMessageHandlerTests {
<ide>
<add> private static final String TEST_INVALID_VALUE = "invalidValue";
<add>
<ide> private TestSimpAnnotationMethodMessageHandler messageHandler;
<ide>
<ide> private TestController testController;
<ide> public void setup() {
<ide>
<ide> this.messageHandler = new TestSimpAnnotationMethodMessageHandler(brokerTemplate, channel, channel);
<ide> this.messageHandler.setApplicationContext(new StaticApplicationContext());
<del> this.messageHandler.setValidator(new StringNotEmptyValidator());
<add> this.messageHandler.setValidator(new StringTestValidator(TEST_INVALID_VALUE));
<ide> this.messageHandler.afterPropertiesSet();
<ide>
<ide> testController = new TestController();
<ide> public void simpleBinding() {
<ide> public void validationError() {
<ide> SimpMessageHeaderAccessor headers = SimpMessageHeaderAccessor.create();
<ide> headers.setDestination("/pre/validation/payload");
<del> Message<?> message = MessageBuilder.withPayload(new byte[0]).setHeaders(headers).build();
<add> Message<?> message = MessageBuilder.withPayload(TEST_INVALID_VALUE.getBytes()).setHeaders(headers).build();
<ide> this.messageHandler.handleMessage(message);
<ide> assertEquals("handleValidationException", this.testController.method);
<ide> }
<ide> public void handleValidationException() {
<ide> }
<ide> }
<ide>
<del> private static class StringNotEmptyValidator implements Validator {
<add> private static class StringTestValidator implements Validator {
<add>
<add> private final String invalidValue;
<add>
<add> private StringTestValidator(String invalidValue) {
<add> this.invalidValue = invalidValue;
<add> }
<add>
<ide> @Override
<ide> public boolean supports(Class<?> clazz) {
<ide> return String.class.isAssignableFrom(clazz);
<ide> }
<ide> @Override
<ide> public void validate(Object target, Errors errors) {
<ide> String value = (String) target;
<del> if (StringUtils.isEmpty(value.toString())) {
<del> errors.reject("empty value");
<add> if (invalidValue.equals(value)) {
<add> errors.reject("invalid value '"+invalidValue+"'");
<ide> }
<ide> }
<ide> } | 4 |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.