content_type
stringclasses
8 values
main_lang
stringclasses
7 values
message
stringlengths
1
50
sha
stringlengths
40
40
patch
stringlengths
52
962k
file_count
int64
1
300
Ruby
Ruby
implement fails_with for non-apple compilers
ef1d9c0cd04c21b5b19cae17e83bbdc6ef28d712
<ide><path>Library/Homebrew/compilers.rb <ide> class Compiler < Struct.new(:name, :priority) <ide> def build <ide> MacOS.send("#{name}_build_version") <ide> end <add> <add> def version <add> MacOS.non_apple_gcc_version(name) if name.is_a? String <add> end <ide> end <ide> <ide> class CompilerFailure <del> attr_reader :compiler <add> attr_reader :compiler, :version <ide> attr_rw :build, :cause <ide> <ide> def initialize compiler, &block <del> @compiler = compiler <add> # Non-Apple compilers are in the format fails_with compiler => version <add> if compiler.is_a? Hash <add> # currently the only compiler for this case is GCC <add> _, @version = compiler.shift <add> @compiler = 'gcc-' + @version.match(/(\d\.\d)/)[0] <add> else <add> @compiler = compiler <add> end <add> <ide> instance_eval(&block) if block_given? <del> @build = (@build || 9999).to_i <add> @build = (@build || 9999).to_i unless compiler.is_a? Hash <ide> end <ide> end <ide> <ide> def initialize(f) <ide> @compilers << Compiler.new(cc, priority_for(cc)) <ide> end <ide> end <add> <add> # non-Apple GCC 4.x <add> SharedEnvExtension::GNU_GCC_VERSIONS.each do |v| <add> unless MacOS.non_apple_gcc_version("gcc-4.#{v}").nil? <add> # priority is based on version, with newest preferred first <add> @compilers << Compiler.new("gcc-4.#{v}", 1.0 + v/10.0) <add> end <add> end <ide> end <ide> <ide> # Attempts to select an appropriate alternate compiler, but <ide> def compiler <ide> def priority_for(cc) <ide> case cc <ide> when :clang then MacOS.clang_build_version >= 318 ? 3 : 0.5 <del> when :llvm then 2 <del> when :gcc then 1 <add> when :gcc then 2 <add> when :llvm then 1 <ide> when :gcc_4_0 then 0.25 <add> # non-Apple gcc compilers <add> else 1.5 <ide> end <ide> end <ide> end <ide><path>Library/Homebrew/extend/ENV/std.rb <ide> def gcc <ide> end <ide> alias_method :gcc_4_2, :gcc <ide> <add> GNU_GCC_VERSIONS.each do |n| <add> define_method(:"gcc-4.#{n}") do <add> gcc = "gcc-4.#{n}" <add> self.cc = self['OBJC'] = gcc <add> self.cxx = self['OBJCXX'] = gcc.gsub('c', '+') <add> set_cpu_cflags <add> @compiler = gcc <add> end <add> end <add> <ide> def llvm <ide> self.cc = MacOS.locate("llvm-gcc") <ide> self.cxx = MacOS.locate("llvm-g++") <ide><path>Library/Homebrew/extend/ENV/super.rb <ide> def clang <ide> self.cc = self['HOMEBREW_CC'] = "clang" <ide> self.cxx = "clang++" <ide> end <add> GNU_GCC_VERSIONS.each do |n| <add> define_method(:"gcc-4.#{n}") do <add> gcc = "gcc-4.#{n}" <add> self.cc = self['HOMEBREW_CC'] = gcc <add> self.cxx = gcc.gsub('c', '+') <add> end <add> end <ide> def make_jobs <ide> self['MAKEFLAGS'] =~ /-\w*j(\d)+/ <ide> [$1.to_i, 1].max <ide><path>Library/Homebrew/formula.rb <ide> def keg_only_reason <ide> def fails_with? cc <ide> cc = Compiler.new(cc) unless cc.is_a? Compiler <ide> (self.class.cc_failures || []).any? do |failure| <del> failure.compiler == cc.name && failure.build >= cc.build <add> if cc.version <add> # non-Apple GCCs don't have builds, just version numbers <add> failure.compiler == cc.name && failure.version >= cc.version <add> else <add> failure.compiler == cc.name && failure.build >= cc.build <add> end <ide> end <ide> end <ide> <ide><path>Library/Homebrew/macos.rb <ide> def clang_build_version <ide> end <ide> end <ide> <add> def non_apple_gcc_version(cc) <add> return unless path = locate(cc) <add> <add> ivar = "@#{cc.gsub(/(-|\.)/, '')}_version" <add> return instance_variable_get(ivar) if instance_variable_defined?(ivar) <add> <add> `#{path} --version` =~ /gcc-\d.\d \(GCC\) (\d\.\d\.\d)/ <add> instance_variable_set(ivar, $1) <add> end <add> <ide> # See these issues for some history: <ide> # http://github.com/mxcl/homebrew/issues/#issue/13 <ide> # http://github.com/mxcl/homebrew/issues/#issue/41 <ide><path>Library/Homebrew/test/test_compiler_selector.rb <ide> def setup <ide> MacOS.stubs(:gcc_build_version).returns(5666) <ide> MacOS.stubs(:llvm_build_version).returns(2336) <ide> MacOS.stubs(:clang_build_version).returns(425) <add> # Yes, this is ugly - we only want one GCC version to be available. <add> MacOS.send(:alias_method, :old_non_apple_gcc_version, :non_apple_gcc_version) <add> MacOS.send(:define_method, :non_apple_gcc_version) do |name| <add> if name == 'gcc-4.8' <add> '4.8.1' <add> else <add> nil <add> end <add> end <ide> @f = Double.new <ide> @cc = :clang <ide> end <ide> <add> def teardown <add> MacOS.send(:alias_method, :non_apple_gcc_version, :old_non_apple_gcc_version) <add> end <add> <ide> def actual_cc <ide> CompilerSelector.new(@f).compiler <ide> end <ide> <ide> def test_all_compiler_failures <del> @f << :clang << :llvm << :gcc <add> @f << :clang << :llvm << :gcc << 'gcc-4.8' <ide> assert_raise(CompilerSelectionError) { actual_cc } <ide> end <ide> <ide> def test_no_compiler_failures <ide> <ide> def test_fails_with_clang <ide> @f << :clang <del> assert_equal :llvm, actual_cc <add> assert_equal :gcc, actual_cc <ide> end <ide> <ide> def test_fails_with_llvm <ide> def test_fails_with_gcc <ide> assert_equal :clang, actual_cc <ide> end <ide> <add> def test_fails_with_non_apple_gcc <add> @f << "gcc-4.8" <add> assert_equal :clang, actual_cc <add> end <add> <ide> def test_mixed_failures_1 <ide> @f << :clang << :llvm <ide> assert_equal :gcc, actual_cc <ide> end <ide> <ide> def test_mixed_failures_2 <del> @f << :gcc << :clang <add> @f << :gcc << :clang << 'gcc-4.8' <ide> assert_equal :llvm, actual_cc <ide> end <ide> <ide> def test_mixed_failures_3 <ide> assert_equal :clang, actual_cc <ide> end <ide> <add> def test_mixed_failures_4 <add> @f << :clang << "gcc-4.8" <add> assert_equal :gcc, actual_cc <add> end <add> <ide> def test_older_clang_precedence <ide> MacOS.stubs(:clang_build_version).returns(211) <del> @f << :gcc <add> @f << :gcc << 'gcc-4.8' <ide> assert_equal :llvm, actual_cc <ide> end <ide> <add> def test_non_apple_gcc_precedence <add> @f << :clang << :gcc <add> assert_equal 'gcc-4.8', actual_cc <add> end <add> <ide> def test_missing_gcc <ide> MacOS.stubs(:gcc_build_version).returns(nil) <del> @f << :clang << :llvm <add> @f << :clang << :llvm << 'gcc-4.8' <ide> assert_raise(CompilerSelectionError) { actual_cc } <ide> end <ide> <ide> def test_missing_llvm_and_gcc <ide> MacOS.stubs(:gcc_build_version).returns(nil) <ide> MacOS.stubs(:llvm_build_version).returns(nil) <del> @f << :clang <add> @f << :clang << 'gcc-4.8' <ide> assert_raise(CompilerSelectionError) { actual_cc } <ide> end <ide> end <ide><path>Library/Homebrew/test/test_fails_with.rb <ide> <ide> class FailsWithTests < Test::Unit::TestCase <ide> class Double < Compiler <del> attr_accessor :name, :build <add> attr_accessor :name, :build, :version <ide> end <ide> <ide> def assert_fails_with(cc) <ide> def fails_with(*args, &block) <ide> @f.send(:fails_with, *args, &block) <ide> end <ide> <del> def build_cc(sym, build) <add> def build_cc(sym, build, version=nil) <ide> cc = Double.new <ide> cc.name = sym <ide> cc.build = build <add> cc.version = version <ide> cc <ide> end <ide> <ide> def test_fails_with_block_without_build <ide> assert_fails_with cc <ide> end <ide> <add> def test_non_apple_gcc_version <add> fails_with(:gcc => '4.8.2') <add> cc = build_cc("gcc-4.8", nil, "4.8.1") <add> assert_fails_with cc <add> end <add> <ide> def test_multiple_failures <ide> fails_with(:llvm) <ide> fails_with(:clang)
7
Python
Python
replace erroneous num_classes with batch_size
6d95e7ceb77b94be104750c1e8d60197aa2dfebe
<ide><path>examples/mnist_tfrecord.py <ide> def cnn_layers(x_train_input): <ide> <ide> loss, acc = test_model.evaluate(x_test, <ide> keras.utils.to_categorical(y_test), <del> num_classes) <add> batch_size=batch_size) <ide> print('\nTest accuracy: {0}'.format(acc))
1
Javascript
Javascript
increase coverage for http2.connect
aa24777c444d8d2ad4a48b3952856139f0c62c14
<ide><path>test/parallel/test-http2-connect.js <ide> // Flags: --expose-http2 <ide> 'use strict'; <ide> <del>const { mustCall, hasCrypto, skip } = require('../common'); <add>const { mustCall, hasCrypto, skip, expectsError } = require('../common'); <ide> if (!hasCrypto) <ide> skip('missing crypto'); <del>const { doesNotThrow } = require('assert'); <add>const { doesNotThrow, throws } = require('assert'); <ide> const { createServer, connect } = require('http2'); <add>{ <add> const server = createServer(); <add> server.listen(0, mustCall(() => { <add> const authority = `http://localhost:${server.address().port}`; <add> const options = {}; <add> const listener = () => mustCall(); <ide> <del>const server = createServer(); <del>server.listen(0, mustCall(() => { <del> const authority = `http://localhost:${server.address().port}`; <del> const options = {}; <del> const listener = () => mustCall(); <add> const clients = new Set(); <add> doesNotThrow(() => clients.add(connect(authority))); <add> doesNotThrow(() => clients.add(connect(authority, options))); <add> doesNotThrow(() => clients.add(connect(authority, options, listener()))); <add> doesNotThrow(() => clients.add(connect(authority, listener()))); <ide> <del> const clients = new Set(); <del> doesNotThrow(() => clients.add(connect(authority))); <del> doesNotThrow(() => clients.add(connect(authority, options))); <del> doesNotThrow(() => clients.add(connect(authority, options, listener()))); <del> doesNotThrow(() => clients.add(connect(authority, listener()))); <add> for (const client of clients) { <add> client.once('connect', mustCall((headers) => { <add> client.destroy(); <add> clients.delete(client); <add> if (clients.size === 0) { <add> server.close(); <add> } <add> })); <add> } <add> })); <add>} <ide> <del> for (const client of clients) { <del> client.once('connect', mustCall((headers) => { <del> client.destroy(); <del> clients.delete(client); <del> if (clients.size === 0) { <del> server.close(); <del> } <del> })); <del> } <del>})); <add>// check for https as protocol <add>{ <add> const authority = 'https://localhost'; <add> doesNotThrow(() => connect(authority)); <add>} <add> <add>// check for error for an invalid protocol (not http or https) <add>{ <add> const authority = 'ssh://localhost'; <add> throws(() => { <add> connect(authority); <add> }, expectsError({ <add> code: 'ERR_HTTP2_UNSUPPORTED_PROTOCOL', <add> type: Error <add> })); <add>}
1
Text
Text
fix issue number from becoming markdown header
634f2238422fc1ea48f2f812ecd678fed159ccbc
<ide><path>activerecord/CHANGELOG.md <ide> of `Article.category(true)` where `category` is a singular <ide> association. <ide> <del> The force reloading of the association reader was deprecated in <del> #20888. Unfortunately the suggested alternative of <add> The force reloading of the association reader was deprecated <add> in #20888. Unfortunately the suggested alternative of <ide> `article.reload.category` does not expose the same behavior. <ide> <ide> This patch adds a reader method with the prefix `reload_` for
1
Python
Python
test the exception conditions
7ebe2b9593725dd1ca431bab98e7f4307d976768
<ide><path>neural_network/perceptron.py <ide> def __init__(self, sample, target, learning_rate=0.01, epoch_number=1000, bias=- <ide> :param learning_rate: learning rate used in optimizing. <ide> :param epoch_number: number of epochs to train network on. <ide> :param bias: bias value for the network. <add> <add> >>> p = Perceptron([], (0, 1, 2)) <add> Traceback (most recent call last): <add> ... <add> ValueError: Sample data can not be empty <add> >>> p = Perceptron(([0], 1, 2), []) <add> Traceback (most recent call last): <add> ... <add> ValueError: Target data can not be empty <add> >>> p = Perceptron(([0], 1, 2), (0, 1)) <add> Traceback (most recent call last): <add> ... <add> ValueError: Sample data and Target data do not have matching lengths <ide> """ <ide> self.sample = sample <ide> if len(self.sample) == 0: <del> raise AttributeError("Sample data can not be empty") <add> raise ValueError("Sample data can not be empty") <ide> self.target = target <ide> if len(self.target) == 0: <del> raise AttributeError("Target data can not be empty") <add> raise ValueError("Target data can not be empty") <ide> if len(self.sample) != len(self.target): <del> raise AttributeError( <del> "Sample data and Target data do not have matching lengths" <del> ) <add> raise ValueError("Sample data and Target data do not have matching lengths") <ide> self.learning_rate = learning_rate <ide> self.epoch_number = epoch_number <ide> self.bias = bias <ide> def sort(self, sample) -> None: <ide> classification: P... <ide> """ <ide> if len(self.sample) == 0: <del> raise AttributeError("Sample data can not be empty") <add> raise ValueError("Sample data can not be empty") <ide> sample.insert(0, self.bias) <ide> u = 0 <ide> for i in range(self.col_sample + 1):
1
Javascript
Javascript
fix current streak,
576315abdc74cee1d63435ce1c389f5b830819b8
<ide><path>server/boot/user.js <ide> var _ = require('lodash'), <ide> debug = require('debug')('freecc:cntr:userController'); <ide> <ide> <add>const daysBetween = 1.5; <add> <ide> function calcCurrentStreak(cals) { <ide> const revCals = cals.slice().reverse(); <ide> let streakBroken = false; <del> return revCals <add> const lastDayInStreak = revCals <ide> .reduce((current, cal, index) => { <del> // if streak not borken and diff between this cal and the call after it <del> // is equal to zero <del> // moment.diff will return the days between rounded down <add> const before = revCals[index === 0 ? 0 : index - 1]; <ide> if ( <ide> !streakBroken && <del> moment(revCals[index === 0 ? 0 : index - 1]).diff(cal, 'days') === 0 <add> moment(before).diff(cal, 'days', true) < daysBetween <ide> ) { <del> return current + 1; <add> return index; <ide> } <del> return 1; <del> }, 1); <add> return current; <add> }, 0); <add> <add> const lastTimestamp = revCals[lastDayInStreak]; <add> return Math.ceil(moment().diff(lastTimestamp, 'days', true)); <add>} <add> <add>// TODO(berks): calc longest streak <add>/* <add>function longestStreak(cals) { <ide> } <add>*/ <ide> <ide> module.exports = function(app) { <ide> var router = app.loopback.Router(); <ide> module.exports = function(app) { <ide> objOrNum : <ide> objOrNum.timestamp; <ide> }) <del> .map(time => { <del> return moment(time).format('YYYY-MM-DD'); <del> }); <add> .sort(); <ide> <ide> user.currentStreak = calcCurrentStreak(cals); <ide> <ide> module.exports = function(app) { <ide> objOrNum : <ide> objOrNum.timestamp; <ide> }) <add> .filter((timestamp) => { <add> return !!timestamp; <add> }) <ide> .reduce((data, timeStamp) => { <ide> data[(timeStamp / 1000)] = 1; <ide> return data;
1
Go
Go
remove execsupport check
7204341950c6c8f0a66f9bb0b082217dc0ce6ddb
<ide><path>integration-cli/docker_api_exec_test.go <del>// +build !test_no_exec <del> <ide> package main <ide> <ide> import ( <ide><path>integration-cli/docker_cli_exec_test.go <del>// +build !test_no_exec <del> <ide> package main <ide> <ide> import ( <ide><path>integration-cli/docker_cli_exec_unix_test.go <del>// +build !windows,!test_no_exec <add>// +build !windows <ide> <ide> package main <ide> <ide><path>integration-cli/docker_cli_links_test.go <ide> func (s *DockerSuite) TestLinksNotStartedParentNotFail(c *check.C) { <ide> <ide> func (s *DockerSuite) TestLinksHostsFilesInject(c *check.C) { <ide> testRequires(c, DaemonIsLinux) <del> testRequires(c, testEnv.IsLocalDaemon, ExecSupport) <add> testRequires(c, testEnv.IsLocalDaemon) <ide> <ide> out, _ := dockerCmd(c, "run", "-itd", "--name", "one", "busybox", "top") <ide> idOne := strings.TrimSpace(out) <ide> func (s *DockerSuite) TestLinksHostsFilesInject(c *check.C) { <ide> <ide> func (s *DockerSuite) TestLinksUpdateOnRestart(c *check.C) { <ide> testRequires(c, DaemonIsLinux) <del> testRequires(c, testEnv.IsLocalDaemon, ExecSupport) <add> testRequires(c, testEnv.IsLocalDaemon) <ide> dockerCmd(c, "run", "-d", "--name", "one", "busybox", "top") <ide> out, _ := dockerCmd(c, "run", "-d", "--name", "two", "--link", "one:onetwo", "--link", "one:one", "busybox", "top") <ide> id := strings.TrimSpace(string(out)) <ide><path>integration-cli/docker_cli_network_unix_test.go <ide> func (s *DockerNetworkSuite) TestDockerPluginV2NetworkDriver(c *check.C) { <ide> } <ide> <ide> func (s *DockerDaemonSuite) TestDockerNetworkNoDiscoveryDefaultBridgeNetwork(c *check.C) { <del> testRequires(c, ExecSupport) <ide> // On default bridge network built-in service discovery should not happen <ide> hostsFile := "/etc/hosts" <ide> bridgeName := "external-bridge" <ide> func (s *DockerDaemonSuite) TestDockerNetworkNoDiscoveryDefaultBridgeNetwork(c * <ide> } <ide> <ide> func (s *DockerNetworkSuite) TestDockerNetworkAnonymousEndpoint(c *check.C) { <del> testRequires(c, ExecSupport, NotArm) <add> testRequires(c, NotArm) <ide> hostsFile := "/etc/hosts" <ide> cstmBridgeNw := "custom-bridge-nw" <ide> cstmBridgeNw1 := "custom-bridge-nw1" <ide><path>integration-cli/docker_cli_run_test.go <ide> func (s *DockerSuite) TestRunLoopbackWhenNetworkDisabled(c *check.C) { <ide> <ide> func (s *DockerSuite) TestRunModeNetContainerHostname(c *check.C) { <ide> // Windows does not support --net=container <del> testRequires(c, DaemonIsLinux, ExecSupport) <add> testRequires(c, DaemonIsLinux) <ide> <ide> dockerCmd(c, "run", "-i", "-d", "--name", "parent", "busybox", "top") <ide> out, _ := dockerCmd(c, "exec", "parent", "cat", "/etc/hostname") <ide><path>integration-cli/requirements_test.go <ide> func UnixCli() bool { <ide> return isUnixCli <ide> } <ide> <del>func ExecSupport() bool { <del> return supportsExec <del>} <del> <ide> func Network() bool { <ide> // Set a timeout on the GET at 15s <ide> var timeout = time.Duration(15 * time.Second) <ide><path>integration-cli/test_vars_exec_test.go <del>// +build !test_no_exec <del> <del>package main <del> <del>const ( <del> // indicates docker daemon tested supports 'docker exec' <del> supportsExec = true <del>) <ide><path>integration-cli/test_vars_noexec_test.go <del>// +build test_no_exec <del> <del>package main <del> <del>const ( <del> // indicates docker daemon tested supports 'docker exec' <del> supportsExec = false <del>)
9
Mixed
Go
remove the option for the command service rm
1016cbb64243ca8adc9444779e6e4717a4541ef7
<ide><path>api/client/service/remove.go <ide> import ( <ide> func newRemoveCommand(dockerCli *client.DockerCli) *cobra.Command { <ide> <ide> cmd := &cobra.Command{ <del> Use: "rm [OPTIONS] SERVICE [SERVICE...]", <add> Use: "rm SERVICE [SERVICE...]", <ide> Aliases: []string{"remove"}, <ide> Short: "Remove one or more services", <ide> Args: cli.RequiresMinArgs(1), <ide><path>docs/reference/commandline/service_rm.md <ide> parent = "smn_cli" <ide> # service rm <ide> <ide> ```Markdown <del>Usage: docker service rm [OPTIONS] SERVICE [SERVICE...] <add>Usage: docker service rm SERVICE [SERVICE...] <ide> <ide> Remove one or more services <ide>
2
PHP
PHP
restore previous behavior
c956a531f2668903a72f95e315f9759711af109c
<ide><path>src/Illuminate/Routing/UrlGenerator.php <ide> public function previous() <ide> { <ide> $referrer = $this->request->headers->get('referer'); <ide> <del> return $referrer ? $this->to($referrer) : $this->getPreviousUrlFromSession(); <add> $url = $referrer ? $this->to($referrer) : $this->getPreviousUrlFromSession(); <add> <add> return $url ?: $this->to('/'); <ide> } <ide> <ide> /**
1
Javascript
Javascript
add test for timer
40b98c4d7bb7e86900c43691cf1892468ce32b50
<ide><path>d3.js <ide> function d3_transition(groups) { <ide> delay[++k] = delayMin; <ide> }); <ide> } <del> d3_timer(step, delayMin); <add> d3.timer(step, delayMin); <ide> return transition; <ide> }; <ide> <ide> var d3_timer_queue = null, <ide> d3_timer_timeout; // is a timeout active? <ide> <ide> // The timer will continue to fire until callback returns true. <del>d3.timer = function(callback) { <del> d3_timer(callback, 0); <del>}; <del> <del>function d3_timer(callback, delay) { <add>d3.timer = function(callback, delay) { <ide> var now = Date.now(), <ide> found = false, <ide> t0, <ide> t1 = d3_timer_queue; <ide> <del> if (!isFinite(delay)) return; <add> if (arguments.length < 2) delay = 0; <add> else if (!isFinite(delay)) return; <ide> <ide> // See if the callback's already in the queue. <ide> while (t1) { <ide> function d3_timer_step() { <ide> <ide> while (t1) { <ide> elapsed = now - t1.then; <del> if (elapsed > t1.delay) t1.flush = t1.callback(elapsed); <add> if (elapsed >= t1.delay) t1.flush = t1.callback(elapsed); <ide> t1 = t1.next; <ide> } <ide> <ide><path>d3.min.js <del>(function(){function ct(){return"circle"}function cs(){return 64}function cr(a,b){var c=(a.ownerSVGElement||a).createSVGPoint();if(cq<0&&(window.scrollX||window.scrollY)){var d=d3.select(document.body).append("svg:svg").style("position","absolute").style("top",0).style("left",0),e=d[0][0].getScreenCTM();cq=!e.f&&!e.e,d.remove()}cq?(c.x=b.pageX,c.y=b.pageY):(c.x=b.clientX,c.y=b.clientY),c=c.matrixTransform(a.getScreenCTM().inverse());return[c.x,c.y]}function cp(a){return function(){var b=a.apply(this,arguments),c=b[0],d=b[1]+bB;return[c*Math.cos(d),c*Math.sin(d)]}}function co(a){return[a.x,a.y]}function cn(a){return a.endAngle}function cm(a){return a.startAngle}function cl(a){return a.radius}function ck(a){return a.target}function cj(a){return a.source}function ci(a){return function(b,c){return a[c][1]}}function ch(a){return function(b,c){return a[c][0]}}function cg(a){function i(f){if(f.length<1)return null;var i=bI(this,f,b,d),j=bI(this,f,b===c?ch(i):c,d===e?ci(i):e);return"M"+g(a(j),h)+"L"+g(a(i.reverse()),h)+"Z"}var b=bJ,c=bJ,d=0,e=bK,f="linear",g=bL[f],h=.7;i.x=function(a){if(!arguments.length)return c;b=c=a;return i},i.x0=function(a){if(!arguments.length)return b;b=a;return i},i.x1=function(a){if(!arguments.length)return c;c=a;return i},i.y=function(a){if(!arguments.length)return e;d=e=a;return i},i.y0=function(a){if(!arguments.length)return d;d=a;return i},i.y1=function(a){if(!arguments.length)return e;e=a;return i},i.interpolate=function(a){if(!arguments.length)return f;g=bL[f=a];return i},i.tension=function(a){if(!arguments.length)return h;h=a;return i};return i}function cf(a){var b,c=-1,d=a.length,e,f;while(++c<d)b=a[c],e=b[0],f=b[1]+bB,b[0]=e*Math.cos(f),b[1]=e*Math.sin(f);return a}function ce(a){return a.length<3?bM(a):a[0]+bS(a,cd(a))}function cd(a){var b=[],c,d,e,f,g=cc(a),h=-1,i=a.length-1;while(++h<i)c=cb(a[h],a[h+1]),Math.abs(c)<1e-6?g[h]=g[h+1]=0:(d=g[h]/c,e=g[h+1]/c,f=d*d+e*e,f>9&&(f=c*3/Math.sqrt(f),g[h]=f*d,g[h+1]=f*e));h=-1;while(++h<=i)f=(a[Math.min(i,h+1)][0]-a[Math.max(0,h-1)][0])/(6*(1+g[h]*g[h])),b.push([f||0,g[h]*f||0]);return b}function cc(a){var b=0,c=a.length-1,d=[],e=a[0],f=a[1],g=d[0]=cb(e,f);while(++b<c)d[b]=g+(g=cb(e=f,f=a[b+1]));d[b]=g;return d}function cb(a,b){return(b[1]-a[1])/(b[0]-a[0])}function ca(a,b,c){a.push("C",bY(bZ,b),",",bY(bZ,c),",",bY(b$,b),",",bY(b$,c),",",bY(b_,b),",",bY(b_,c))}function bY(a,b){return a[0]*b[0]+a[1]*b[1]+a[2]*b[2]+a[3]*b[3]}function bX(a,b){var c=a.length-1,d=a[0][0],e=a[0][1],f=a[c][0]-d,g=a[c][1]-e,h=-1,i,j;while(++h<=c)i=a[h],j=h/c,i[0]=b*i[0]+(1-b)*(d+j*f),i[1]=b*i[1]+(1-b)*(e+j*g);return bU(a)}function bW(a){var b,c=-1,d=a.length,e=d+4,f,g=[],h=[];while(++c<4)f=a[c%d],g.push(f[0]),h.push(f[1]);b=[bY(b_,g),",",bY(b_,h)],--c;while(++c<e)f=a[c%d],g.shift(),g.push(f[0]),h.shift(),h.push(f[1]),ca(b,g,h);return b.join("")}function bV(a){if(a.length<4)return bM(a);var b=[],c=-1,d=a.length,e,f=[0],g=[0];while(++c<3)e=a[c],f.push(e[0]),g.push(e[1]);b.push(bY(b_,f)+","+bY(b_,g)),--c;while(++c<d)e=a[c],f.shift(),f.push(e[0]),g.shift(),g.push(e[1]),ca(b,f,g);return b.join("")}function bU(a){if(a.length<3)return bM(a);var b=[],c=1,d=a.length,e=a[0],f=e[0],g=e[1],h=[f,f,f,(e=a[1])[0]],i=[g,g,g,e[1]];b.push(f,",",g),ca(b,h,i);while(++c<d)e=a[c],h.shift(),h.push(e[0]),i.shift(),i.push(e[1]),ca(b,h,i);c=-1;while(++c<2)h.shift(),h.push(e[0]),i.shift(),i.push(e[1]),ca(b,h,i);return b.join("")}function bT(a,b){var c=[],d=(1-b)/2,e,f=a[0],g=a[1],h=1,i=a.length;while(++h<i)e=f,f=g,g=a[h],c.push([d*(g[0]-e[0]),d*(g[1]-e[1])]);return c}function bS(a,b){if(b.length<1||a.length!=b.length&&a.length!=b.length+2)return bM(a);var c=a.length!=b.length,d="",e=a[0],f=a[1],g=b[0],h=g,i=1;c&&(d+="Q"+(f[0]-g[0]*2/3)+","+(f[1]-g[1]*2/3)+","+f[0]+","+f[1],e=a[1],i=2);if(b.length>1){h=b[1],f=a[i],i++,d+="C"+(e[0]+g[0])+","+(e[1]+g[1])+","+(f[0]-h[0])+","+(f[1]-h[1])+","+f[0]+","+f[1];for(var j=2;j<b.length;j++,i++)f=a[i],h=b[j],d+="S"+(f[0]-h[0])+","+(f[1]-h[1])+","+f[0]+","+f[1]}if(c){var k=a[i];d+="Q"+(f[0]+h[0]*2/3)+","+(f[1]+h[1]*2/3)+","+k[0]+","+k[1]}return d}function bR(a,b,c){return a.length<3?bM(a):a[0]+bS(a,bT(a,b))}function bQ(a,b){return a.length<3?bM(a):a[0]+bS((a.push(a[0]),a),bT([a[a.length-2]].concat(a,[a[1]]),b))}function bP(a,b){return a.length<4?bM(a):a[1]+bS(a.slice(1,a.length-1),bT(a,b))}function bO(a){var b=[],c=0,d=a.length,e=a[0];b.push(e[0],",",e[1]);while(++c<d)b.push("H",(e=a[c])[0],"V",e[1]);return b.join("")}function bN(a){var b=[],c=0,d=a.length,e=a[0];b.push(e[0],",",e[1]);while(++c<d)b.push("V",(e=a[c])[1],"H",e[0]);return b.join("")}function bM(a){var b=[],c=0,d=a.length,e=a[0];b.push(e[0],",",e[1]);while(++c<d)b.push("L",(e=a[c])[0],",",e[1]);return b.join("")}function bK(a){return a[1]}function bJ(a){return a[0]}function bI(a,b,c,d){var e=[],f=-1,g=b.length,h=typeof c=="function",i=typeof d=="function",j;if(h&&i)while(++f<g)e.push([c.call(a,j=b[f],f),d.call(a,j,f)]);else if(h)while(++f<g)e.push([c.call(a,b[f],f),d]);else if(i)while(++f<g)e.push([c,d.call(a,b[f],f)]);else while(++f<g)e.push([c,d]);return e}function bH(a){function g(d){return d.length<1?null:"M"+e(a(bI(this,d,b,c)),f)}var b=bJ,c=bK,d="linear",e=bL[d],f=.7;g.x=function(a){if(!arguments.length)return b;b=a;return g},g.y=function(a){if(!arguments.length)return c;c=a;return g},g.interpolate=function(a){if(!arguments.length)return d;e=bL[d=a];return g},g.tension=function(a){if(!arguments.length)return f;f=a;return g};return g}function bG(a){return a.endAngle}function bF(a){return a.startAngle}function bE(a){return a.outerRadius}function bD(a){return a.innerRadius}function bw(a){return function(b){return b<0?-Math.pow(-b,a):Math.pow(b,a)}}function bv(a){return a.toPrecision(1)}function bu(a){return-Math.log(-a)/Math.LN10}function bt(a){return Math.log(a)/Math.LN10}function bs(a,b,c,d){var e=[],f=[],g=0,h=a.length;while(++g<h)e.push(c(a[g-1],a[g])),f.push(d(b[g-1],b[g]));return function(b){var c=d3.bisect(a,b,1,a.length-1)-1;return f[c](e[c](b))}}function br(a,b,c,d){var e=c(a[0],a[1]),f=d(b[0],b[1]);return function(a){return f(e(a))}}function bq(a,b){return d3.format(",."+Math.max(0,-Math.floor(Math.log(bo(a,b)[2])/Math.LN10+.01))+"f")}function bp(a,b){return d3.range.apply(d3,bo(a,b))}function bo(a,b){var c=bj(a),d=c[1]-c[0],e=Math.pow(10,Math.floor(Math.log(d/b)/Math.LN10)),f=b/d*e;f<=.15?e*=10:f<=.35?e*=5:f<=.75&&(e*=2),c[0]=Math.ceil(c[0]/e)*e,c[1]=Math.floor(c[1]/e)*e+e*.5,c[2]=e;return c}function bn(a){a=Math.pow(10,Math.round(Math.log(a)/Math.LN10)-1);return{floor:function(b){return Math.floor(b/a)*a},ceil:function(b){return Math.ceil(b/a)*a}}}function bm(a,b){a.range=d3.rebind(a,b.range),a.rangeRound=d3.rebind(a,b.rangeRound),a.interpolate=d3.rebind(a,b.interpolate),a.clamp=d3.rebind(a,b.clamp);return a}function bl(){return Math}function bk(a,b){var c=0,d=a.length-1,e=a[c],f=a[d],g;f<e&&(g=c,c=d,d=g,g=e,e=f,f=g),b=b(f-e),a[c]=b.floor(e),a[d]=b.ceil(f);return a}function bj(a){var b=a[0],c=a[a.length-1];return b<c?[b,c]:[c,b]}function bi(){}function bg(){var a=null,b=bb,c=Infinity;while(b)b.flush?b=a?a.next=b.next:bb=b.next:(c=Math.min(c,b.then+b.delay),b=(a=b).next);return c}function bf(){var a,b=Date.now(),c=bb;while(c)a=b-c.then,a>c.delay&&(c.flush=c.callback(a)),c=c.next;var d=bg()-b;d>24?(isFinite(d)&&(clearTimeout(bd),bd=setTimeout(bf,d)),bc=0):(bc=1,bh(bf))}function be(a,b){var c=Date.now(),d=!1,e,f=bb;if(!!isFinite(b)){while(f){if(f.callback===a){f.then=c,f.delay=b,d=!0;break}e=f,f=f.next}d||(bb={callback:a,then:c,delay:b,next:bb}),bc||(bd=clearTimeout(bd),bc=1,bh(bf))}}function ba(a){return typeof a=="function"?function(b,c,d){var e=a.call(this,b,c)+"";return d!=e&&d3.interpolate(d,e)}:(a=a+"",function(b,c,d){return d!=a&&d3.interpolate(d,a)})}function _(a){function n(b){var h=!0,l=-1;a.each(function(){if(i[++l]!==2){var a=(b-j[l])/k[l],n=this.__transition__,o,p,q=e[l];if(a<1){h=!1;if(a<0)return}else a=1;if(i[l]){if(!n||n.active!==c){i[l]=2;return}}else{if(!n||n.active>c){i[l]=2;return}i[l]=1,g.start.dispatch.apply(this,arguments),q=e[l]={},n.active=c;for(p in d)if(o=d[p].apply(this,arguments))q[p]=o}o=m(a);for(p in q)q[p].call(this,o);if(a===1){i[l]=2;if(n.active===c){var r=n.owner;r===c&&(delete this.__transition__,f&&this.parentNode&&this.parentNode.removeChild(this)),$=c,g.end.dispatch.apply(this,arguments),$=0,n.owner=r}}}});return h}var b={},c=$||++Z,d={},e=[],f=!1,g=d3.dispatch("start","end"),i=[],j=[],k=[],l,m=d3.ease("cubic-in-out");a.each(function(){(this.__transition__||(this.__transition__={})).owner=c}),b.delay=function(c){var d=Infinity,e=-1;typeof c=="function"?a.each(function(a,b){var f=j[++e]=+c.apply(this,arguments);f<d&&(d=f)}):(d=+c,a.each(function(a,b){j[++e]=d})),be(n,d);return b},b.duration=function(c){var d=-1;typeof c=="function"?(l=0,a.each(function(a,b){var e=k[++d]=+c.apply(this,arguments);e>l&&(l=e)})):(l=+c,a.each(function(a,b){k[++d]=l}));return b},b.ease=function(a){m=typeof a=="function"?a:d3.ease.apply(d3,arguments);return b},b.attrTween=function(a,c){function f(b,d){var e=c.call(this,b,d,this.getAttributeNS(a.space,a.local));return e&&function(b){this.setAttributeNS(a.space,a.local,e(b))}}function e(b,d){var e=c.call(this,b,d,this.getAttribute(a));return e&&function(b){this.setAttribute(a,e(b))}}d["attr."+a]=a.local?f:e;return b},b.attr=function(a,c){return b.attrTween(a,ba(c))},b.styleTween=function(a,c,e){function f(b,d){var f=c.call(this,b,d,window.getComputedStyle(this,null).getPropertyValue(a));return f&&function(b){this.style.setProperty(a,f(b),e)}}arguments.length<3&&(e=null),d["style."+a]=f;return b},b.style=function(a,c,d){arguments.length<3&&(d=null);return b.styleTween(a,ba(c),d)},b.text=function(a){d.text=function(b,c){this.textContent=typeof a=="function"?a.call(this,b,c):a};return b},b.select=function(b){var c,d=_(a.select(b)).ease(m);c=-1,d.delay(function(a,b){return j[++c]}),c=-1,d.duration(function(a,b){return k[++c]});return d},b.selectAll=function(b){var c,d=_(a.selectAll(b)).ease(m);c=-1,d.delay(function(a,b){return j[b?c:++c]}),c=-1,d.duration(function(a,b){return k[b?c:++c]});return d},b.remove=function(){f=!0;return b},b.each=function(a,c){g[a].add(c);return b},b.call=h;return b.delay(0).duration(250)}function Y(a){return{__data__:a}}function X(a){arguments.length||(a=d3.ascending);return function(b,c){return a(b&&b.__data__,c&&c.__data__)}}function W(a){function b(b){var c=[],d,e,f,g;for(var h=0,i=a.length;h<i;h++){f=a[h],c.push(d=[]),d.parentNode=f.parentNode;for(var j=0,k=f.length;j<k;j++)(g=f[j])?(d.push(e=b(f.parentNode)),e.__data__=g.__data__):d.push(null)}return V(c)}a.append=function(a){function d(b){return b.appendChild(document.createElementNS(a.space,a.local))}function c(b){return b.appendChild(document.createElement(a))}a=d3.ns.qualify(a);return b(a.local?d:c)},a.insert=function(a,c){function e(b){return b.insertBefore(document.createElementNS(a.space,a.local),S(c,b))}function d(b){return b.insertBefore(document.createElement(a),S(c,b))}a=d3.ns.qualify(a);return b(a.local?e:d)};return a}function V(a){function d(b){for(var c=0,d=a.length;c<d;c++){var e=a[c];for(var f=0,g=e.length;f<g;f++){var h=e[f];if(h)return b.call(h,h.__data__,f)}}return null}function c(b){var c=[],d,e,f;for(var g=0,h=a.length;g<h;g++){e=a[g];for(var i=0,j=e.length;i<j;i++)if(f=e[i])c.push(d=b(f)),d.parentNode=f}return V(c)}function b(b){var c=[],d,e,f,g;for(var h=0,i=a.length;h<i;h++){f=a[h],c.push(d=[]),d.parentNode=f.parentNode;for(var j=0,k=f.length;j<k;j++)(g=f[j])?(d.push(e=b(g)),e&&"__data__"in g&&(e.__data__=g.__data__)):d.push(null)}return V(c)}a.select=function(a){return b(function(b){return S(a,b)})},a.selectAll=function(a){return c(function(b){return T(a,b)})},a.filter=function(b){var c=[],d,e,f;for(var g=0,h=a.length;g<h;g++){e=a[g],c.push(d=[]),d.parentNode=e.parentNode;for(var i=0,j=e.length;i<j;i++)(f=e[i])&&b.call(f,f.__data__,i)&&d.push(f)}return V(c)},a.map=function(b){var c,d;for(var e=0,f=a.length;e<f;e++){c=a[e];for(var g=0,h=c.length;g<h;g++)if(d=c[g])d.__data__=b.call(d,d.__data__,g)}return a},a.data=function(b,c){function g(a,b){var g=0,h=a.length,i=b.length,j=Math.min(h,i),k=Math.max(h,i),l=[],m=[],n=[],o,p;if(c){var q={},r=[],s,t=b.length;for(g=0;g<h;g++)s=c.call(o=a[g],o.__data__,g),s in q?n[t++]=o:q[s]=o,r.push(s);for(g=0;g<i;g++)o=q[s=c.call(b,p=b[g],g)],o?(o.__data__=p,l[g]=o,m[g]=n[g]=null):(m[g]=Y(p),l[g]=n[g]=null),delete q[s];for(g=0;g<h;g++)r[g]in q&&(n[g]=a[g])}else{for(;g<j;g++)o=a[g],p=b[g],o?(o.__data__=p,l[g]=o,m[g]=n[g]=null):(m[g]=Y(p),l[g]=n[g]=null);for(;g<i;g++)m[g]=Y(b[g]),l[g]=n[g]=null;for(;g<k;g++)n[g]=a[g],m[g]=l[g]=null}m.parentNode=l.parentNode=n.parentNode=a.parentNode,d.push(m),e.push(l),f.push(n)}var d=[],e=[],f=[],h=-1,i=a.length,j;if(typeof b=="function")while(++h<i)g(j=a[h],b.call(j,j.parentNode.__data__,h));else while(++h<i)g(j=a[h],b);var k=V(e);k.enter=function(){return W(d)},k.exit=function(){return V(f)};return k},a.each=function(b){for(var c=0,d=a.length;c<d;c++){var e=a[c];for(var f=0,g=e.length;f<g;f++){var h=e[f];h&&b.call(h,h.__data__,f)}}return a},a.empty=function(){return!d(function(){return!0})},a.node=function(){return d(function(){return this})},a.attr=function(b,c){function j(){var a=c.apply(this,arguments);a==null?this.removeAttributeNS(b.space,b.local):this.setAttributeNS(b.space,b.local,a)}function i(){var a=c.apply(this,arguments);a==null?this.removeAttribute(b):this.setAttribute(b,a)}function h(){this.setAttributeNS(b.space,b.local,c)}function g(){this.setAttribute(b,c)}function f(){this.removeAttributeNS(b.space,b.local)}function e(){this.removeAttribute(b)}b=d3.ns.qualify(b);if(arguments.length<2)return d(b.local?function(){return this.getAttributeNS(b.space,b.local)}:function(){return this.getAttribute(b)});return a.each(c==null?b.local?f:e:typeof c=="function"?b.local?j:i:b.local?h:g)},a.classed=function(b,c){function i(){(c.apply(this,arguments)?f:h).call(this)}function h(){if(a=this.classList)return a.remove(b);var a=this.className,c=a.baseVal!=null,d=c?a.baseVal:a;d=g(d.replace(e," ")),c?a.baseVal=d:this.className=d}function f(){if(a=this.classList)return a.add(b);var a=this.className,c=a.baseVal!=null,d=c?a.baseVal:a;e.lastIndex=0,e.test(d)||(d=g(d+" "+b),c?a.baseVal=d:this.className=d)}var e=new RegExp("(^|\\s+)"+d3.requote(b)+"(\\s+|$)","g");if(arguments.length<2)return d(function(){if(a=this.classList)return a.contains(b);var a=this.className;e.lastIndex=0;return e.test(a.baseVal!=null?a.baseVal:a)});return a.each(typeof c=="function"?i:c?f:h)},a.style=function(b,c,e){function h(){var a=c.apply(this,arguments);a==null?this.style.removeProperty(b):this.style.setProperty(b,a,e)}function g(){this.style.setProperty(b,c,e)}function f(){this.style.removeProperty(b)}arguments.length<3&&(e="");if(arguments.length<2)return d(function(){return window.getComputedStyle(this,null).getPropertyValue(b)});return a.each(c==null?f:typeof c=="function"?h:g)},a.property=function(b,c){function g(){var a=c.apply(this,arguments);a==null?delete this[b]:this[b]=a}function f(){this[b]=c}function e(){delete this[b]}b=d3.ns.qualify(b);if(arguments.length<2)return d(function(){return this[b]});return a.each(c==null?e:typeof c=="function"?g:f)},a.text=function(b){function e(){this.textContent=b.apply(this,arguments)}function c(){this.textContent=b}if(arguments.length<1)return d(function(){return this.textContent});return a.each(typeof b=="function"?e:c)},a.html=function(b){function e(){this.innerHTML=b.apply(this,arguments)}function c(){this.innerHTML=b}if(arguments.length<1)return d(function(){return this.innerHTML});return a.each(typeof b=="function"?e:c)},a.append=function(a){function d(b){return b.appendChild(document.createElementNS(a.space,a.local))}function c(b){return b.appendChild(document.createElement(a))}a=d3.ns.qualify(a);return b(a.local?d:c)},a.insert=function(a,c){function e(b){return b.insertBefore(document.createElementNS(a.space,a.local),S(c,b))}function d(b){return b.insertBefore(document.createElement(a),S(c,b))}a=d3.ns.qualify(a);return b(a.local?e:d)},a.remove=function(){return a.each(function(){var a=this.parentNode;a&&a.removeChild(this)})},a.sort=function(b){b=X.apply(this,arguments);for(var c=0,d=a.length;c<d;c++){var e=a[c];e.sort(b);for(var f=1,g=e.length,h=e[0];f<g;f++){var i=e[f];i&&(h&&h.parentNode.insertBefore(i,h.nextSibling),h=i)}}return a},a.on=function(b,c,d){arguments.length<3&&(d=!1);var e=b.indexOf("."),f=e===-1?b:b.substring(0,e),g="__on"+b;return a.each(function(a,b){function h(a){var d=d3.event;d3.event=a;try{c.call(this,e.__data__,b)}finally{d3.event=d}}this[g]&&this.removeEventListener(f,this[g],d),c&&this.addEventListener(f,this[g]=h,d);var e=this})},a.transition=function(){return _(a)},a.call=h;return a}function R(a,b,c){function g(a){return Math.round(f(a)*255)}function f(a){a>360?a-=360:a<0&&(a+=360);if(a<60)return d+(e-d)*a/60;if(a<180)return e;if(a<240)return d+(e-d)*(240-a)/60;return d}var d,e;a=a%360,a<0&&(a+=360),b=b<0?0:b>1?1:b,c=c<0?0:c>1?1:c,e=c<=.5?c*(1+b):c+b-c*b,d=2*c-e;return H(g(a+120),g(a),g(a-120))}function Q(a,b,c){this.h=a,this.s=b,this.l=c}function P(a,b,c){return new Q(a,b,c)}function M(a){var b=parseFloat(a);return a.charAt(a.length-1)==="%"?Math.round(b*2.55):b}function L(a,b,c){var d=Math.min(a/=255,b/=255,c/=255),e=Math.max(a,b,c),f=e-d,g,h,i=(e+d)/2;f?(h=i<.5?f/(e+d):f/(2-e-d),a==e?g=(b-c)/f+(b<c?6:0):b==e?g=(c-a)/f+2:g=(a-b)/f+4,g*=60):h=g=0;return P(g,h,i)}function K(a,b,c){var d=0,e=0,f=0,g,h,i;g=/([a-z]+)\((.*)\)/i.exec(a);if(g){h=g[2].split(",");switch(g[1]){case"hsl":return c(parseFloat(h[0]),parseFloat(h[1])/100,parseFloat(h[2])/100);case"rgb":return b(M(h[0]),M(h[1]),M(h[2]))}}if(i=N[a])return b(i.r,i.g,i.b);a!=null&&a.charAt(0)==="#"&&(a.length===4?(d=a.charAt(1),d+=d,e=a.charAt(2),e+=e,f=a.charAt(3),f+=f):a.length===7&&(d=a.substring(1,3),e=a.substring(3,5),f=a.substring(5,7)),d=parseInt(d,16),e=parseInt(e,16),f=parseInt(f,16));return b(d,e,f)}function J(a){return a<16?"0"+a.toString(16):a.toString(16)}function I(a,b,c){this.r=a,this.g=b,this.b=c}function H(a,b,c){return new I(a,b,c)}function G(a,b){b=1/(b-(a=+a));return function(c){return Math.max(0,Math.min(1,(c-a)*b))}}function F(a,b){b=1/(b-(a=+a));return function(c){return(c-a)*b}}function E(a){return a in D||/\bcolor\b/.test(a)?d3.interpolateRgb:d3.interpolate}function B(a){return a<1/2.75?7.5625*a*a:a<2/2.75?7.5625*(a-=1.5/2.75)*a+.75:a<2.5/2.75?7.5625*(a-=2.25/2.75)*a+.9375:7.5625*(a-=2.625/2.75)*a+.984375}function A(a){a||(a=1.70158);return function(b){return b*b*((a+1)*b-a)}}function z(a,b){var c;arguments.length<2&&(b=.45),arguments.length<1?(a=1,c=b/4):c=b/(2*Math.PI)*Math.asin(1/a);return function(d){return 1+a*Math.pow(2,10*-d)*Math.sin((d-c)*2*Math.PI/b)}}function y(a){return 1-Math.sqrt(1-a*a)}function x(a){return Math.pow(2,10*(a-1))}function w(a){return 1-Math.cos(a*Math.PI/2)}function v(a){return function(b){return Math.pow(b,a)}}function u(a){return a}function t(a){return function(b){return.5*(b<.5?a(2*b):2-a(2-2*b))}}function s(a){return function(b){return 1-a(1-b)}}function n(a){var b=a.lastIndexOf("."),c=b>=0?a.substring(b):(b=a.length,""),d=[];while(b>0)d.push(a.substring(b-=3,b+3));return d.reverse().join(",")+c}function m(a){return a+""}function j(a){var b={},c=[];b.add=function(a){for(var d=0;d<c.length;d++)if(c[d].listener==a)return b;c.push({listener:a,on:!0});return b},b.remove=function(a){for(var d=0;d<c.length;d++){var e=c[d];if(e.listener==a){e.on=!1,c=c.slice(0,d).concat(c.slice(d+1));break}}return b},b.dispatch=function(){var a=c;for(var b=0,d=a.length;b<d;b++){var e=a[b];e.on&&e.listener.apply(this,arguments)}};return b}function h(a){a.apply(this,(arguments[0]=this,arguments));return this}function g(a){return a.replace(/(^\s+)|(\s+$)/g,"").replace(/\s+/g," ")}function f(a){return a==null}function e(a){return a.length}function c(a){return Array.prototype.slice.call(a)}function b(a){var b=-1,c=a.length,d=[];while(++b<c)d.push(a[b]);return d}d3={version:"1.29.4"},Date.now||(Date.now=function(){return+(new Date)}),Object.create||(Object.create=function(a){function b(){}b.prototype=a;return new b});var a=c;try{a(document.documentElement.childNodes)[0].nodeType}catch(d){a=b}d3.functor=function(a){return typeof a=="function"?a:function(){return a}},d3.rebind=function(a,b){return function(){var c=b.apply(a,arguments);return arguments.length?a:c}},d3.ascending=function(a,b){return a<b?-1:a>b?1:a>=b?0:NaN},d3.descending=function(a,b){return b<a?-1:b>a?1:b>=a?0:NaN},d3.min=function(a,b){var c=-1,d=a.length,e,f;if(arguments.length===1){while(++c<d&&((e=a[c])==null||e!=e))e=undefined;while(++c<d)(f=a[c])!=null&&e>f&&(e=f)}else{while(++c<d&&((e=b.call(a,a[c],c))==null||e!=e))e=undefined;while(++c<d)(f=b.call(a,a[c],c))!=null&&e>f&&(e=f)}return e},d3.max=function(a,b){var c=-1,d=a.length,e,f;if(arguments.length===1){while(++c<d&&((e=a[c])==null||e!=e))e=undefined;while(++c<d)(f=a[c])!=null&&f>e&&(e=f)}else{while(++c<d&&((e=b.call(a,a[c],c))==null||e!=e))e=undefined;while(++c<d)(f=b.call(a,a[c],c))!=null&&f>e&&(e=f)}return e},d3.sum=function(a,b){var c=0,d=a.length,e,f=-1;if(arguments.length===1)while(++f<d)isNaN(e=+a[f])||(c+=e);else while(++f<d)isNaN(e=+b.call(a,a[f],f))||(c+=e);return c},d3.quantile=function(a,b){var c=(a.length-1)*b+1,d=Math.floor(c),e=a[d-1],f=c-d;return f?e+f*(a[d]-e):e},d3.zip=function(){if(!(f=arguments.length))return[];for(var a=-1,b=d3.min(arguments,e),c=Array(b);++a<b;)for(var d=-1,f,g=c[a]=Array(f);++d<f;)g[d]=arguments[d][a];return c},d3.bisectLeft=function(a,b,c,d){arguments.length<3&&(c=0),arguments.length<4&&(d=a.length);while(c<d){var e=c+d>>1;a[e]<b?c=e+1:d=e}return c},d3.bisect=d3.bisectRight=function(a,b,c,d){arguments.length<3&&(c=0),arguments.length<4&&(d=a.length);while(c<d){var e=c+d>>1;b<a[e]?d=e:c=e+1}return c},d3.first=function(a,b){var c=0,d=a.length,e=a[0],f;arguments.length===1&&(b=d3.ascending);while(++c<d)b.call(a,e,f=a[c])>0&&(e=f);return e},d3.last=function(a,b){var c=0,d=a.length,e=a[0],f;arguments.length===1&&(b=d3.ascending);while(++c<d)b.call(a,e,f=a[c])<=0&&(e=f);return e},d3.nest=function(){function g(a,d){if(d>=b.length)return a;var e=[],f=c[d++],h;for(h in a)e.push({key:h,values:g(a[h],d)});f&&e.sort(function(a,b){return f(a.key,b.key)});return e}function f(c,g){if(g>=b.length)return e?e.call(a,c):d?c.sort(d):c;var h=-1,i=c.length,j=b[g++],k,l,m={};while(++h<i)(k=j(l=c[h]))in m?m[k].push(l):m[k]=[l];for(k in m)m[k]=f(m[k],g);return m}var a={},b=[],c=[],d,e;a.map=function(a){return f(a,0)},a.entries=function(a){return g(f(a,0),0)},a.key=function(c){b.push(c);return a},a.sortKeys=function(d){c[b.length-1]=d;return a},a.sortValues=function(b){d=b;return a},a.rollup=function(b){e=b;return a};return a},d3.keys=function(a){var b=[];for(var c in a)b.push(c);return b},d3.values=function(a){var b=[];for(var c in a)b.push(a[c]);return b},d3.entries=function(a){var b=[];for(var c in a)b.push({key:c,value:a[c]});return b},d3.permute=function(a,b){var c=[],d=-1,e=b.length;while(++d<e)c[d]=a[b[d]];return c},d3.merge=function(a){return Array.prototype.concat.apply([],a)},d3.split=function(a,b){var c=[],d=[],e,g=-1,h=a.length;arguments.length<2&&(b=f);while(++g<h)b.call(d,e=a[g],g)?d=[]:(d.length||c.push(d),d.push(e));return c},d3.range=function(a,b,c){arguments.length<3&&(c=1,arguments.length<2&&(b=a,a=0));if((b-a)/c==Infinity)throw new Error("infinite range");var d=[],e=-1,f;if(c<0)while((f=a+c*++e)>b)d.push(f);else while((f=a+c*++e)<b)d.push(f);return d},d3.requote=function(a){return a.replace(i,"\\$&")};var i=/[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g;d3.round=function(a,b){return b?Math.round(a*Math.pow(10,b))*Math.pow(10,-b):Math.round(a)},d3.xhr=function(a,b,c){var d=new XMLHttpRequest;arguments.length<3?c=b:b&&d.overrideMimeType&&d.overrideMimeType(b),d.open("GET",a,!0),d.onreadystatechange=function(){d.readyState===4&&c(d.status<300?d:null)},d.send(null)},d3.text=function(a,b,c){function d(a){c(a&&a.responseText)}arguments.length<3&&(c=b,b=null),d3.xhr(a,b,d)},d3.json=function(a,b){d3.text(a,"application/json",function(a){b(a?JSON.parse(a):null)})},d3.html=function(a,b){d3.text(a,"text/html",function(a){if(a!=null){var c=document.createRange();c.selectNode(document.body),a=c.createContextualFragment(a)}b(a)})},d3.xml=function(a,b,c){function d(a){c(a&&a.responseXML)}arguments.length<3&&(c=b,b=null),d3.xhr(a,b,d)},d3.ns={prefix:{svg:"http://www.w3.org/2000/svg",xhtml:"http://www.w3.org/1999/xhtml",xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"},qualify:function(a){var b=a.indexOf(":");return b<0?a:{space:d3.ns.prefix[a.substring(0,b)],local:a.substring(b+1)}}},d3.dispatch=function(a){var b={},c;for(var d=0,e=arguments.length;d<e;d++)c=arguments[d],b[c]=j(c);return b},d3.format=function(a){var b=k.exec(a),c=b[1]||" ",d=b[3]||"",e=b[5],f=+b[6],g=b[7],h=b[8],i=b[9],j=!1,o=!1;h&&(h=h.substring(1)),e&&(c="0",g&&(f-=Math.floor((f-1)/4)));switch(i){case"n":g=!0,i="g";break;case"%":j=!0,i="f";break;case"p":j=!0,i="r";break;case"d":o=!0,h="0"}i=l[i]||m;return function(a){var b=j?a*100:+a,k=b<0&&(b=-b)?"−":d;if(o&&b%1)return"";a=i(b,h);if(e){var l=a.length+k.length;l<f&&(a=Array(f-l+1).join(c)+a),g&&(a=n(a)),a=k+a}else{g&&(a=n(a)),a=k+a;var l=a.length;l<f&&(a=Array(f-l+1).join(c)+a)}j&&(a+="%");return a}};var k=/(?:([^{])?([<>=^]))?([+\- ])?(#)?(0)?([0-9]+)?(,)?(\.[0-9]+)?([a-zA-Z%])?/,l={g:function(a,b){return a.toPrecision(b)},e:function(a,b){return a.toExponential(b)},f:function(a,b){return a.toFixed(b)},r:function(a,b){var c=1+Math.floor(1e-15+Math.log(a)/Math.LN10);return d3.round(a,b-c).toFixed(Math.max(0,b-c))}},o=v(2),p=v(3),q={linear:function(){return u},poly:v,quad:function(){return o},cubic:function(){return p},sin:function(){return w},exp:function(){return x},circle:function(){return y},elastic:z,back:A,bounce:function(){return B}},r={"in":function(a){return a},out:s,"in-out":t,"out-in":function(a){return t(s(a))}};d3.ease=function(a){var b=a.indexOf("-"),c=b>=0?a.substring(0,b):a,d=b>=0?a.substring(b+1):"in";return r[d](q[c].apply(null,Array.prototype.slice.call(arguments,1)))},d3.event=null,d3.interpolate=function(a,b){var c=d3.interpolators.length,d;while(--c>=0&&!(d=d3.interpolators[c](a,b)));return d},d3.interpolateNumber=function(a,b){b-=a;return function(c){return a+b*c}},d3.interpolateRound=function(a,b){b-=a;return function(c){return Math.round(a+b*c)}},d3.interpolateString=function(a,b){var c,d,e,f=0,g=0,h=[],i=[],j,k;C.lastIndex=0;for(d=0;c=C.exec(b);++d)c.index&&h.push(b.substring(f,g=c.index)),i.push({i:h.length,x:c[0]}),h.push(null),f=C.lastIndex;f<b.length&&h.push(b.substring(f));for(d=0,j=i.length;(c=C.exec(a))&&d<j;++d){k=i[d];if(k.x==c[0]){if(k.i)if(h[k.i+1]==null){h[k.i-1]+=k.x,h.splice(k.i,1);for(e=d+1;e<j;++e)i[e].i--}else{h[k.i-1]+=k.x+h[k.i+1],h.splice(k.i,2);for(e=d+1;e<j;++e)i[e].i-=2}else if(h[k.i+1]==null)h[k.i]=k.x;else{h[k.i]=k.x+h[k.i+1],h.splice(k.i+1,1);for(e=d+1;e<j;++e)i[e].i--}i.splice(d,1),j--,d--}else k.x=d3.interpolateNumber(parseFloat(c[0]),parseFloat(k.x))}while(d<j)k=i.pop(),h[k.i+1]==null?h[k.i]=k.x:(h[k.i]=k.x+h[k.i+1],h.splice(k.i+1,1)),j--;if(h.length===1)return h[0]==null?i[0].x:function(){return b};return function(a){for(d=0;d<j;++d)h[(k=i[d]).i]=k.x(a);return h.join("")}},d3.interpolateRgb=function(a,b){a=d3.rgb(a),b=d3.rgb(b);var c=a.r,d=a.g,e=a.b,f=b.r-c,g=b.g-d,h=b.b-e;return function(a){return"rgb("+Math.round(c+f*a)+","+Math.round(d+g*a)+","+Math.round(e+h*a)+")"}},d3.interpolateHsl=function(a,b){a=d3.hsl(a),b=d3.hsl(b);var c=a.h,d=a.s,e=a.l,f=b.h-c,g=b.s-d,h=b.l-e;return function(a){return R(c+f*a,d+g*a,e+h*a).toString()}},d3.interpolateArray=function(a,b){var c=[],d=[],e=a.length,f=b.length,g=Math.min(a.length,b.length),h;for(h=0;h<g;++h)c.push(d3.interpolate(a[h],b[h]));for(;h<e;++h)d[h]=a[h];for(;h<f;++h)d[h]=b[h];return function(a){for(h=0;h<g;++h)d[h]=c[h](a);return d}},d3.interpolateObject=function(a,b){var c={},d={},e;for(e in a)e in b?c[e]=E(e)(a[e],b[e]):d[e]=a[e];for(e in b)e in a||(d[e]=b[e]);return function(a){for(e in c)d[e]=c[e](a);return d}};var C=/[-+]?(?:\d+\.\d+|\d+\.|\.\d+|\d+)(?:[eE][-]?\d+)?/g,D={background:1,fill:1,stroke:1};d3.interpolators=[d3.interpolateObject,function(a,b){return b instanceof Array&&d3.interpolateArray(a,b)},function(a,b){return typeof b=="string"&&d3.interpolateString(String(a),b)},function(a,b){return(typeof b=="string"?b in N||/^(#|rgb\(|hsl\()/.test(b):b instanceof I||b instanceof Q)&&d3.interpolateRgb(String(a),b)},function(a,b){return typeof b=="number"&&d3.interpolateNumber(+a,b)}],d3.rgb=function(a,b,c){return arguments.length===1?K(""+a,H,R):H(~~a,~~b,~~c)},I.prototype.brighter=function(a){a=Math.pow(.7,arguments.length?a:1);var b=this.r,c=this.g,d=this.b,e=30;if(!b&&!c&&!d)return H(e,e,e);b&&b<e&&(b=e),c&&c<e&&(c=e),d&&d<e&&(d=e);return H(Math.min(255,Math.floor(b/a)),Math.min(255,Math.floor(c/a)),Math.min(255,Math.floor(d/a)))},I.prototype.darker=function(a){a=Math.pow(.7,arguments.length?a:1);return H(Math.max(0,Math.floor(a*this.r)),Math.max(0,Math.floor(a*this.g)),Math.max(0,Math.floor(a*this.b)))},I.prototype.hsl=function(){return L(this.r,this.g,this.b)},I.prototype.toString=function(){return"#"+J(this.r)+J(this.g)+J(this.b)};var N={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"};for(var O in N)N[O]=K(N[O],H,R);d3.hsl=function(a,b,c){return arguments.length===1?K(""+a,L,P):P(+a,+b,+c)},Q.prototype.brighter=function(a){a=Math.pow(.7,arguments.length?a:1);return P(this.h,this.s,this.l/a)},Q.prototype.darker=function(a){a=Math.pow(.7,arguments.length?a:1);return P(this.h,this.s,a*this.l)},Q.prototype.rgb=function(){return R(this.h,this.s,this.l)},Q.prototype.toString=function(){return"hsl("+this.h+","+this.s*100+"%,"+this.l*100+"%)"};var S=function(a,b){return b.querySelector(a)},T=function(b,c){return a(c.querySelectorAll(b))};typeof Sizzle=="function"&&(S=function(a,b){return Sizzle(a,b)[0]},T=function( <del>a,b){return Sizzle.uniqueSort(Sizzle(a,b))});var U=V([[document]]);U[0].parentNode=document.documentElement,d3.select=function(a){return typeof a=="string"?U.select(a):V([[a]])},d3.selectAll=function(b){return typeof b=="string"?U.selectAll(b):V([a(b)])},d3.transition=U.transition;var Z=0,$=0,bb=null,bc,bd;d3.timer=function(a){be(a,0)},d3.timer.flush=function(){var a,b=Date.now(),c=bb;while(c)a=b-c.then,c.delay||(c.flush=c.callback(a)),c=c.next;bg()};var bh=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(a){setTimeout(a,17)};d3.scale={},d3.scale.linear=function(){function h(a){return e(a)}function g(){var g=a.length==2?br:bs,i=d?G:F;e=g(a,b,i,c),f=g(b,a,i,d3.interpolate);return h}var a=[0,1],b=[0,1],c=d3.interpolate,d=!1,e,f;h.invert=function(a){return f(a)},h.domain=function(b){if(!arguments.length)return a;a=b.map(Number);return g()},h.range=function(a){if(!arguments.length)return b;b=a;return g()},h.rangeRound=function(a){return h.range(a).interpolate(d3.interpolateRound)},h.clamp=function(a){if(!arguments.length)return d;d=a;return g()},h.interpolate=function(a){if(!arguments.length)return c;c=a;return g()},h.ticks=function(b){return bp(a,b)},h.tickFormat=function(b){return bq(a,b)},h.nice=function(){bk(a,bn);return g()};return g()},d3.scale.log=function(){function d(c){return a(b(c))}var a=d3.scale.linear(),b=bt,c=b.pow;d.invert=function(b){return c(a.invert(b))},d.domain=function(e){if(!arguments.length)return a.domain().map(c);b=e[0]<0?bu:bt,c=b.pow,a.domain(e.map(b));return d},d.nice=function(){a.domain(bk(a.domain(),bl));return d},d.ticks=function(){var d=bj(a.domain()),e=[];if(d.every(isFinite)){var f=Math.floor(d[0]),g=Math.ceil(d[1]),h=c(d[0]),i=c(d[1]);if(b===bu){e.push(c(f));for(;f++<g;)for(var j=9;j>0;j--)e.push(c(f)*j)}else{for(;f<g;f++)for(var j=1;j<10;j++)e.push(c(f)*j);e.push(c(f))}for(f=0;e[f]<h;f++);for(g=e.length;e[g-1]>i;g--);e=e.slice(f,g)}return e},d.tickFormat=function(){return bv};return bm(d,a)},bt.pow=function(a){return Math.pow(10,a)},bu.pow=function(a){return-Math.pow(10,-a)},d3.scale.pow=function(){function e(b){return a(c(b))}var a=d3.scale.linear(),b=1,c=Number,d=c;e.invert=function(b){return d(a.invert(b))},e.domain=function(f){if(!arguments.length)return a.domain().map(d);c=bw(b),d=bw(1/b),a.domain(f.map(c));return e},e.ticks=function(a){return bp(e.domain(),a)},e.tickFormat=function(a){return bq(e.domain(),a)},e.nice=function(){return e.domain(bk(e.domain(),bn))},e.exponent=function(a){if(!arguments.length)return b;var c=e.domain();b=a;return e.domain(c)};return bm(e,a)},d3.scale.sqrt=function(){return d3.scale.pow().exponent(.5)},d3.scale.ordinal=function(){function f(d){var e=d in b?b[d]:b[d]=a.push(d)-1;return c[e%c.length]}var a=[],b={},c=[],d=0,e=bi;f.domain=function(c){if(!arguments.length)return a;a=c,b={};var d=-1,g=-1,h=a.length;while(++d<h)c=a[d],c in b||(b[c]=++g);e();return f},f.range=function(a){if(!arguments.length)return c;c=a,e=bi;return f},f.rangePoints=function(b,g){arguments.length<2&&(g=0),(e=function(){var e=b[0],f=b[1],h=(f-e)/(a.length-1+g);c=a.length==1?[(e+f)/2]:d3.range(e+h*g/2,f+h/2,h),d=0})();return f},f.rangeBands=function(b,g){arguments.length<2&&(g=0),(e=function(){var e=b[0],f=b[1],h=(f-e)/(a.length+g);c=d3.range(e+h*g,f,h),d=h*(1-g)})();return f},f.rangeRoundBands=function(b,g){arguments.length<2&&(g=0),(e=function(){var e=b[0],f=b[1],h=f-e,i=Math.floor(h/(a.length+g)),j=h-(a.length-g)*i;c=d3.range(e+Math.round(j/2),f,i),d=Math.round(i*(1-g))})();return f},f.rangeBand=function(){return d};return f},d3.scale.category10=function(){return d3.scale.ordinal().range(bx)},d3.scale.category20=function(){return d3.scale.ordinal().range(by)},d3.scale.category20b=function(){return d3.scale.ordinal().range(bz)},d3.scale.category20c=function(){return d3.scale.ordinal().range(bA)};var bx=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],by=["#1f77b4","#aec7e8","#ff7f0e","#ffbb78","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5","#8c564b","#c49c94","#e377c2","#f7b6d2","#7f7f7f","#c7c7c7","#bcbd22","#dbdb8d","#17becf","#9edae5"],bz=["#393b79","#5254a3","#6b6ecf","#9c9ede","#637939","#8ca252","#b5cf6b","#cedb9c","#8c6d31","#bd9e39","#e7ba52","#e7cb94","#843c39","#ad494a","#d6616b","#e7969c","#7b4173","#a55194","#ce6dbd","#de9ed6"],bA=["#3182bd","#6baed6","#9ecae1","#c6dbef","#e6550d","#fd8d3c","#fdae6b","#fdd0a2","#31a354","#74c476","#a1d99b","#c7e9c0","#756bb1","#9e9ac8","#bcbddc","#dadaeb","#636363","#969696","#bdbdbd","#d9d9d9"];d3.scale.quantile=function(){function e(a){if(isNaN(a=+a))return NaN;return b[d3.bisect(c,a)]}function d(){var d=0,e=a.length,f=b.length;c.length=Math.max(0,f-1);while(++d<f)c[d-1]=d3.quantile(a,d/f)}var a=[],b=[],c=[];e.domain=function(b){if(!arguments.length)return a;a=b.filter(function(a){return!isNaN(a)}).sort(d3.ascending),d();return e},e.range=function(a){if(!arguments.length)return b;b=a,d();return e},e.quantiles=function(){return c};return e},d3.scale.quantize=function(){function f(b){return e[Math.max(0,Math.min(d,Math.floor(c*(b-a))))]}var a=0,b=1,c=2,d=1,e=[0,1];f.domain=function(d){if(!arguments.length)return[a,b];a=d[0],b=d[1],c=e.length/(b-a);return f},f.range=function(g){if(!arguments.length)return e;e=g,c=e.length/(b-a),d=e.length-1;return f};return f},d3.svg={},d3.svg.arc=function(){function e(){var e=a.apply(this,arguments),f=b.apply(this,arguments),g=c.apply(this,arguments)+bB,h=d.apply(this,arguments)+bB,i=h-g,j=i<Math.PI?"0":"1",k=Math.cos(g),l=Math.sin(g),m=Math.cos(h),n=Math.sin(h);return i>=bC?e?"M0,"+f+"A"+f+","+f+" 0 1,1 0,"+ -f+"A"+f+","+f+" 0 1,1 0,"+f+"M0,"+e+"A"+e+","+e+" 0 1,1 0,"+ -e+"A"+e+","+e+" 0 1,1 0,"+e+"Z":"M0,"+f+"A"+f+","+f+" 0 1,1 0,"+ -f+"A"+f+","+f+" 0 1,1 0,"+f+"Z":e?"M"+f*k+","+f*l+"A"+f+","+f+" 0 "+j+",1 "+f*m+","+f*n+"L"+e*m+","+e*n+"A"+e+","+e+" 0 "+j+",0 "+e*k+","+e*l+"Z":"M"+f*k+","+f*l+"A"+f+","+f+" 0 "+j+",1 "+f*m+","+f*n+"L0,0"+"Z"}var a=bD,b=bE,c=bF,d=bG;e.innerRadius=function(b){if(!arguments.length)return a;a=d3.functor(b);return e},e.outerRadius=function(a){if(!arguments.length)return b;b=d3.functor(a);return e},e.startAngle=function(a){if(!arguments.length)return c;c=d3.functor(a);return e},e.endAngle=function(a){if(!arguments.length)return d;d=d3.functor(a);return e},e.centroid=function(){var e=(a.apply(this,arguments)+b.apply(this,arguments))/2,f=(c.apply(this,arguments)+d.apply(this,arguments))/2+bB;return[Math.cos(f)*e,Math.sin(f)*e]};return e};var bB=-Math.PI/2,bC=2*Math.PI-1e-6;d3.svg.line=function(){return bH(Object)};var bL={linear:bM,"step-before":bN,"step-after":bO,basis:bU,"basis-open":bV,"basis-closed":bW,bundle:bX,cardinal:bR,"cardinal-open":bP,"cardinal-closed":bQ,monotone:ce},bZ=[0,2/3,1/3,0],b$=[0,1/3,2/3,0],b_=[0,1/6,2/3,1/6];d3.svg.line.radial=function(){var a=bH(cf);a.radius=a.x,delete a.x,a.angle=a.y,delete a.y;return a},d3.svg.area=function(){return cg(Object)},d3.svg.area.radial=function(){var a=cg(cf);a.radius=a.x,delete a.x,a.innerRadius=a.x0,delete a.x0,a.outerRadius=a.x1,delete a.x1,a.angle=a.y,delete a.y,a.startAngle=a.y0,delete a.y0,a.endAngle=a.y1,delete a.y1;return a},d3.svg.chord=function(){function j(a,b,c,d){return"Q 0,0 "+d}function i(a,b){return"A"+a+","+a+" 0 0,1 "+b}function h(a,b){return a.a0==b.a0&&a.a1==b.a1}function g(a,b,f,g){var h=b.call(a,f,g),i=c.call(a,h,g),j=d.call(a,h,g)+bB,k=e.call(a,h,g)+bB;return{r:i,a0:j,a1:k,p0:[i*Math.cos(j),i*Math.sin(j)],p1:[i*Math.cos(k),i*Math.sin(k)]}}function f(c,d){var e=g(this,a,c,d),f=g(this,b,c,d);return"M"+e.p0+i(e.r,e.p1)+(h(e,f)?j(e.r,e.p1,e.r,e.p0):j(e.r,e.p1,f.r,f.p0)+i(f.r,f.p1)+j(f.r,f.p1,e.r,e.p0))+"Z"}var a=cj,b=ck,c=cl,d=bF,e=bG;f.radius=function(a){if(!arguments.length)return c;c=d3.functor(a);return f},f.source=function(b){if(!arguments.length)return a;a=d3.functor(b);return f},f.target=function(a){if(!arguments.length)return b;b=d3.functor(a);return f},f.startAngle=function(a){if(!arguments.length)return d;d=d3.functor(a);return f},f.endAngle=function(a){if(!arguments.length)return e;e=d3.functor(a);return f};return f},d3.svg.diagonal=function(){function d(d,e){var f=a.call(this,d,e),g=b.call(this,d,e),h=(f.y+g.y)/2,i=[f,{x:f.x,y:h},{x:g.x,y:h},g];i=i.map(c);return"M"+i[0]+"C"+i[1]+" "+i[2]+" "+i[3]}var a=cj,b=ck,c=co;d.source=function(b){if(!arguments.length)return a;a=d3.functor(b);return d},d.target=function(a){if(!arguments.length)return b;b=d3.functor(a);return d},d.projection=function(a){if(!arguments.length)return c;c=a;return d};return d},d3.svg.diagonal.radial=function(){var a=d3.svg.diagonal(),b=co,c=a.projection;a.projection=function(a){return arguments.length?c(cp(b=a)):b};return a},d3.svg.mouse=function(a){return cr(a,d3.event)};var cq=/WebKit/.test(navigator.userAgent)?-1:0;d3.svg.touches=function(b){var c=d3.event.touches;return c?a(c).map(function(a){var c=cr(b,a);c.identifier=a.identifier;return c}):[]},d3.svg.symbol=function(){function c(c,d){return(cu[a.call(this,c,d)]||cu.circle)(b.call(this,c,d))}var a=ct,b=cs;c.type=function(b){if(!arguments.length)return a;a=d3.functor(b);return c},c.size=function(a){if(!arguments.length)return b;b=d3.functor(a);return c};return c};var cu={circle:function(a){var b=Math.sqrt(a/Math.PI);return"M0,"+b+"A"+b+","+b+" 0 1,1 0,"+ -b+"A"+b+","+b+" 0 1,1 0,"+b+"Z"},cross:function(a){var b=Math.sqrt(a/5)/2;return"M"+ -3*b+","+ -b+"H"+ -b+"V"+ -3*b+"H"+b+"V"+ -b+"H"+3*b+"V"+b+"H"+b+"V"+3*b+"H"+ -b+"V"+b+"H"+ -3*b+"Z"},diamond:function(a){var b=Math.sqrt(a/(2*cw)),c=b*cw;return"M0,"+ -b+"L"+c+",0"+" 0,"+b+" "+ -c+",0"+"Z"},square:function(a){var b=Math.sqrt(a)/2;return"M"+ -b+","+ -b+"L"+b+","+ -b+" "+b+","+b+" "+ -b+","+b+"Z"},"triangle-down":function(a){var b=Math.sqrt(a/cv),c=b*cv/2;return"M0,"+c+"L"+b+","+ -c+" "+ -b+","+ -c+"Z"},"triangle-up":function(a){var b=Math.sqrt(a/cv),c=b*cv/2;return"M0,"+ -c+"L"+b+","+c+" "+ -b+","+c+"Z"}};d3.svg.symbolTypes=d3.keys(cu);var cv=Math.sqrt(3),cw=Math.tan(30*Math.PI/180)})() <ide>\ No newline at end of file <add>(function(){function cs(){return"circle"}function cr(){return 64}function cq(a,b){var c=(a.ownerSVGElement||a).createSVGPoint();if(cp<0&&(window.scrollX||window.scrollY)){var d=d3.select(document.body).append("svg:svg").style("position","absolute").style("top",0).style("left",0),e=d[0][0].getScreenCTM();cp=!e.f&&!e.e,d.remove()}cp?(c.x=b.pageX,c.y=b.pageY):(c.x=b.clientX,c.y=b.clientY),c=c.matrixTransform(a.getScreenCTM().inverse());return[c.x,c.y]}function co(a){return function(){var b=a.apply(this,arguments),c=b[0],d=b[1]+bA;return[c*Math.cos(d),c*Math.sin(d)]}}function cn(a){return[a.x,a.y]}function cm(a){return a.endAngle}function cl(a){return a.startAngle}function ck(a){return a.radius}function cj(a){return a.target}function ci(a){return a.source}function ch(a){return function(b,c){return a[c][1]}}function cg(a){return function(b,c){return a[c][0]}}function cf(a){function i(f){if(f.length<1)return null;var i=bH(this,f,b,d),j=bH(this,f,b===c?cg(i):c,d===e?ch(i):e);return"M"+g(a(j),h)+"L"+g(a(i.reverse()),h)+"Z"}var b=bI,c=bI,d=0,e=bJ,f="linear",g=bK[f],h=.7;i.x=function(a){if(!arguments.length)return c;b=c=a;return i},i.x0=function(a){if(!arguments.length)return b;b=a;return i},i.x1=function(a){if(!arguments.length)return c;c=a;return i},i.y=function(a){if(!arguments.length)return e;d=e=a;return i},i.y0=function(a){if(!arguments.length)return d;d=a;return i},i.y1=function(a){if(!arguments.length)return e;e=a;return i},i.interpolate=function(a){if(!arguments.length)return f;g=bK[f=a];return i},i.tension=function(a){if(!arguments.length)return h;h=a;return i};return i}function ce(a){var b,c=-1,d=a.length,e,f;while(++c<d)b=a[c],e=b[0],f=b[1]+bA,b[0]=e*Math.cos(f),b[1]=e*Math.sin(f);return a}function cd(a){return a.length<3?bL(a):a[0]+bR(a,cc(a))}function cc(a){var b=[],c,d,e,f,g=cb(a),h=-1,i=a.length-1;while(++h<i)c=ca(a[h],a[h+1]),Math.abs(c)<1e-6?g[h]=g[h+1]=0:(d=g[h]/c,e=g[h+1]/c,f=d*d+e*e,f>9&&(f=c*3/Math.sqrt(f),g[h]=f*d,g[h+1]=f*e));h=-1;while(++h<=i)f=(a[Math.min(i,h+1)][0]-a[Math.max(0,h-1)][0])/(6*(1+g[h]*g[h])),b.push([f||0,g[h]*f||0]);return b}function cb(a){var b=0,c=a.length-1,d=[],e=a[0],f=a[1],g=d[0]=ca(e,f);while(++b<c)d[b]=g+(g=ca(e=f,f=a[b+1]));d[b]=g;return d}function ca(a,b){return(b[1]-a[1])/(b[0]-a[0])}function b_(a,b,c){a.push("C",bX(bY,b),",",bX(bY,c),",",bX(bZ,b),",",bX(bZ,c),",",bX(b$,b),",",bX(b$,c))}function bX(a,b){return a[0]*b[0]+a[1]*b[1]+a[2]*b[2]+a[3]*b[3]}function bW(a,b){var c=a.length-1,d=a[0][0],e=a[0][1],f=a[c][0]-d,g=a[c][1]-e,h=-1,i,j;while(++h<=c)i=a[h],j=h/c,i[0]=b*i[0]+(1-b)*(d+j*f),i[1]=b*i[1]+(1-b)*(e+j*g);return bT(a)}function bV(a){var b,c=-1,d=a.length,e=d+4,f,g=[],h=[];while(++c<4)f=a[c%d],g.push(f[0]),h.push(f[1]);b=[bX(b$,g),",",bX(b$,h)],--c;while(++c<e)f=a[c%d],g.shift(),g.push(f[0]),h.shift(),h.push(f[1]),b_(b,g,h);return b.join("")}function bU(a){if(a.length<4)return bL(a);var b=[],c=-1,d=a.length,e,f=[0],g=[0];while(++c<3)e=a[c],f.push(e[0]),g.push(e[1]);b.push(bX(b$,f)+","+bX(b$,g)),--c;while(++c<d)e=a[c],f.shift(),f.push(e[0]),g.shift(),g.push(e[1]),b_(b,f,g);return b.join("")}function bT(a){if(a.length<3)return bL(a);var b=[],c=1,d=a.length,e=a[0],f=e[0],g=e[1],h=[f,f,f,(e=a[1])[0]],i=[g,g,g,e[1]];b.push(f,",",g),b_(b,h,i);while(++c<d)e=a[c],h.shift(),h.push(e[0]),i.shift(),i.push(e[1]),b_(b,h,i);c=-1;while(++c<2)h.shift(),h.push(e[0]),i.shift(),i.push(e[1]),b_(b,h,i);return b.join("")}function bS(a,b){var c=[],d=(1-b)/2,e,f=a[0],g=a[1],h=1,i=a.length;while(++h<i)e=f,f=g,g=a[h],c.push([d*(g[0]-e[0]),d*(g[1]-e[1])]);return c}function bR(a,b){if(b.length<1||a.length!=b.length&&a.length!=b.length+2)return bL(a);var c=a.length!=b.length,d="",e=a[0],f=a[1],g=b[0],h=g,i=1;c&&(d+="Q"+(f[0]-g[0]*2/3)+","+(f[1]-g[1]*2/3)+","+f[0]+","+f[1],e=a[1],i=2);if(b.length>1){h=b[1],f=a[i],i++,d+="C"+(e[0]+g[0])+","+(e[1]+g[1])+","+(f[0]-h[0])+","+(f[1]-h[1])+","+f[0]+","+f[1];for(var j=2;j<b.length;j++,i++)f=a[i],h=b[j],d+="S"+(f[0]-h[0])+","+(f[1]-h[1])+","+f[0]+","+f[1]}if(c){var k=a[i];d+="Q"+(f[0]+h[0]*2/3)+","+(f[1]+h[1]*2/3)+","+k[0]+","+k[1]}return d}function bQ(a,b,c){return a.length<3?bL(a):a[0]+bR(a,bS(a,b))}function bP(a,b){return a.length<3?bL(a):a[0]+bR((a.push(a[0]),a),bS([a[a.length-2]].concat(a,[a[1]]),b))}function bO(a,b){return a.length<4?bL(a):a[1]+bR(a.slice(1,a.length-1),bS(a,b))}function bN(a){var b=[],c=0,d=a.length,e=a[0];b.push(e[0],",",e[1]);while(++c<d)b.push("H",(e=a[c])[0],"V",e[1]);return b.join("")}function bM(a){var b=[],c=0,d=a.length,e=a[0];b.push(e[0],",",e[1]);while(++c<d)b.push("V",(e=a[c])[1],"H",e[0]);return b.join("")}function bL(a){var b=[],c=0,d=a.length,e=a[0];b.push(e[0],",",e[1]);while(++c<d)b.push("L",(e=a[c])[0],",",e[1]);return b.join("")}function bJ(a){return a[1]}function bI(a){return a[0]}function bH(a,b,c,d){var e=[],f=-1,g=b.length,h=typeof c=="function",i=typeof d=="function",j;if(h&&i)while(++f<g)e.push([c.call(a,j=b[f],f),d.call(a,j,f)]);else if(h)while(++f<g)e.push([c.call(a,b[f],f),d]);else if(i)while(++f<g)e.push([c,d.call(a,b[f],f)]);else while(++f<g)e.push([c,d]);return e}function bG(a){function g(d){return d.length<1?null:"M"+e(a(bH(this,d,b,c)),f)}var b=bI,c=bJ,d="linear",e=bK[d],f=.7;g.x=function(a){if(!arguments.length)return b;b=a;return g},g.y=function(a){if(!arguments.length)return c;c=a;return g},g.interpolate=function(a){if(!arguments.length)return d;e=bK[d=a];return g},g.tension=function(a){if(!arguments.length)return f;f=a;return g};return g}function bF(a){return a.endAngle}function bE(a){return a.startAngle}function bD(a){return a.outerRadius}function bC(a){return a.innerRadius}function bv(a){return function(b){return b<0?-Math.pow(-b,a):Math.pow(b,a)}}function bu(a){return a.toPrecision(1)}function bt(a){return-Math.log(-a)/Math.LN10}function bs(a){return Math.log(a)/Math.LN10}function br(a,b,c,d){var e=[],f=[],g=0,h=a.length;while(++g<h)e.push(c(a[g-1],a[g])),f.push(d(b[g-1],b[g]));return function(b){var c=d3.bisect(a,b,1,a.length-1)-1;return f[c](e[c](b))}}function bq(a,b,c,d){var e=c(a[0],a[1]),f=d(b[0],b[1]);return function(a){return f(e(a))}}function bp(a,b){return d3.format(",."+Math.max(0,-Math.floor(Math.log(bn(a,b)[2])/Math.LN10+.01))+"f")}function bo(a,b){return d3.range.apply(d3,bn(a,b))}function bn(a,b){var c=bi(a),d=c[1]-c[0],e=Math.pow(10,Math.floor(Math.log(d/b)/Math.LN10)),f=b/d*e;f<=.15?e*=10:f<=.35?e*=5:f<=.75&&(e*=2),c[0]=Math.ceil(c[0]/e)*e,c[1]=Math.floor(c[1]/e)*e+e*.5,c[2]=e;return c}function bm(a){a=Math.pow(10,Math.round(Math.log(a)/Math.LN10)-1);return{floor:function(b){return Math.floor(b/a)*a},ceil:function(b){return Math.ceil(b/a)*a}}}function bl(a,b){a.range=d3.rebind(a,b.range),a.rangeRound=d3.rebind(a,b.rangeRound),a.interpolate=d3.rebind(a,b.interpolate),a.clamp=d3.rebind(a,b.clamp);return a}function bk(){return Math}function bj(a,b){var c=0,d=a.length-1,e=a[c],f=a[d],g;f<e&&(g=c,c=d,d=g,g=e,e=f,f=g),b=b(f-e),a[c]=b.floor(e),a[d]=b.ceil(f);return a}function bi(a){var b=a[0],c=a[a.length-1];return b<c?[b,c]:[c,b]}function bh(){}function bf(){var a=null,b=bb,c=Infinity;while(b)b.flush?b=a?a.next=b.next:bb=b.next:(c=Math.min(c,b.then+b.delay),b=(a=b).next);return c}function be(){var a,b=Date.now(),c=bb;while(c)a=b-c.then,a>=c.delay&&(c.flush=c.callback(a)),c=c.next;var d=bf()-b;d>24?(isFinite(d)&&(clearTimeout(bd),bd=setTimeout(be,d)),bc=0):(bc=1,bg(be))}function ba(a){return typeof a=="function"?function(b,c,d){var e=a.call(this,b,c)+"";return d!=e&&d3.interpolate(d,e)}:(a=a+"",function(b,c,d){return d!=a&&d3.interpolate(d,a)})}function _(a){function n(b){var h=!0,l=-1;a.each(function(){if(i[++l]!==2){var a=(b-j[l])/k[l],n=this.__transition__,o,p,q=e[l];if(a<1){h=!1;if(a<0)return}else a=1;if(i[l]){if(!n||n.active!==c){i[l]=2;return}}else{if(!n||n.active>c){i[l]=2;return}i[l]=1,g.start.dispatch.apply(this,arguments),q=e[l]={},n.active=c;for(p in d)if(o=d[p].apply(this,arguments))q[p]=o}o=m(a);for(p in q)q[p].call(this,o);if(a===1){i[l]=2;if(n.active===c){var r=n.owner;r===c&&(delete this.__transition__,f&&this.parentNode&&this.parentNode.removeChild(this)),$=c,g.end.dispatch.apply(this,arguments),$=0,n.owner=r}}}});return h}var b={},c=$||++Z,d={},e=[],f=!1,g=d3.dispatch("start","end"),i=[],j=[],k=[],l,m=d3.ease("cubic-in-out");a.each(function(){(this.__transition__||(this.__transition__={})).owner=c}),b.delay=function(c){var d=Infinity,e=-1;typeof c=="function"?a.each(function(a,b){var f=j[++e]=+c.apply(this,arguments);f<d&&(d=f)}):(d=+c,a.each(function(a,b){j[++e]=d})),d3.timer(n,d);return b},b.duration=function(c){var d=-1;typeof c=="function"?(l=0,a.each(function(a,b){var e=k[++d]=+c.apply(this,arguments);e>l&&(l=e)})):(l=+c,a.each(function(a,b){k[++d]=l}));return b},b.ease=function(a){m=typeof a=="function"?a:d3.ease.apply(d3,arguments);return b},b.attrTween=function(a,c){function f(b,d){var e=c.call(this,b,d,this.getAttributeNS(a.space,a.local));return e&&function(b){this.setAttributeNS(a.space,a.local,e(b))}}function e(b,d){var e=c.call(this,b,d,this.getAttribute(a));return e&&function(b){this.setAttribute(a,e(b))}}d["attr."+a]=a.local?f:e;return b},b.attr=function(a,c){return b.attrTween(a,ba(c))},b.styleTween=function(a,c,e){function f(b,d){var f=c.call(this,b,d,window.getComputedStyle(this,null).getPropertyValue(a));return f&&function(b){this.style.setProperty(a,f(b),e)}}arguments.length<3&&(e=null),d["style."+a]=f;return b},b.style=function(a,c,d){arguments.length<3&&(d=null);return b.styleTween(a,ba(c),d)},b.text=function(a){d.text=function(b,c){this.textContent=typeof a=="function"?a.call(this,b,c):a};return b},b.select=function(b){var c,d=_(a.select(b)).ease(m);c=-1,d.delay(function(a,b){return j[++c]}),c=-1,d.duration(function(a,b){return k[++c]});return d},b.selectAll=function(b){var c,d=_(a.selectAll(b)).ease(m);c=-1,d.delay(function(a,b){return j[b?c:++c]}),c=-1,d.duration(function(a,b){return k[b?c:++c]});return d},b.remove=function(){f=!0;return b},b.each=function(a,c){g[a].add(c);return b},b.call=h;return b.delay(0).duration(250)}function Y(a){return{__data__:a}}function X(a){arguments.length||(a=d3.ascending);return function(b,c){return a(b&&b.__data__,c&&c.__data__)}}function W(a){function b(b){var c=[],d,e,f,g;for(var h=0,i=a.length;h<i;h++){f=a[h],c.push(d=[]),d.parentNode=f.parentNode;for(var j=0,k=f.length;j<k;j++)(g=f[j])?(d.push(e=b(f.parentNode)),e.__data__=g.__data__):d.push(null)}return V(c)}a.append=function(a){function d(b){return b.appendChild(document.createElementNS(a.space,a.local))}function c(b){return b.appendChild(document.createElement(a))}a=d3.ns.qualify(a);return b(a.local?d:c)},a.insert=function(a,c){function e(b){return b.insertBefore(document.createElementNS(a.space,a.local),S(c,b))}function d(b){return b.insertBefore(document.createElement(a),S(c,b))}a=d3.ns.qualify(a);return b(a.local?e:d)};return a}function V(a){function d(b){for(var c=0,d=a.length;c<d;c++){var e=a[c];for(var f=0,g=e.length;f<g;f++){var h=e[f];if(h)return b.call(h,h.__data__,f)}}return null}function c(b){var c=[],d,e,f;for(var g=0,h=a.length;g<h;g++){e=a[g];for(var i=0,j=e.length;i<j;i++)if(f=e[i])c.push(d=b(f)),d.parentNode=f}return V(c)}function b(b){var c=[],d,e,f,g;for(var h=0,i=a.length;h<i;h++){f=a[h],c.push(d=[]),d.parentNode=f.parentNode;for(var j=0,k=f.length;j<k;j++)(g=f[j])?(d.push(e=b(g)),e&&"__data__"in g&&(e.__data__=g.__data__)):d.push(null)}return V(c)}a.select=function(a){return b(function(b){return S(a,b)})},a.selectAll=function(a){return c(function(b){return T(a,b)})},a.filter=function(b){var c=[],d,e,f;for(var g=0,h=a.length;g<h;g++){e=a[g],c.push(d=[]),d.parentNode=e.parentNode;for(var i=0,j=e.length;i<j;i++)(f=e[i])&&b.call(f,f.__data__,i)&&d.push(f)}return V(c)},a.map=function(b){var c,d;for(var e=0,f=a.length;e<f;e++){c=a[e];for(var g=0,h=c.length;g<h;g++)if(d=c[g])d.__data__=b.call(d,d.__data__,g)}return a},a.data=function(b,c){function g(a,b){var g=0,h=a.length,i=b.length,j=Math.min(h,i),k=Math.max(h,i),l=[],m=[],n=[],o,p;if(c){var q={},r=[],s,t=b.length;for(g=0;g<h;g++)s=c.call(o=a[g],o.__data__,g),s in q?n[t++]=o:q[s]=o,r.push(s);for(g=0;g<i;g++)o=q[s=c.call(b,p=b[g],g)],o?(o.__data__=p,l[g]=o,m[g]=n[g]=null):(m[g]=Y(p),l[g]=n[g]=null),delete q[s];for(g=0;g<h;g++)r[g]in q&&(n[g]=a[g])}else{for(;g<j;g++)o=a[g],p=b[g],o?(o.__data__=p,l[g]=o,m[g]=n[g]=null):(m[g]=Y(p),l[g]=n[g]=null);for(;g<i;g++)m[g]=Y(b[g]),l[g]=n[g]=null;for(;g<k;g++)n[g]=a[g],m[g]=l[g]=null}m.parentNode=l.parentNode=n.parentNode=a.parentNode,d.push(m),e.push(l),f.push(n)}var d=[],e=[],f=[],h=-1,i=a.length,j;if(typeof b=="function")while(++h<i)g(j=a[h],b.call(j,j.parentNode.__data__,h));else while(++h<i)g(j=a[h],b);var k=V(e);k.enter=function(){return W(d)},k.exit=function(){return V(f)};return k},a.each=function(b){for(var c=0,d=a.length;c<d;c++){var e=a[c];for(var f=0,g=e.length;f<g;f++){var h=e[f];h&&b.call(h,h.__data__,f)}}return a},a.empty=function(){return!d(function(){return!0})},a.node=function(){return d(function(){return this})},a.attr=function(b,c){function j(){var a=c.apply(this,arguments);a==null?this.removeAttributeNS(b.space,b.local):this.setAttributeNS(b.space,b.local,a)}function i(){var a=c.apply(this,arguments);a==null?this.removeAttribute(b):this.setAttribute(b,a)}function h(){this.setAttributeNS(b.space,b.local,c)}function g(){this.setAttribute(b,c)}function f(){this.removeAttributeNS(b.space,b.local)}function e(){this.removeAttribute(b)}b=d3.ns.qualify(b);if(arguments.length<2)return d(b.local?function(){return this.getAttributeNS(b.space,b.local)}:function(){return this.getAttribute(b)});return a.each(c==null?b.local?f:e:typeof c=="function"?b.local?j:i:b.local?h:g)},a.classed=function(b,c){function i(){(c.apply(this,arguments)?f:h).call(this)}function h(){if(a=this.classList)return a.remove(b);var a=this.className,c=a.baseVal!=null,d=c?a.baseVal:a;d=g(d.replace(e," ")),c?a.baseVal=d:this.className=d}function f(){if(a=this.classList)return a.add(b);var a=this.className,c=a.baseVal!=null,d=c?a.baseVal:a;e.lastIndex=0,e.test(d)||(d=g(d+" "+b),c?a.baseVal=d:this.className=d)}var e=new RegExp("(^|\\s+)"+d3.requote(b)+"(\\s+|$)","g");if(arguments.length<2)return d(function(){if(a=this.classList)return a.contains(b);var a=this.className;e.lastIndex=0;return e.test(a.baseVal!=null?a.baseVal:a)});return a.each(typeof c=="function"?i:c?f:h)},a.style=function(b,c,e){function h(){var a=c.apply(this,arguments);a==null?this.style.removeProperty(b):this.style.setProperty(b,a,e)}function g(){this.style.setProperty(b,c,e)}function f(){this.style.removeProperty(b)}arguments.length<3&&(e="");if(arguments.length<2)return d(function(){return window.getComputedStyle(this,null).getPropertyValue(b)});return a.each(c==null?f:typeof c=="function"?h:g)},a.property=function(b,c){function g(){var a=c.apply(this,arguments);a==null?delete this[b]:this[b]=a}function f(){this[b]=c}function e(){delete this[b]}b=d3.ns.qualify(b);if(arguments.length<2)return d(function(){return this[b]});return a.each(c==null?e:typeof c=="function"?g:f)},a.text=function(b){function e(){this.textContent=b.apply(this,arguments)}function c(){this.textContent=b}if(arguments.length<1)return d(function(){return this.textContent});return a.each(typeof b=="function"?e:c)},a.html=function(b){function e(){this.innerHTML=b.apply(this,arguments)}function c(){this.innerHTML=b}if(arguments.length<1)return d(function(){return this.innerHTML});return a.each(typeof b=="function"?e:c)},a.append=function(a){function d(b){return b.appendChild(document.createElementNS(a.space,a.local))}function c(b){return b.appendChild(document.createElement(a))}a=d3.ns.qualify(a);return b(a.local?d:c)},a.insert=function(a,c){function e(b){return b.insertBefore(document.createElementNS(a.space,a.local),S(c,b))}function d(b){return b.insertBefore(document.createElement(a),S(c,b))}a=d3.ns.qualify(a);return b(a.local?e:d)},a.remove=function(){return a.each(function(){var a=this.parentNode;a&&a.removeChild(this)})},a.sort=function(b){b=X.apply(this,arguments);for(var c=0,d=a.length;c<d;c++){var e=a[c];e.sort(b);for(var f=1,g=e.length,h=e[0];f<g;f++){var i=e[f];i&&(h&&h.parentNode.insertBefore(i,h.nextSibling),h=i)}}return a},a.on=function(b,c,d){arguments.length<3&&(d=!1);var e=b.indexOf("."),f=e===-1?b:b.substring(0,e),g="__on"+b;return a.each(function(a,b){function h(a){var d=d3.event;d3.event=a;try{c.call(this,e.__data__,b)}finally{d3.event=d}}this[g]&&this.removeEventListener(f,this[g],d),c&&this.addEventListener(f,this[g]=h,d);var e=this})},a.transition=function(){return _(a)},a.call=h;return a}function R(a,b,c){function g(a){return Math.round(f(a)*255)}function f(a){a>360?a-=360:a<0&&(a+=360);if(a<60)return d+(e-d)*a/60;if(a<180)return e;if(a<240)return d+(e-d)*(240-a)/60;return d}var d,e;a=a%360,a<0&&(a+=360),b=b<0?0:b>1?1:b,c=c<0?0:c>1?1:c,e=c<=.5?c*(1+b):c+b-c*b,d=2*c-e;return H(g(a+120),g(a),g(a-120))}function Q(a,b,c){this.h=a,this.s=b,this.l=c}function P(a,b,c){return new Q(a,b,c)}function M(a){var b=parseFloat(a);return a.charAt(a.length-1)==="%"?Math.round(b*2.55):b}function L(a,b,c){var d=Math.min(a/=255,b/=255,c/=255),e=Math.max(a,b,c),f=e-d,g,h,i=(e+d)/2;f?(h=i<.5?f/(e+d):f/(2-e-d),a==e?g=(b-c)/f+(b<c?6:0):b==e?g=(c-a)/f+2:g=(a-b)/f+4,g*=60):h=g=0;return P(g,h,i)}function K(a,b,c){var d=0,e=0,f=0,g,h,i;g=/([a-z]+)\((.*)\)/i.exec(a);if(g){h=g[2].split(",");switch(g[1]){case"hsl":return c(parseFloat(h[0]),parseFloat(h[1])/100,parseFloat(h[2])/100);case"rgb":return b(M(h[0]),M(h[1]),M(h[2]))}}if(i=N[a])return b(i.r,i.g,i.b);a!=null&&a.charAt(0)==="#"&&(a.length===4?(d=a.charAt(1),d+=d,e=a.charAt(2),e+=e,f=a.charAt(3),f+=f):a.length===7&&(d=a.substring(1,3),e=a.substring(3,5),f=a.substring(5,7)),d=parseInt(d,16),e=parseInt(e,16),f=parseInt(f,16));return b(d,e,f)}function J(a){return a<16?"0"+a.toString(16):a.toString(16)}function I(a,b,c){this.r=a,this.g=b,this.b=c}function H(a,b,c){return new I(a,b,c)}function G(a,b){b=1/(b-(a=+a));return function(c){return Math.max(0,Math.min(1,(c-a)*b))}}function F(a,b){b=1/(b-(a=+a));return function(c){return(c-a)*b}}function E(a){return a in D||/\bcolor\b/.test(a)?d3.interpolateRgb:d3.interpolate}function B(a){return a<1/2.75?7.5625*a*a:a<2/2.75?7.5625*(a-=1.5/2.75)*a+.75:a<2.5/2.75?7.5625*(a-=2.25/2.75)*a+.9375:7.5625*(a-=2.625/2.75)*a+.984375}function A(a){a||(a=1.70158);return function(b){return b*b*((a+1)*b-a)}}function z(a,b){var c;arguments.length<2&&(b=.45),arguments.length<1?(a=1,c=b/4):c=b/(2*Math.PI)*Math.asin(1/a);return function(d){return 1+a*Math.pow(2,10*-d)*Math.sin((d-c)*2*Math.PI/b)}}function y(a){return 1-Math.sqrt(1-a*a)}function x(a){return Math.pow(2,10*(a-1))}function w(a){return 1-Math.cos(a*Math.PI/2)}function v(a){return function(b){return Math.pow(b,a)}}function u(a){return a}function t(a){return function(b){return.5*(b<.5?a(2*b):2-a(2-2*b))}}function s(a){return function(b){return 1-a(1-b)}}function n(a){var b=a.lastIndexOf("."),c=b>=0?a.substring(b):(b=a.length,""),d=[];while(b>0)d.push(a.substring(b-=3,b+3));return d.reverse().join(",")+c}function m(a){return a+""}function j(a){var b={},c=[];b.add=function(a){for(var d=0;d<c.length;d++)if(c[d].listener==a)return b;c.push({listener:a,on:!0});return b},b.remove=function(a){for(var d=0;d<c.length;d++){var e=c[d];if(e.listener==a){e.on=!1,c=c.slice(0,d).concat(c.slice(d+1));break}}return b},b.dispatch=function(){var a=c;for(var b=0,d=a.length;b<d;b++){var e=a[b];e.on&&e.listener.apply(this,arguments)}};return b}function h(a){a.apply(this,(arguments[0]=this,arguments));return this}function g(a){return a.replace(/(^\s+)|(\s+$)/g,"").replace(/\s+/g," ")}function f(a){return a==null}function e(a){return a.length}function c(a){return Array.prototype.slice.call(a)}function b(a){var b=-1,c=a.length,d=[];while(++b<c)d.push(a[b]);return d}d3={version:"1.29.4"},Date.now||(Date.now=function(){return+(new Date)}),Object.create||(Object.create=function(a){function b(){}b.prototype=a;return new b});var a=c;try{a(document.documentElement.childNodes)[0].nodeType}catch(d){a=b}d3.functor=function(a){return typeof a=="function"?a:function(){return a}},d3.rebind=function(a,b){return function(){var c=b.apply(a,arguments);return arguments.length?a:c}},d3.ascending=function(a,b){return a<b?-1:a>b?1:a>=b?0:NaN},d3.descending=function(a,b){return b<a?-1:b>a?1:b>=a?0:NaN},d3.min=function(a,b){var c=-1,d=a.length,e,f;if(arguments.length===1){while(++c<d&&((e=a[c])==null||e!=e))e=undefined;while(++c<d)(f=a[c])!=null&&e>f&&(e=f)}else{while(++c<d&&((e=b.call(a,a[c],c))==null||e!=e))e=undefined;while(++c<d)(f=b.call(a,a[c],c))!=null&&e>f&&(e=f)}return e},d3.max=function(a,b){var c=-1,d=a.length,e,f;if(arguments.length===1){while(++c<d&&((e=a[c])==null||e!=e))e=undefined;while(++c<d)(f=a[c])!=null&&f>e&&(e=f)}else{while(++c<d&&((e=b.call(a,a[c],c))==null||e!=e))e=undefined;while(++c<d)(f=b.call(a,a[c],c))!=null&&f>e&&(e=f)}return e},d3.sum=function(a,b){var c=0,d=a.length,e,f=-1;if(arguments.length===1)while(++f<d)isNaN(e=+a[f])||(c+=e);else while(++f<d)isNaN(e=+b.call(a,a[f],f))||(c+=e);return c},d3.quantile=function(a,b){var c=(a.length-1)*b+1,d=Math.floor(c),e=a[d-1],f=c-d;return f?e+f*(a[d]-e):e},d3.zip=function(){if(!(f=arguments.length))return[];for(var a=-1,b=d3.min(arguments,e),c=Array(b);++a<b;)for(var d=-1,f,g=c[a]=Array(f);++d<f;)g[d]=arguments[d][a];return c},d3.bisectLeft=function(a,b,c,d){arguments.length<3&&(c=0),arguments.length<4&&(d=a.length);while(c<d){var e=c+d>>1;a[e]<b?c=e+1:d=e}return c},d3.bisect=d3.bisectRight=function(a,b,c,d){arguments.length<3&&(c=0),arguments.length<4&&(d=a.length);while(c<d){var e=c+d>>1;b<a[e]?d=e:c=e+1}return c},d3.first=function(a,b){var c=0,d=a.length,e=a[0],f;arguments.length===1&&(b=d3.ascending);while(++c<d)b.call(a,e,f=a[c])>0&&(e=f);return e},d3.last=function(a,b){var c=0,d=a.length,e=a[0],f;arguments.length===1&&(b=d3.ascending);while(++c<d)b.call(a,e,f=a[c])<=0&&(e=f);return e},d3.nest=function(){function g(a,d){if(d>=b.length)return a;var e=[],f=c[d++],h;for(h in a)e.push({key:h,values:g(a[h],d)});f&&e.sort(function(a,b){return f(a.key,b.key)});return e}function f(c,g){if(g>=b.length)return e?e.call(a,c):d?c.sort(d):c;var h=-1,i=c.length,j=b[g++],k,l,m={};while(++h<i)(k=j(l=c[h]))in m?m[k].push(l):m[k]=[l];for(k in m)m[k]=f(m[k],g);return m}var a={},b=[],c=[],d,e;a.map=function(a){return f(a,0)},a.entries=function(a){return g(f(a,0),0)},a.key=function(c){b.push(c);return a},a.sortKeys=function(d){c[b.length-1]=d;return a},a.sortValues=function(b){d=b;return a},a.rollup=function(b){e=b;return a};return a},d3.keys=function(a){var b=[];for(var c in a)b.push(c);return b},d3.values=function(a){var b=[];for(var c in a)b.push(a[c]);return b},d3.entries=function(a){var b=[];for(var c in a)b.push({key:c,value:a[c]});return b},d3.permute=function(a,b){var c=[],d=-1,e=b.length;while(++d<e)c[d]=a[b[d]];return c},d3.merge=function(a){return Array.prototype.concat.apply([],a)},d3.split=function(a,b){var c=[],d=[],e,g=-1,h=a.length;arguments.length<2&&(b=f);while(++g<h)b.call(d,e=a[g],g)?d=[]:(d.length||c.push(d),d.push(e));return c},d3.range=function(a,b,c){arguments.length<3&&(c=1,arguments.length<2&&(b=a,a=0));if((b-a)/c==Infinity)throw new Error("infinite range");var d=[],e=-1,f;if(c<0)while((f=a+c*++e)>b)d.push(f);else while((f=a+c*++e)<b)d.push(f);return d},d3.requote=function(a){return a.replace(i,"\\$&")};var i=/[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g;d3.round=function(a,b){return b?Math.round(a*Math.pow(10,b))*Math.pow(10,-b):Math.round(a)},d3.xhr=function(a,b,c){var d=new XMLHttpRequest;arguments.length<3?c=b:b&&d.overrideMimeType&&d.overrideMimeType(b),d.open("GET",a,!0),d.onreadystatechange=function(){d.readyState===4&&c(d.status<300?d:null)},d.send(null)},d3.text=function(a,b,c){function d(a){c(a&&a.responseText)}arguments.length<3&&(c=b,b=null),d3.xhr(a,b,d)},d3.json=function(a,b){d3.text(a,"application/json",function(a){b(a?JSON.parse(a):null)})},d3.html=function(a,b){d3.text(a,"text/html",function(a){if(a!=null){var c=document.createRange();c.selectNode(document.body),a=c.createContextualFragment(a)}b(a)})},d3.xml=function(a,b,c){function d(a){c(a&&a.responseXML)}arguments.length<3&&(c=b,b=null),d3.xhr(a,b,d)},d3.ns={prefix:{svg:"http://www.w3.org/2000/svg",xhtml:"http://www.w3.org/1999/xhtml",xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"},qualify:function(a){var b=a.indexOf(":");return b<0?a:{space:d3.ns.prefix[a.substring(0,b)],local:a.substring(b+1)}}},d3.dispatch=function(a){var b={},c;for(var d=0,e=arguments.length;d<e;d++)c=arguments[d],b[c]=j(c);return b},d3.format=function(a){var b=k.exec(a),c=b[1]||" ",d=b[3]||"",e=b[5],f=+b[6],g=b[7],h=b[8],i=b[9],j=!1,o=!1;h&&(h=h.substring(1)),e&&(c="0",g&&(f-=Math.floor((f-1)/4)));switch(i){case"n":g=!0,i="g";break;case"%":j=!0,i="f";break;case"p":j=!0,i="r";break;case"d":o=!0,h="0"}i=l[i]||m;return function(a){var b=j?a*100:+a,k=b<0&&(b=-b)?"−":d;if(o&&b%1)return"";a=i(b,h);if(e){var l=a.length+k.length;l<f&&(a=Array(f-l+1).join(c)+a),g&&(a=n(a)),a=k+a}else{g&&(a=n(a)),a=k+a;var l=a.length;l<f&&(a=Array(f-l+1).join(c)+a)}j&&(a+="%");return a}};var k=/(?:([^{])?([<>=^]))?([+\- ])?(#)?(0)?([0-9]+)?(,)?(\.[0-9]+)?([a-zA-Z%])?/,l={g:function(a,b){return a.toPrecision(b)},e:function(a,b){return a.toExponential(b)},f:function(a,b){return a.toFixed(b)},r:function(a,b){var c=1+Math.floor(1e-15+Math.log(a)/Math.LN10);return d3.round(a,b-c).toFixed(Math.max(0,b-c))}},o=v(2),p=v(3),q={linear:function(){return u},poly:v,quad:function(){return o},cubic:function(){return p},sin:function(){return w},exp:function(){return x},circle:function(){return y},elastic:z,back:A,bounce:function(){return B}},r={"in":function(a){return a},out:s,"in-out":t,"out-in":function(a){return t(s(a))}};d3.ease=function(a){var b=a.indexOf("-"),c=b>=0?a.substring(0,b):a,d=b>=0?a.substring(b+1):"in";return r[d](q[c].apply(null,Array.prototype.slice.call(arguments,1)))},d3.event=null,d3.interpolate=function(a,b){var c=d3.interpolators.length,d;while(--c>=0&&!(d=d3.interpolators[c](a,b)));return d},d3.interpolateNumber=function(a,b){b-=a;return function(c){return a+b*c}},d3.interpolateRound=function(a,b){b-=a;return function(c){return Math.round(a+b*c)}},d3.interpolateString=function(a,b){var c,d,e,f=0,g=0,h=[],i=[],j,k;C.lastIndex=0;for(d=0;c=C.exec(b);++d)c.index&&h.push(b.substring(f,g=c.index)),i.push({i:h.length,x:c[0]}),h.push(null),f=C.lastIndex;f<b.length&&h.push(b.substring(f));for(d=0,j=i.length;(c=C.exec(a))&&d<j;++d){k=i[d];if(k.x==c[0]){if(k.i)if(h[k.i+1]==null){h[k.i-1]+=k.x,h.splice(k.i,1);for(e=d+1;e<j;++e)i[e].i--}else{h[k.i-1]+=k.x+h[k.i+1],h.splice(k.i,2);for(e=d+1;e<j;++e)i[e].i-=2}else if(h[k.i+1]==null)h[k.i]=k.x;else{h[k.i]=k.x+h[k.i+1],h.splice(k.i+1,1);for(e=d+1;e<j;++e)i[e].i--}i.splice(d,1),j--,d--}else k.x=d3.interpolateNumber(parseFloat(c[0]),parseFloat(k.x))}while(d<j)k=i.pop(),h[k.i+1]==null?h[k.i]=k.x:(h[k.i]=k.x+h[k.i+1],h.splice(k.i+1,1)),j--;if(h.length===1)return h[0]==null?i[0].x:function(){return b};return function(a){for(d=0;d<j;++d)h[(k=i[d]).i]=k.x(a);return h.join("")}},d3.interpolateRgb=function(a,b){a=d3.rgb(a),b=d3.rgb(b);var c=a.r,d=a.g,e=a.b,f=b.r-c,g=b.g-d,h=b.b-e;return function(a){return"rgb("+Math.round(c+f*a)+","+Math.round(d+g*a)+","+Math.round(e+h*a)+")"}},d3.interpolateHsl=function(a,b){a=d3.hsl(a),b=d3.hsl(b);var c=a.h,d=a.s,e=a.l,f=b.h-c,g=b.s-d,h=b.l-e;return function(a){return R(c+f*a,d+g*a,e+h*a).toString()}},d3.interpolateArray=function(a,b){var c=[],d=[],e=a.length,f=b.length,g=Math.min(a.length,b.length),h;for(h=0;h<g;++h)c.push(d3.interpolate(a[h],b[h]));for(;h<e;++h)d[h]=a[h];for(;h<f;++h)d[h]=b[h];return function(a){for(h=0;h<g;++h)d[h]=c[h](a);return d}},d3.interpolateObject=function(a,b){var c={},d={},e;for(e in a)e in b?c[e]=E(e)(a[e],b[e]):d[e]=a[e];for(e in b)e in a||(d[e]=b[e]);return function(a){for(e in c)d[e]=c[e](a);return d}};var C=/[-+]?(?:\d+\.\d+|\d+\.|\.\d+|\d+)(?:[eE][-]?\d+)?/g,D={background:1,fill:1,stroke:1};d3.interpolators=[d3.interpolateObject,function(a,b){return b instanceof Array&&d3.interpolateArray(a,b)},function(a,b){return typeof b=="string"&&d3.interpolateString(String(a),b)},function(a,b){return(typeof b=="string"?b in N||/^(#|rgb\(|hsl\()/.test(b):b instanceof I||b instanceof Q)&&d3.interpolateRgb(String(a),b)},function(a,b){return typeof b=="number"&&d3.interpolateNumber(+a,b)}],d3.rgb=function(a,b,c){return arguments.length===1?K(""+a,H,R):H(~~a,~~b,~~c)},I.prototype.brighter=function(a){a=Math.pow(.7,arguments.length?a:1);var b=this.r,c=this.g,d=this.b,e=30;if(!b&&!c&&!d)return H(e,e,e);b&&b<e&&(b=e),c&&c<e&&(c=e),d&&d<e&&(d=e);return H(Math.min(255,Math.floor(b/a)),Math.min(255,Math.floor(c/a)),Math.min(255,Math.floor(d/a)))},I.prototype.darker=function(a){a=Math.pow(.7,arguments.length?a:1);return H(Math.max(0,Math.floor(a*this.r)),Math.max(0,Math.floor(a*this.g)),Math.max(0,Math.floor(a*this.b)))},I.prototype.hsl=function(){return L(this.r,this.g,this.b)},I.prototype.toString=function(){return"#"+J(this.r)+J(this.g)+J(this.b)};var N={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"};for(var O in N)N[O]=K(N[O],H,R);d3.hsl=function(a,b,c){return arguments.length===1?K(""+a,L,P):P(+a,+b,+c)},Q.prototype.brighter=function(a){a=Math.pow(.7,arguments.length?a:1);return P(this.h,this.s,this.l/a)},Q.prototype.darker=function(a){a=Math.pow(.7,arguments.length?a:1);return P(this.h,this.s,a*this.l)},Q.prototype.rgb=function(){return R(this.h,this.s,this.l)},Q.prototype.toString=function(){return"hsl("+this.h+","+this.s*100+"%,"+this.l*100+"%)"};var S=function(a,b){return b.querySelector(a)},T=function(b,c){return a(c.querySelectorAll(b))};typeof Sizzle=="function"&&(S=function(a,b){return Sizzle(a,b)[0]},T=function(a,b){return Sizzle.uniqueSort(Sizzle(a,b))});var U=V([[document]]);U[0].parentNode=document.documentElement,d3.select=function(a){return typeof a=="string"?U.select(a):V([[a]])},d3.selectAll=function(b){return typeof <add>b=="string"?U.selectAll(b):V([a(b)])},d3.transition=U.transition;var Z=0,$=0,bb=null,bc,bd;d3.timer=function(a,b){var c=Date.now(),d=!1,e,f=bb;if(arguments.length<2)b=0;else if(!isFinite(b))return;while(f){if(f.callback===a){f.then=c,f.delay=b,d=!0;break}e=f,f=f.next}d||(bb={callback:a,then:c,delay:b,next:bb}),bc||(bd=clearTimeout(bd),bc=1,bg(be))},d3.timer.flush=function(){var a,b=Date.now(),c=bb;while(c)a=b-c.then,c.delay||(c.flush=c.callback(a)),c=c.next;bf()};var bg=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(a){setTimeout(a,17)};d3.scale={},d3.scale.linear=function(){function h(a){return e(a)}function g(){var g=a.length==2?bq:br,i=d?G:F;e=g(a,b,i,c),f=g(b,a,i,d3.interpolate);return h}var a=[0,1],b=[0,1],c=d3.interpolate,d=!1,e,f;h.invert=function(a){return f(a)},h.domain=function(b){if(!arguments.length)return a;a=b.map(Number);return g()},h.range=function(a){if(!arguments.length)return b;b=a;return g()},h.rangeRound=function(a){return h.range(a).interpolate(d3.interpolateRound)},h.clamp=function(a){if(!arguments.length)return d;d=a;return g()},h.interpolate=function(a){if(!arguments.length)return c;c=a;return g()},h.ticks=function(b){return bo(a,b)},h.tickFormat=function(b){return bp(a,b)},h.nice=function(){bj(a,bm);return g()};return g()},d3.scale.log=function(){function d(c){return a(b(c))}var a=d3.scale.linear(),b=bs,c=b.pow;d.invert=function(b){return c(a.invert(b))},d.domain=function(e){if(!arguments.length)return a.domain().map(c);b=e[0]<0?bt:bs,c=b.pow,a.domain(e.map(b));return d},d.nice=function(){a.domain(bj(a.domain(),bk));return d},d.ticks=function(){var d=bi(a.domain()),e=[];if(d.every(isFinite)){var f=Math.floor(d[0]),g=Math.ceil(d[1]),h=c(d[0]),i=c(d[1]);if(b===bt){e.push(c(f));for(;f++<g;)for(var j=9;j>0;j--)e.push(c(f)*j)}else{for(;f<g;f++)for(var j=1;j<10;j++)e.push(c(f)*j);e.push(c(f))}for(f=0;e[f]<h;f++);for(g=e.length;e[g-1]>i;g--);e=e.slice(f,g)}return e},d.tickFormat=function(){return bu};return bl(d,a)},bs.pow=function(a){return Math.pow(10,a)},bt.pow=function(a){return-Math.pow(10,-a)},d3.scale.pow=function(){function e(b){return a(c(b))}var a=d3.scale.linear(),b=1,c=Number,d=c;e.invert=function(b){return d(a.invert(b))},e.domain=function(f){if(!arguments.length)return a.domain().map(d);c=bv(b),d=bv(1/b),a.domain(f.map(c));return e},e.ticks=function(a){return bo(e.domain(),a)},e.tickFormat=function(a){return bp(e.domain(),a)},e.nice=function(){return e.domain(bj(e.domain(),bm))},e.exponent=function(a){if(!arguments.length)return b;var c=e.domain();b=a;return e.domain(c)};return bl(e,a)},d3.scale.sqrt=function(){return d3.scale.pow().exponent(.5)},d3.scale.ordinal=function(){function f(d){var e=d in b?b[d]:b[d]=a.push(d)-1;return c[e%c.length]}var a=[],b={},c=[],d=0,e=bh;f.domain=function(c){if(!arguments.length)return a;a=c,b={};var d=-1,g=-1,h=a.length;while(++d<h)c=a[d],c in b||(b[c]=++g);e();return f},f.range=function(a){if(!arguments.length)return c;c=a,e=bh;return f},f.rangePoints=function(b,g){arguments.length<2&&(g=0),(e=function(){var e=b[0],f=b[1],h=(f-e)/(a.length-1+g);c=a.length==1?[(e+f)/2]:d3.range(e+h*g/2,f+h/2,h),d=0})();return f},f.rangeBands=function(b,g){arguments.length<2&&(g=0),(e=function(){var e=b[0],f=b[1],h=(f-e)/(a.length+g);c=d3.range(e+h*g,f,h),d=h*(1-g)})();return f},f.rangeRoundBands=function(b,g){arguments.length<2&&(g=0),(e=function(){var e=b[0],f=b[1],h=f-e,i=Math.floor(h/(a.length+g)),j=h-(a.length-g)*i;c=d3.range(e+Math.round(j/2),f,i),d=Math.round(i*(1-g))})();return f},f.rangeBand=function(){return d};return f},d3.scale.category10=function(){return d3.scale.ordinal().range(bw)},d3.scale.category20=function(){return d3.scale.ordinal().range(bx)},d3.scale.category20b=function(){return d3.scale.ordinal().range(by)},d3.scale.category20c=function(){return d3.scale.ordinal().range(bz)};var bw=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],bx=["#1f77b4","#aec7e8","#ff7f0e","#ffbb78","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5","#8c564b","#c49c94","#e377c2","#f7b6d2","#7f7f7f","#c7c7c7","#bcbd22","#dbdb8d","#17becf","#9edae5"],by=["#393b79","#5254a3","#6b6ecf","#9c9ede","#637939","#8ca252","#b5cf6b","#cedb9c","#8c6d31","#bd9e39","#e7ba52","#e7cb94","#843c39","#ad494a","#d6616b","#e7969c","#7b4173","#a55194","#ce6dbd","#de9ed6"],bz=["#3182bd","#6baed6","#9ecae1","#c6dbef","#e6550d","#fd8d3c","#fdae6b","#fdd0a2","#31a354","#74c476","#a1d99b","#c7e9c0","#756bb1","#9e9ac8","#bcbddc","#dadaeb","#636363","#969696","#bdbdbd","#d9d9d9"];d3.scale.quantile=function(){function e(a){if(isNaN(a=+a))return NaN;return b[d3.bisect(c,a)]}function d(){var d=0,e=a.length,f=b.length;c.length=Math.max(0,f-1);while(++d<f)c[d-1]=d3.quantile(a,d/f)}var a=[],b=[],c=[];e.domain=function(b){if(!arguments.length)return a;a=b.filter(function(a){return!isNaN(a)}).sort(d3.ascending),d();return e},e.range=function(a){if(!arguments.length)return b;b=a,d();return e},e.quantiles=function(){return c};return e},d3.scale.quantize=function(){function f(b){return e[Math.max(0,Math.min(d,Math.floor(c*(b-a))))]}var a=0,b=1,c=2,d=1,e=[0,1];f.domain=function(d){if(!arguments.length)return[a,b];a=d[0],b=d[1],c=e.length/(b-a);return f},f.range=function(g){if(!arguments.length)return e;e=g,c=e.length/(b-a),d=e.length-1;return f};return f},d3.svg={},d3.svg.arc=function(){function e(){var e=a.apply(this,arguments),f=b.apply(this,arguments),g=c.apply(this,arguments)+bA,h=d.apply(this,arguments)+bA,i=h-g,j=i<Math.PI?"0":"1",k=Math.cos(g),l=Math.sin(g),m=Math.cos(h),n=Math.sin(h);return i>=bB?e?"M0,"+f+"A"+f+","+f+" 0 1,1 0,"+ -f+"A"+f+","+f+" 0 1,1 0,"+f+"M0,"+e+"A"+e+","+e+" 0 1,1 0,"+ -e+"A"+e+","+e+" 0 1,1 0,"+e+"Z":"M0,"+f+"A"+f+","+f+" 0 1,1 0,"+ -f+"A"+f+","+f+" 0 1,1 0,"+f+"Z":e?"M"+f*k+","+f*l+"A"+f+","+f+" 0 "+j+",1 "+f*m+","+f*n+"L"+e*m+","+e*n+"A"+e+","+e+" 0 "+j+",0 "+e*k+","+e*l+"Z":"M"+f*k+","+f*l+"A"+f+","+f+" 0 "+j+",1 "+f*m+","+f*n+"L0,0"+"Z"}var a=bC,b=bD,c=bE,d=bF;e.innerRadius=function(b){if(!arguments.length)return a;a=d3.functor(b);return e},e.outerRadius=function(a){if(!arguments.length)return b;b=d3.functor(a);return e},e.startAngle=function(a){if(!arguments.length)return c;c=d3.functor(a);return e},e.endAngle=function(a){if(!arguments.length)return d;d=d3.functor(a);return e},e.centroid=function(){var e=(a.apply(this,arguments)+b.apply(this,arguments))/2,f=(c.apply(this,arguments)+d.apply(this,arguments))/2+bA;return[Math.cos(f)*e,Math.sin(f)*e]};return e};var bA=-Math.PI/2,bB=2*Math.PI-1e-6;d3.svg.line=function(){return bG(Object)};var bK={linear:bL,"step-before":bM,"step-after":bN,basis:bT,"basis-open":bU,"basis-closed":bV,bundle:bW,cardinal:bQ,"cardinal-open":bO,"cardinal-closed":bP,monotone:cd},bY=[0,2/3,1/3,0],bZ=[0,1/3,2/3,0],b$=[0,1/6,2/3,1/6];d3.svg.line.radial=function(){var a=bG(ce);a.radius=a.x,delete a.x,a.angle=a.y,delete a.y;return a},d3.svg.area=function(){return cf(Object)},d3.svg.area.radial=function(){var a=cf(ce);a.radius=a.x,delete a.x,a.innerRadius=a.x0,delete a.x0,a.outerRadius=a.x1,delete a.x1,a.angle=a.y,delete a.y,a.startAngle=a.y0,delete a.y0,a.endAngle=a.y1,delete a.y1;return a},d3.svg.chord=function(){function j(a,b,c,d){return"Q 0,0 "+d}function i(a,b){return"A"+a+","+a+" 0 0,1 "+b}function h(a,b){return a.a0==b.a0&&a.a1==b.a1}function g(a,b,f,g){var h=b.call(a,f,g),i=c.call(a,h,g),j=d.call(a,h,g)+bA,k=e.call(a,h,g)+bA;return{r:i,a0:j,a1:k,p0:[i*Math.cos(j),i*Math.sin(j)],p1:[i*Math.cos(k),i*Math.sin(k)]}}function f(c,d){var e=g(this,a,c,d),f=g(this,b,c,d);return"M"+e.p0+i(e.r,e.p1)+(h(e,f)?j(e.r,e.p1,e.r,e.p0):j(e.r,e.p1,f.r,f.p0)+i(f.r,f.p1)+j(f.r,f.p1,e.r,e.p0))+"Z"}var a=ci,b=cj,c=ck,d=bE,e=bF;f.radius=function(a){if(!arguments.length)return c;c=d3.functor(a);return f},f.source=function(b){if(!arguments.length)return a;a=d3.functor(b);return f},f.target=function(a){if(!arguments.length)return b;b=d3.functor(a);return f},f.startAngle=function(a){if(!arguments.length)return d;d=d3.functor(a);return f},f.endAngle=function(a){if(!arguments.length)return e;e=d3.functor(a);return f};return f},d3.svg.diagonal=function(){function d(d,e){var f=a.call(this,d,e),g=b.call(this,d,e),h=(f.y+g.y)/2,i=[f,{x:f.x,y:h},{x:g.x,y:h},g];i=i.map(c);return"M"+i[0]+"C"+i[1]+" "+i[2]+" "+i[3]}var a=ci,b=cj,c=cn;d.source=function(b){if(!arguments.length)return a;a=d3.functor(b);return d},d.target=function(a){if(!arguments.length)return b;b=d3.functor(a);return d},d.projection=function(a){if(!arguments.length)return c;c=a;return d};return d},d3.svg.diagonal.radial=function(){var a=d3.svg.diagonal(),b=cn,c=a.projection;a.projection=function(a){return arguments.length?c(co(b=a)):b};return a},d3.svg.mouse=function(a){return cq(a,d3.event)};var cp=/WebKit/.test(navigator.userAgent)?-1:0;d3.svg.touches=function(b){var c=d3.event.touches;return c?a(c).map(function(a){var c=cq(b,a);c.identifier=a.identifier;return c}):[]},d3.svg.symbol=function(){function c(c,d){return(ct[a.call(this,c,d)]||ct.circle)(b.call(this,c,d))}var a=cs,b=cr;c.type=function(b){if(!arguments.length)return a;a=d3.functor(b);return c},c.size=function(a){if(!arguments.length)return b;b=d3.functor(a);return c};return c};var ct={circle:function(a){var b=Math.sqrt(a/Math.PI);return"M0,"+b+"A"+b+","+b+" 0 1,1 0,"+ -b+"A"+b+","+b+" 0 1,1 0,"+b+"Z"},cross:function(a){var b=Math.sqrt(a/5)/2;return"M"+ -3*b+","+ -b+"H"+ -b+"V"+ -3*b+"H"+b+"V"+ -b+"H"+3*b+"V"+b+"H"+b+"V"+3*b+"H"+ -b+"V"+b+"H"+ -3*b+"Z"},diamond:function(a){var b=Math.sqrt(a/(2*cv)),c=b*cv;return"M0,"+ -b+"L"+c+",0"+" 0,"+b+" "+ -c+",0"+"Z"},square:function(a){var b=Math.sqrt(a)/2;return"M"+ -b+","+ -b+"L"+b+","+ -b+" "+b+","+b+" "+ -b+","+b+"Z"},"triangle-down":function(a){var b=Math.sqrt(a/cu),c=b*cu/2;return"M0,"+c+"L"+b+","+ -c+" "+ -b+","+ -c+"Z"},"triangle-up":function(a){var b=Math.sqrt(a/cu),c=b*cu/2;return"M0,"+ -c+"L"+b+","+c+" "+ -b+","+c+"Z"}};d3.svg.symbolTypes=d3.keys(ct);var cu=Math.sqrt(3),cv=Math.tan(30*Math.PI/180)})() <ide>\ No newline at end of file <ide><path>src/core/timer.js <ide> var d3_timer_queue = null, <ide> d3_timer_timeout; // is a timeout active? <ide> <ide> // The timer will continue to fire until callback returns true. <del>d3.timer = function(callback) { <del> d3_timer(callback, 0); <del>}; <del> <del>function d3_timer(callback, delay) { <add>d3.timer = function(callback, delay) { <ide> var now = Date.now(), <ide> found = false, <ide> t0, <ide> t1 = d3_timer_queue; <ide> <del> if (!isFinite(delay)) return; <add> if (arguments.length < 2) delay = 0; <add> else if (!isFinite(delay)) return; <ide> <ide> // See if the callback's already in the queue. <ide> while (t1) { <ide> function d3_timer_step() { <ide> <ide> while (t1) { <ide> elapsed = now - t1.then; <del> if (elapsed > t1.delay) t1.flush = t1.callback(elapsed); <add> if (elapsed >= t1.delay) t1.flush = t1.callback(elapsed); <ide> t1 = t1.next; <ide> } <ide> <ide><path>src/core/transition.js <ide> function d3_transition(groups) { <ide> delay[++k] = delayMin; <ide> }); <ide> } <del> d3_timer(step, delayMin); <add> d3.timer(step, delayMin); <ide> return transition; <ide> }; <ide> <ide><path>test/core/timer-test.js <add>require("../env"); <add>require("../../d3"); <add> <add>var vows = require("vows"), <add> assert = require("assert"); <add> <add>var suite = vows.describe("d3.timer"); <add> <add>suite.addBatch({ <add> "timer": { <add> topic: function() { <add> return d3.timer; <add> }, <add> "with no delay": { <add> topic: timer(), <add> "first calls after 17 ms or less": function(info) { <add> assert.inDelta(info.start - info.scheduled, 17, 15); <add> }, <add> "calls until the function returns true": function(info) { <add> assert.equal(info.count, 4); <add> }, <add> "calls every 17 ms": function(info) { <add> assert.inDelta(info.stop - info.start, 17 * 3, 15); <add> } <add> }, <add> "with a specified delay": { <add> topic: timer(250), <add> "first calls after the delay": function(info) { <add> assert.inDelta(info.start - info.scheduled, 250, 15); <add> }, <add> "calls until the function returns true": function(info) { <add> assert.equal(info.count, 4); <add> }, <add> "calls every 17 ms": function(info) { <add> assert.inDelta(info.stop - info.start, 17 * 3, 15); <add> } <add> } <add> } <add>}); <add> <add>function timer(delay) { <add> var args = Array.prototype.slice.call(arguments); <add> return function() { <add> var cb = this.callback, <add> info = {scheduled: Date.now(), count: 0}; <add> <add> args.unshift(function() { <add> var count = ++info.count; <add> if (count === 1) { <add> info.start = Date.now(); <add> } else if (count === 4) { <add> info.stop = Date.now(); <add> cb(null, info); <add> return true; <add> } <add> }); <add> <add> d3.timer.apply(this, args); <add> }; <add>} <add> <add>suite.export(module);
5
Text
Text
add example to fs.promises.readdir
7e911d8b03a838e5ac6bb06c5b313533e89673ef
<ide><path>doc/api/fs.md <ide> will be passed as `Buffer` objects. <ide> If `options.withFileTypes` is set to `true`, the resolved array will contain <ide> [`fs.Dirent`][] objects. <ide> <add>```js <add>const fs = require('fs'); <add> <add>async function print(path) { <add> const files = await fs.promises.readdir(path); <add> for (const file of files) { <add> console.log(file); <add> } <add>} <add>print('./').catch(console.error); <add>``` <add> <ide> ### `fsPromises.readFile(path[, options])` <ide> <!-- YAML <ide> added: v10.0.0
1
Python
Python
remove unused import
22f20b97386652a24bf2e8e363bfa38ca66cb209
<ide><path>keras/callbacks.py <ide> import json <ide> import warnings <ide> import io <del>import sys <ide> <ide> from collections import deque <ide> from collections import OrderedDict
1
Text
Text
add attributes api to release notes [ci skip]
1e791705dcea650a034b7ccb4d922f455648202d
<ide><path>guides/source/5_0_release_notes.md <ide> ToDo... <ide> <ide> ### Active Record attributes API <ide> <del>ToDo... <add>Defines an attribute with a type on a model. It will override the type of existing attributes if needed. <add>This allows control over how values are converted to and from SQL when assigned to a model. <add>It also changes the behavior of values passed to ActiveRecord::Base.where, which lets use our domain objects across much of Active Record, <add>without having to rely on implementation details or monkey patching. <add> <add>Some things that you can achieve with this: <add>* The type detected by Active Record can be overridden. <add>* A default can also be provided. <add>* Attributes do not need to be backed by a database column. <add> <add>```ruby <add> <add># db/schema.rb <add>create_table :store_listings, force: true do |t| <add> t.decimal :price_in_cents <add> t.string :my_string, default: "original default" <add>end <add> <add># app/models/store_listing.rb <add>class StoreListing < ActiveRecord::Base <add>end <add> <add>store_listing = StoreListing.new(price_in_cents: '10.1') <add> <add># before <add>store_listing.price_in_cents # => BigDecimal.new(10.1) <add>StoreListing.new.my_string # => "original default" <add> <add>class StoreListing < ActiveRecord::Base <add> attribute :price_in_cents, :integer # custom type <add> attribute :my_string, :string, default: "new default" # default value <add> attribute :my_default_proc, :datetime, default: -> { Time.now } # default value <add> attribute :field_without_db_column, :integer, array: true <add>end <add> <add># after <add>store_listing.price_in_cents # => 10 <add>StoreListing.new.my_string # => "new default" <add>StoreListing.new.my_default_proc # => 2015-05-30 11:04:48 -0600 <add>model = StoreListing.new(field_without_db_column: ["1", "2", "3"]) <add>model.attributes #=> {field_without_db_column: [1, 2, 3]} <add>``` <add> <add>**Creating Custom Types:** <add> <add>You can define your own custom types, as long as they respond <add>to the methods defined on the value type. The method +deserialize+ or <add>+cast+ will be called on your type object, with raw input from the <add>database or from your controllers. This is useful, for example, when doing custom conversion, <add>like Money data. <add> <add>**Querying:** <add> <add>When `ActiveRecord::Base.where` is called, it will <add>use the type defined by the model class to convert the value to SQL, <add>calling +serialize+ on your type object. <add> <add>This gives the objects ability to specify, how to convert values when performing SQL queries. <add> <add>**Dirty Tracking:** <add> <add>The type of an attribute is given the opportunity to change how dirty <add>tracking is performed. <add> <add>See its <add>[documentation](http://api.rubyonrails.org/classes/ActiveRecord/Attributes/ClassMethods.html) <add>for a detailed write up. <add> <ide> <ide> ### Test Runner <ide> [Pull Request](https://github.com/rails/rails/pull/19216)
1
Python
Python
add dutch tag map
793c62dfda98ee3a690f5f336df669855daad40a
<ide><path>spacy/lang/nl/__init__.py <ide> <ide> from .stop_words import STOP_WORDS <ide> from .lex_attrs import LEX_ATTRS <add>from .tag_map import TAG_MAP <ide> <ide> from ..tokenizer_exceptions import BASE_EXCEPTIONS <ide> from ..norm_exceptions import BASE_NORMS <ide> class DutchDefaults(Language.Defaults): <ide> lex_attr_getters[NORM] = add_lookups(Language.Defaults.lex_attr_getters[NORM], BASE_NORMS) <ide> tokenizer_exceptions = update_exc(BASE_EXCEPTIONS) <ide> stop_words = STOP_WORDS <add> tag_map = TAG_MAP <ide> <ide> <ide> class Dutch(Language): <ide><path>spacy/lang/nl/tag_map.py <add># coding: utf8 <add>from __future__ import unicode_literals <add> <add> <add>TAG_MAP = { <add> "ADJ__Number=Sing": {"pos": "ADJ"}, <add> "ADJ___": {"pos": "ADJ"}, <add> "ADP__AdpType=Prep": {"pos": "ADP"}, <add> "ADP__AdpType=Preppron|Gender=Fem|Number=Sing": {"pos": "ADP"}, <add> "ADP__AdpType=Preppron|Gender=Masc|Number=Plur": {"pos": "ADP"}, <add> "ADP__AdpType=Preppron|Gender=Masc|Number=Sing": {"pos": "ADP"}, <add> "ADV__Number=Sing": {"pos": "ADV"}, <add> "ADV__PunctType=Comm": {"pos": "ADV"}, <add> "ADV___": {"pos": "ADV"}, <add> "Adj_Adj_N_N__Degree=Pos|Number=Sing": {"pos": "ADJ"}, <add> "Adj_Adj_N__Degree=Pos|Number=Plur|Variant=Short": {"pos": "ADJ"}, <add> "Adj_Adj_N__Degree=Pos|Number=Sing": {"pos": "ADJ"}, <add> "Adj_Adj__Case=Nom|Degree=Pos": {"pos": "ADJ"}, <add> "Adj_Adj__Degree=Pos": {"pos": "ADJ"}, <add> "Adj_Adj__Degree=Pos|Variant=Short": {"pos": "ADJ"}, <add> "Adj_Adv__Degree=Pos|Variant=Short": {"pos": "ADJ"}, <add> "Adj_Adv|adv|stell|onverv_deelv__Degree=Pos|Variant=Short": {"pos": "ADJ"}, <add> "Adj_Art__Degree=Pos|Number=Sing": {"pos": "ADJ"}, <add> "Adj_Art__Degree=Pos|Number=Sing|Variant=Short": {"pos": "ADJ"}, <add> "Adj_Conj_V__Degree=Pos|Mood=Sub|VerbForm=Fin": {"pos": "ADJ"}, <add> "Adj_Int|attr|stell|vervneut__Case=Nom|Degree=Pos": {"pos": "ADJ"}, <add> "Adj_Misc_Misc__Degree=Pos": {"pos": "ADJ"}, <add> "Adj_N_Conj_N__Degree=Pos|Number=Sing": {"pos": "ADJ"}, <add> "Adj_N_N_N_N__Degree=Pos|Number=Sing": {"pos": "ADJ"}, <add> "Adj_N_N_N__Degree=Pos|Number=Sing": {"pos": "ADJ"}, <add> "Adj_N_N__Degree=Pos|Number=Sing": {"pos": "ADJ"}, <add> "Adj_N_Num__Definite=Def|Degree=Pos|Number=Sing": {"pos": "ADJ"}, <add> "Adj_N_Prep_Art_Adj_N__Degree=Pos|Gender=Neut|Number=Sing": {"pos": "ADJ"}, <add> "Adj_N_Prep_N_Conj_N__Degree=Pos|Number=Sing": {"pos": "ADJ"}, <add> "Adj_N_Prep_N_N__Degree=Pos|Number=Sing": {"pos": "ADJ"}, <add> "Adj_N_Prep_N__Degree=Pos|Number=Sing": {"pos": "ADJ"}, <add> "Adj_N_Punc__Degree=Pos|Number=Sing": {"pos": "ADJ"}, <add> "Adj_N__Degree=Pos|Number=Plur": {"pos": "ADJ"}, <add> "Adj_N__Degree=Pos|Number=Sing": {"pos": "ADJ"}, <add> "Adj_N__Degree=Pos|Number=Sing|Variant=Short": {"pos": "ADJ"}, <add> "Adj_Num__Definite=Def|Degree=Pos": {"pos": "ADJ"}, <add> "Adj_Num__Definite=Def|Degree=Pos|Variant=Short": {"pos": "ADJ"}, <add> "Adj_Prep|adv|stell|vervneut_voor__Degree=Pos|Variant=Short": {"pos": "ADJ"}, <add> "Adj_Prep|adv|vergr|onverv_voor__Degree=Cmp|Variant=Short": {"pos": "ADJ"}, <add> "Adj_V_Conj_V__Degree=Pos|VerbForm=Inf": {"pos": "ADJ"}, <add> "Adj_V_N__Degree=Pos|Number=Sing|Tense=Past|VerbForm=Part": {"pos": "ADJ"}, <add> "Adj_V|adv|stell|onverv_intrans|inf__Degree=Pos|Variant=Short|VerbForm=Inf": {"pos": "ADJ"}, <add> "Adj_V|adv|stell|onverv_trans|imp__Degree=Pos|Mood=Imp|Variant=Short|VerbForm=Fin": {"pos": "ADJ"}, <add> "Adj|adv|stell|onverv__Degree=Pos|Variant=Short": {"pos": "ADJ"}, <add> "Adj|adv|stell|vervneut__Case=Nom|Degree=Pos|Variant=Short": {"pos": "ADJ"}, <add> "Adj|adv|vergr|onverv__Degree=Cmp|Variant=Short": {"pos": "ADJ"}, <add> "Adj|adv|vergr|vervneut__Case=Nom|Degree=Cmp|Variant=Short": {"pos": "ADJ"}, <add> "Adj|attr|overtr|onverv__Degree=Sup": {"pos": "ADJ"}, <add> "Adj|attr|overtr|vervneut__Case=Nom|Degree=Sup": {"pos": "ADJ"}, <add> "Adj|attr|stell|onverv__Degree=Pos": {"pos": "ADJ"}, <add> "Adj|attr|stell|vervgen__Case=Gen|Degree=Pos": {"pos": "ADJ"}, <add> "Adj|attr|stell|vervneut__Case=Nom|Degree=Pos": {"pos": "ADJ"}, <add> "Adj|attr|vergr|onverv__Degree=Cmp": {"pos": "ADJ"}, <add> "Adj|attr|vergr|vervgen__Case=Gen|Degree=Cmp": {"pos": "ADJ"}, <add> "Adj|attr|vergr|vervneut__Case=Nom|Degree=Cmp": {"pos": "ADJ"}, <add> "Adj|zelfst|overtr|vervneut__Case=Nom|Degree=Sup": {"pos": "ADJ"}, <add> "Adj|zelfst|stell|onverv__Degree=Pos": {"pos": "ADJ"}, <add> "Adj|zelfst|stell|vervmv__Degree=Pos|Number=Plur": {"pos": "ADJ"}, <add> "Adj|zelfst|stell|vervneut__Case=Nom|Degree=Pos": {"pos": "ADJ"}, <add> "Adj|zelfst|vergr|vervneut__Case=Nom|Degree=Cmp": {"pos": "ADJ"}, <add> "Adv_Adj_Conj__Degree=Pos": {"pos": "ADV"}, <add> "Adv_Adj__Degree=Cmp": {"pos": "ADV"}, <add> "Adv_Adj__Degree=Pos": {"pos": "ADV"}, <add> "Adv_Adv_Conj_Adv__PronType=Dem": {"pos": "ADV"}, <add> "Adv_Adv__AdpType=Prep": {"pos": "ADV"}, <add> "Adv_Adv__Degree=Pos": {"pos": "ADV"}, <add> "Adv_Adv__Degree=Pos|PronType=Dem": {"pos": "ADV"}, <add> "Adv_Adv|pron|vrag_deeladv___": {"pos": "ADV"}, <add> "Adv_Art__Degree=Pos|Number=Sing": {"pos": "ADV"}, <add> "Adv_Art__Number=Sing": {"pos": "ADV"}, <add> "Adv_Conj_Adv__AdpType=Preppron|Gender=Masc|Number=Sing": {"pos": "ADV"}, <add> "Adv_Conj_Adv__Degree=Pos": {"pos": "ADV"}, <add> "Adv_Conj_Adv|gew|aanw_neven_gew|aanw__PronType=Dem": {"pos": "ADV"}, <add> "Adv_Conj_Adv|gew|onbep_neven_gew|onbep__PronType=Ind": {"pos": "ADV"}, <add> "Adv_Conj_N__Degree=Pos|Number=Sing": {"pos": "ADV"}, <add> "Adv_Conj__Degree=Pos": {"pos": "ADV"}, <add> "Adv_N__Degree=Pos|Number=Sing": {"pos": "ADV"}, <add> "Adv_Num__Degree=Cmp|PronType=Ind": {"pos": "ADV"}, <add> "Adv_N|gew|aanw_soort|ev|neut__Number=Sing": {"pos": "ADV"}, <add> "Adv_Prep_N__Case=Dat|Degree=Pos|Number=Sing": {"pos": "ADV"}, <add> "Adv_Prep_Pron__AdpType=Preppron|Gender=Masc|Number=Sing": {"pos": "ADV"}, <add> "Adv_Prep__Degree=Pos": {"pos": "ADV"}, <add> "Adv_Prep|gew|aanw_voor__AdpType=Prep": {"pos": "ADV"}, <add> "Adv_Prep|gew|aanw_voor___": {"pos": "ADV"}, <add> "Adv_Pron__Degree=Pos": {"pos": "ADV"}, <add> "Adv|deeladv__PartType=Vbp": {"pos": "ADV"}, <add> "Adv|deelv__PartType=Vbp": {"pos": "ADV"}, <add> "Adv|gew|aanw__PronType=Dem": {"pos": "ADV"}, <add> "Adv|gew|betr__PronType=Rel": {"pos": "ADV"}, <add> "Adv|gew|er__AdvType=Ex": {"pos": "ADV"}, <add> "Adv|gew|geenfunc|overtr|onverv__Degree=Sup": {"pos": "ADV"}, <add> "Adv|gew|geenfunc|stell|onverv__Degree=Pos": {"pos": "ADV"}, <add> "Adv|gew|geenfunc|vergr|onverv__Degree=Cmp": {"pos": "ADV"}, <add> "Adv|gew|onbep__PronType=Ind": {"pos": "ADV"}, <add> "Adv|gew|vrag__PronType=Int": {"pos": "ADV"}, <add> "Adv|pron|aanw__PronType=Dem": {"pos": "ADV"}, <add> "Adv|pron|betr__PronType=Rel": {"pos": "ADV"}, <add> "Adv|pron|er__AdvType=Ex": {"pos": "ADV"}, <add> "Adv|pron|onbep__PronType=Ind": {"pos": "ADV"}, <add> "Adv|pron|vrag__PronType=Int": {"pos": "ADV"}, <add> "Art_Adj_N__AdpType=Prep": {"pos": "DET"}, <add> "Art_Adj_N__Definite=Def|Degree=Sup|Gender=Neut|Number=Sing": {"pos": "DET"}, <add> "Art_Adj__Case=Nom|Definite=Def|Degree=Cmp|Gender=Neut": {"pos": "DET"}, <add> "Art_Adj__Case=Nom|Definite=Def|Degree=Sup|Gender=Neut": {"pos": "DET"}, <add> "Art_Adj__Definite=Def|Degree=Cmp|Gender=Neut": {"pos": "DET"}, <add> "Art_Adj__Definite=Def|Degree=Sup|Gender=Neut": {"pos": "DET"}, <add> "Art_Adv__Definite=Def|Degree=Sup|Gender=Neut": {"pos": "DET"}, <add> "Art_Conj_Pron__Number=Sing|PronType=Ind": {"pos": "DET"}, <add> "Art_N_Conj_Art_N__Definite=Def|Gender=Neut|Number=Sing": {"pos": "DET"}, <add> "Art_N_Conj_Art_V__AdpType=Prep": {"pos": "DET"}, <add> "Art_N_Conj_Pron_N__Definite=Def|Gender=Neut|Number=Plur|Person=3": {"pos": "DET"}, <add> "Art_N_Conj__Number=Sing|PronType=Ind": {"pos": "DET"}, <add> "Art_N_N__AdpType=Prep": {"pos": "DET"}, <add> "Art_N_Prep_Adj__Degree=Pos|Number=Sing|PronType=Ind": {"pos": "DET"}, <add> "Art_N_Prep_Art_N__Number=Sing|PronType=Ind": {"pos": "DET"}, <add> "Art_N_Prep_N__AdpType=Prep": {"pos": "DET"}, <add> "Art_N_Prep_N__Definite=Def|Gender=Neut|Number=Sing": {"pos": "DET"}, <add> "Art_N_Prep_N__Number=Sing|PronType=Ind": {"pos": "DET"}, <add> "Art_N_Prep_Pron_N__AdpType=Prep": {"pos": "DET"}, <add> "Art_N__AdpType=Prep": {"pos": "DET"}, <add> "Art_N__Case=Gen|Definite=Def|Number=Sing": {"pos": "DET"}, <add> "Art_N__Number=Sing|PronType=Ind": {"pos": "DET"}, <add> "Art_Num_Art_Adj__AdpType=Prep": {"pos": "DET"}, <add> "Art_Num_N__AdpType=Prep": {"pos": "DET"}, <add> "Art_Num__Definite=Def|Degree=Sup|Gender=Neut|PronType=Ind": {"pos": "DET"}, <add> "Art_Num__Definite=Def|Gender=Neut": {"pos": "DET"}, <add> "Art_Num__Degree=Pos|Number=Sing|PronType=Ind": {"pos": "DET"}, <add> "Art_N|bep|onzijd|neut_eigen|ev|neut__Definite=Def|Gender=Neut|Number=Sing": {"pos": "DET"}, <add> "Art_N|bep|onzijd|neut_soort|ev|neut__Definite=Def|Gender=Neut|Number=Sing": {"pos": "DET"}, <add> "Art_Pron_N__Case=Gen|Number=Plur|PronType=Ind": {"pos": "DET"}, <add> "Art_Pron__Number=Sing|PronType=Ind": {"pos": "DET"}, <add> "Art_V_N__AdpType=Prep": {"pos": "DET"}, <add> "Art|bep|onzijd|neut__Definite=Def|Gender=Neut|PronType=Art": {"pos": "DET"}, <add> "Art|bep|zijdofmv|gen__Case=Gen|Definite=Def|PronType=Art": {"pos": "DET"}, <add> "Art|bep|zijdofmv|neut__Definite=Def|PronType=Art": {"pos": "DET"}, <add> "Art|bep|zijdofonzijd|gen__Case=Gen|Definite=Def|Number=Sing|PronType=Art": {"pos": "DET"}, <add> "Art|bep|zijd|dat__Case=Dat|Definite=Def|Gender=Com|PronType=Art": {"pos": "DET"}, <add> "Art|onbep|zijdofonzijd|neut__Definite=Ind|Number=Sing|PronType=Art": {"pos": "DET"}, <add> "CCONJ___": {"pos": "CONJ"}, <add> "Conj_Adj|neven_adv|vergr|onverv__Degree=Cmp": {"pos": "CONJ"}, <add> "Conj_Adj|neven_attr|stell|onverv__Degree=Pos": {"pos": "CONJ"}, <add> "Conj_Adv_Adv__Degree=Pos": {"pos": "CONJ"}, <add> "Conj_Adv__AdpType=Prep": {"pos": "CONJ"}, <add> "Conj_Adv__AdpType=Preppron|Gender=Masc|Number=Plur": {"pos": "CONJ"}, <add> "Conj_Adv__Degree=Pos": {"pos": "CONJ"}, <add> "Conj_Adv|neven_gew|aanw__PronType=Dem": {"pos": "CONJ"}, <add> "Conj_Art_N__AdpType=Preppron|Gender=Masc|Number=Plur": {"pos": "CONJ"}, <add> "Conj_Art_N__Gender=Neut|Number=Sing": {"pos": "CONJ"}, <add> "Conj_Conj|neven_onder|metfin___": {"pos": "CONJ"}, <add> "Conj_Int|neven___": {"pos": "CONJ"}, <add> "Conj_Int|onder|metfin___": {"pos": "CONJ"}, <add> "Conj_N_Adv__AdpType=Preppron|Gender=Masc|Number=Plur": {"pos": "CONJ"}, <add> "Conj_N_Prep__AdpType=Preppron|Gender=Masc|Number=Plur": {"pos": "CONJ"}, <add> "Conj_N|onder|metfin_soort|ev|neut__AdpType=Preppron|Gender=Masc|Number=Plur": {"pos": "CONJ"}, <add> "Conj_Pron_Adv__Degree=Pos|Number=Sing|Person=3": {"pos": "CONJ"}, <add> "Conj_Pron_V__AdpType=Preppron|Gender=Masc|Number=Plur": {"pos": "CONJ"}, <add> "Conj_Pron|neven_aanw|neut|zelfst__AdpType=Prep": {"pos": "CONJ"}, <add> "Conj_Punc_Conj|neven_schuinstreep_neven__AdpType=Prep": {"pos": "CONJ"}, <add> "Conj_V|onder|metfin_intrans|ott|3|ev__AdpType=Preppron|Gender=Masc|Number=Plur": {"pos": "CONJ"}, <add> "Conj|neven___": {"pos": "CONJ"}, <add> "Conj|onder|metfin___": {"pos": "CONJ"}, <add> "Conj|onder|metinf___": {"pos": "CONJ"}, <add> "DET__Degree=Cmp|NumType=Card|PronType=Ind": {"pos": "DET"}, <add> "DET__Gender=Fem|Number=Sing|Number[psor]=Plur|Person=1|Poss=Yes|PronType=Prs": {"pos": "DET"}, <add> "DET__Gender=Fem|Number=Sing|PronType=Art": {"pos": "DET"}, <add> "DET__Gender=Masc|Number=Plur|PronType=Art": {"pos": "DET"}, <add> "DET__Gender=Masc|Number=Sing|PronType=Tot": {"pos": "DET"}, <add> "Int_Adv|gew|aanw___": {"pos": "X"}, <add> "Int_Int__NumType=Card": {"pos": "X"}, <add> "Int_Int___": {"pos": "X"}, <add> "Int_N_N_Misc_N___": {"pos": "X"}, <add> "Int_N_Punc_Int_N__Number=Sing": {"pos": "X"}, <add> "Int_Punc_Int|komma__PunctType=Comm": {"pos": "X"}, <add> "Int___": {"pos": "X"}, <add> "Misc_Misc_Misc_Misc_Misc_Misc_Misc_Misc_Misc___": {"pos": "MISC"}, <add> "Misc_Misc_Misc_Misc_Misc_Misc_Misc___": {"pos": "MISC"}, <add> "Misc_Misc_Misc_Misc_Misc_Misc_Punc_Misc_Misc_Misc___": {"pos": "MISC"}, <add> "Misc_Misc_Misc_Misc_Misc_Misc___": {"pos": "MISC"}, <add> "Misc_Misc_Misc_Misc_Misc_N_Misc_Misc_Misc_Misc_Misc_Misc___": {"pos": "MISC"}, <add> "Misc_Misc_Misc_Misc|vreemd_vreemd_vreemd_vreemd__AdpType=Preppron|Gender=Masc|Number=Sing": {"pos": "MISC"}, <add> "Misc_Misc_Misc_Misc|vreemd_vreemd_vreemd_vreemd___": {"pos": "MISC"}, <add> "Misc_Misc_Misc_N__Number=Sing": {"pos": "MISC"}, <add> "Misc_Misc_Misc|vreemd_vreemd_vreemd___": {"pos": "MISC"}, <add> "Misc_Misc_N_N__Number=Sing": {"pos": "MISC"}, <add> "Misc_Misc_N|vreemd_vreemd_soort|mv|neut__Number=Plur": {"pos": "MISC"}, <add> "Misc_Misc_Punc_N_N__Number=Sing": {"pos": "MISC"}, <add> "Misc_Misc|vreemd_vreemd__AdpType=Prep": {"pos": "MISC"}, <add> "Misc_Misc|vreemd_vreemd__NumType=Card": {"pos": "MISC"}, <add> "Misc_Misc|vreemd_vreemd___": {"pos": "MISC"}, <add> "Misc_N_Misc_Misc__Number=Sing": {"pos": "MISC"}, <add> "Misc_N_N__Number=Sing": {"pos": "MISC"}, <add> "Misc_N|vreemd_eigen|ev|neut__Number=Sing": {"pos": "MISC"}, <add> "Misc_N|vreemd_soort|ev|neut__Number=Sing": {"pos": "MISC"}, <add> "Misc|vreemd__Foreign=Yes": {"pos": "MISC"}, <add> "NUM__Case=Nom|Definite=Def|Degree=Pos|NumType=Card": {"pos": "NUM"}, <add> "NUM__Definite=Def|Degree=Pos|NumType=Card": {"pos": "NUM"}, <add> "NUM__Definite=Def|Degree=Pos|Number=Sing|NumType=Card": {"pos": "NUM"}, <add> "NUM__Definite=Def|NumType=Card": {"pos": "NUM"}, <add> "NUM__Definite=Def|Number=Plur|NumType=Card": {"pos": "NUM"}, <add> "NUM__Definite=Def|Number=Sing|NumType=Card": {"pos": "NUM"}, <add> "NUM__NumForm=Digit|NumType=Card": {"pos": "NUM"}, <add> "NUM__NumType=Card": {"pos": "NUM"}, <add> "N_Adj_N_Num__Definite=Def|Degree=Pos|Number=Sing": {"pos": "NOUN"}, <add> "N_Adj_N__Degree=Pos|Number=Plur": {"pos": "NOUN"}, <add> "N_Adj_N___": {"pos": "NOUN"}, <add> "N_Adj__AdpType=Prep": {"pos": "NOUN"}, <add> "N_Adj__Case=Nom|Degree=Pos|Number=Plur": {"pos": "NOUN"}, <add> "N_Adj__Case=Nom|Degree=Pos|Number=Sing": {"pos": "NOUN"}, <add> "N_Adj__Degree=Pos|Number=Plur": {"pos": "NOUN"}, <add> "N_Adj__Degree=Pos|Number=Sing": {"pos": "NOUN"}, <add> "N_Adj___": {"pos": "NOUN"}, <add> "N_Adv_Punc_V_Pron_V__Aspect=Imp|Degree=Pos|Mood=Ind|Number=Sing|Person=2|Tense=Pres|VerbForm=Inf": {"pos": "NOUN"}, <add> "N_Adv__Degree=Pos|Number=Sing": {"pos": "NOUN"}, <add> "N_Adv___": {"pos": "NOUN"}, <add> "N_Adv|soort|ev|neut_deelv__Number=Sing": {"pos": "NOUN"}, <add> "N_Art_Adj_Prep_N___": {"pos": "NOUN"}, <add> "N_Art_N__Case=Gen|Number=Sing": {"pos": "NOUN"}, <add> "N_Art_N__Number=Plur": {"pos": "NOUN"}, <add> "N_Art_N__Number=Sing": {"pos": "NOUN"}, <add> "N_Art_N___": {"pos": "NOUN"}, <add> "N_Conj_Adv__Degree=Pos|Number=Sing": {"pos": "NOUN"}, <add> "N_Conj_Art_N___": {"pos": "NOUN"}, <add> "N_Conj_N_N__Number=Sing": {"pos": "NOUN"}, <add> "N_Conj_N_N___": {"pos": "NOUN"}, <add> "N_Conj_N__Number=Plur": {"pos": "NOUN"}, <add> "N_Conj_N__Number=Sing": {"pos": "NOUN"}, <add> "N_Conj_N___": {"pos": "NOUN"}, <add> "N_Conj|soort|ev|neut_neven__Number=Sing": {"pos": "NOUN"}, <add> "N_Int_N|eigen|ev|neut_eigen|ev|neut___": {"pos": "NOUN"}, <add> "N_Misc_Misc_Misc_Misc___": {"pos": "NOUN"}, <add> "N_Misc_Misc_N___": {"pos": "NOUN"}, <add> "N_Misc_Misc|eigen|ev|neut_vreemd_vreemd___": {"pos": "NOUN"}, <add> "N_Misc_Misc|soort|mv|neut_vreemd_vreemd__Number=Plur": {"pos": "NOUN"}, <add> "N_Misc_N_N_N_N___": {"pos": "NOUN"}, <add> "N_Misc_N_N___": {"pos": "NOUN"}, <add> "N_Misc_N___": {"pos": "NOUN"}, <add> "N_Misc_Num___": {"pos": "NOUN"}, <add> "N_Misc|eigen|ev|neut_vreemd___": {"pos": "NOUN"}, <add> "N_Misc|soort|ev|neut_vreemd__Number=Sing": {"pos": "NOUN"}, <add> "N_N_Adj_Art_N_N__Gender=Masc|Number=Plur|PronType=Art": {"pos": "NOUN"}, <add> "N_N_Adj_N___": {"pos": "NOUN"}, <add> "N_N_Adj__Degree=Pos|Number=Sing": {"pos": "NOUN"}, <add> "N_N_Adj___": {"pos": "NOUN"}, <add> "N_N_Art_Adv___": {"pos": "NOUN"}, <add> "N_N_Art_N___": {"pos": "NOUN"}, <add> "N_N_Conj_N_N_N_N_N___": {"pos": "NOUN"}, <add> "N_N_Conj_N_N___": {"pos": "NOUN"}, <add> "N_N_Conj_N__Number=Sing": {"pos": "NOUN"}, <add> "N_N_Conj_N___": {"pos": "NOUN"}, <add> "N_N_Conj___": {"pos": "NOUN"}, <add> "N_N_Int_N_N___": {"pos": "NOUN"}, <add> "N_N_Misc___": {"pos": "NOUN"}, <add> "N_N_N_Adj_N___": {"pos": "NOUN"}, <add> "N_N_N_Adv___": {"pos": "NOUN"}, <add> "N_N_N_Int__AdpType=Prep": {"pos": "NOUN"}, <add> "N_N_N_Misc___": {"pos": "NOUN"}, <add> "N_N_N_N_Conj_N___": {"pos": "NOUN"}, <add> "N_N_N_N_Misc___": {"pos": "NOUN"}, <add> "N_N_N_N_N_N_Int__AdpType=Prep": {"pos": "NOUN"}, <add> "N_N_N_N_N_N_N__AdpType=Prep": {"pos": "NOUN"}, <add> "N_N_N_N_N_N_N__Gender=Fem|Number=Sing|PronType=Art": {"pos": "NOUN"}, <add> "N_N_N_N_N_N_N___": {"pos": "NOUN"}, <add> "N_N_N_N_N_N_Prep_N___": {"pos": "NOUN"}, <add> "N_N_N_N_N_N__AdpType=Prep": {"pos": "NOUN"}, <add> "N_N_N_N_N_N___": {"pos": "NOUN"}, <add> "N_N_N_N_N_Prep_N___": {"pos": "NOUN"}, <add> "N_N_N_N_N__AdpType=Prep": {"pos": "NOUN"}, <add> "N_N_N_N_N__Number=Sing": {"pos": "NOUN"}, <add> "N_N_N_N_N___": {"pos": "NOUN"}, <add> "N_N_N_N_Prep_N___": {"pos": "NOUN"}, <add> "N_N_N_N_Punc_N_Punc___": {"pos": "NOUN"}, <add> "N_N_N_N_V___": {"pos": "NOUN"}, <add> "N_N_N_N__Gender=Fem|Number=Plur|PronType=Art": {"pos": "NOUN"}, <add> "N_N_N_N__Gender=Fem|Number=Sing|PronType=Art": {"pos": "NOUN"}, <add> "N_N_N_N__NumType=Card": {"pos": "NOUN"}, <add> "N_N_N_N__Number=Plur": {"pos": "NOUN"}, <add> "N_N_N_N__Number=Sing": {"pos": "NOUN"}, <add> "N_N_N_N___": {"pos": "NOUN"}, <add> "N_N_N_Prep_Art_Adj_N___": {"pos": "NOUN"}, <add> "N_N_N_Prep_N_N___": {"pos": "NOUN"}, <add> "N_N_N_Prep_N___": {"pos": "NOUN"}, <add> "N_N_N_Punc_N___": {"pos": "NOUN"}, <add> "N_N_N_Punc___": {"pos": "NOUN"}, <add> "N_N_N__AdpType=Prep": {"pos": "NOUN"}, <add> "N_N_N__Gender=Fem|Number=Sing|PronType=Art": {"pos": "NOUN"}, <add> "N_N_N__Gender=Masc|Number=Plur|PronType=Art": {"pos": "NOUN"}, <add> "N_N_N__Number=Plur": {"pos": "NOUN"}, <add> "N_N_N__Number=Sing": {"pos": "NOUN"}, <add> "N_N_N___": {"pos": "NOUN"}, <add> "N_N_Num_N___": {"pos": "NOUN"}, <add> "N_N_Num__Definite=Def|Number=Sing": {"pos": "NOUN"}, <add> "N_N_Num___": {"pos": "NOUN"}, <add> "N_N_Prep_Art_Adj_N__Degree=Pos|Gender=Neut|Number=Sing": {"pos": "NOUN"}, <add> "N_N_Prep_Art_N_Prep_Art_N___": {"pos": "NOUN"}, <add> "N_N_Prep_Art_N___": {"pos": "NOUN"}, <add> "N_N_Prep_N_N__AdpType=Prep": {"pos": "NOUN"}, <add> "N_N_Prep_N_Prep_Adj_N___": {"pos": "NOUN"}, <add> "N_N_Prep_N__AdpType=Prep": {"pos": "NOUN"}, <add> "N_N_Prep_N__Number=Sing": {"pos": "NOUN"}, <add> "N_N_Prep_N___": {"pos": "NOUN"}, <add> "N_N_Punc_N_Punc___": {"pos": "NOUN"}, <add> "N_Num_N_N__Definite=Def|Number=Sing": {"pos": "NOUN"}, <add> "N_Num_N_Num___": {"pos": "NOUN"}, <add> "N_Num_N___": {"pos": "NOUN"}, <add> "N_Num_Num__Definite=Def|Number=Sing": {"pos": "NOUN"}, <add> "N_Num__Definite=Def|Number=Plur": {"pos": "NOUN"}, <add> "N_Num__Definite=Def|Number=Sing": {"pos": "NOUN"}, <add> "N_Num___": {"pos": "NOUN"}, <add> "N_N|eigen|ev|gen_eigen|ev|gen___": {"pos": "NOUN"}, <add> "N_N|eigen|ev|gen_eigen|ev|neut___": {"pos": "NOUN"}, <add> "N_N|eigen|ev|gen_soort|ev|neut___": {"pos": "NOUN"}, <add> "N_N|eigen|ev|gen_soort|mv|neut___": {"pos": "NOUN"}, <add> "N_N|eigen|ev|neut_eigen|ev|gen___": {"pos": "NOUN"}, <add> "N_N|eigen|ev|neut_eigen|ev|neut__AdpType=Prep": {"pos": "NOUN"}, <add> "N_N|eigen|ev|neut_eigen|ev|neut__AdpType=Preppron|Gender=Fem|Number=Plur": {"pos": "NOUN"}, <add> "N_N|eigen|ev|neut_eigen|ev|neut__AdpType=Preppron|Gender=Masc|Number=Sing": {"pos": "NOUN"}, <add> "N_N|eigen|ev|neut_eigen|ev|neut__Gender=Fem|Number=Plur|PronType=Art": {"pos": "NOUN"}, <add> "N_N|eigen|ev|neut_eigen|ev|neut__Gender=Fem|Number=Sing|PronType=Art": {"pos": "NOUN"}, <add> "N_N|eigen|ev|neut_eigen|ev|neut__Gender=Masc|Number=Plur|PronType=Art": {"pos": "NOUN"}, <add> "N_N|eigen|ev|neut_eigen|ev|neut__Gender=Masc|Number=Sing|PronType=Art": {"pos": "NOUN"}, <add> "N_N|eigen|ev|neut_eigen|ev|neut__NumType=Card": {"pos": "NOUN"}, <add> "N_N|eigen|ev|neut_eigen|ev|neut__Number=Sing": {"pos": "NOUN"}, <add> "N_N|eigen|ev|neut_eigen|ev|neut___": {"pos": "NOUN"}, <add> "N_N|eigen|ev|neut_eigen|mv|neut___": {"pos": "NOUN"}, <add> "N_N|eigen|ev|neut_soort|ev|neut__AdpType=Prep": {"pos": "NOUN"}, <add> "N_N|eigen|ev|neut_soort|ev|neut___": {"pos": "NOUN"}, <add> "N_N|eigen|ev|neut_soort|mv|neut___": {"pos": "NOUN"}, <add> "N_N|eigen|mv|neut_eigen|mv|neut___": {"pos": "NOUN"}, <add> "N_N|soort|ev|neut_eigen|ev|neut__Number=Sing": {"pos": "NOUN"}, <add> "N_N|soort|ev|neut_soort|ev|neut__Gender=Masc|Number=Plur|PronType=Art": {"pos": "NOUN"}, <add> "N_N|soort|ev|neut_soort|ev|neut__NumForm=Digit|NumType=Card": {"pos": "NOUN"}, <add> "N_N|soort|ev|neut_soort|ev|neut__Number=Sing": {"pos": "NOUN"}, <add> "N_N|soort|ev|neut_soort|mv|neut__Number=Plur": {"pos": "NOUN"}, <add> "N_N|soort|mv|neut_eigen|ev|neut__Number=Sing": {"pos": "NOUN"}, <add> "N_N|soort|mv|neut_soort|ev|neut__Number=Sing": {"pos": "NOUN"}, <add> "N_N|soort|mv|neut_soort|mv|neut__Number=Plur": {"pos": "NOUN"}, <add> "N_Prep_Adj_Adj_N__Degree=Pos|Number=Plur": {"pos": "NOUN"}, <add> "N_Prep_Adj_N___": {"pos": "NOUN"}, <add> "N_Prep_Art_N_Art_N__Number=Plur": {"pos": "NOUN"}, <add> "N_Prep_Art_N_N__Number=Sing": {"pos": "NOUN"}, <add> "N_Prep_Art_N_Prep_Art_N__Gender=Neut|Number=Sing": {"pos": "NOUN"}, <add> "N_Prep_Art_N__Number=Plur": {"pos": "NOUN"}, <add> "N_Prep_Art_N__Number=Sing": {"pos": "NOUN"}, <add> "N_Prep_Art_N___": {"pos": "NOUN"}, <add> "N_Prep_N_Art_Adj___": {"pos": "NOUN"}, <add> "N_Prep_N_N__Number=Sing": {"pos": "NOUN"}, <add> "N_Prep_N_N___": {"pos": "NOUN"}, <add> "N_Prep_N_Prep_Art_N___": {"pos": "NOUN"}, <add> "N_Prep_N_Prep_N_Conj_N_Prep_Art_N_N__Number=Sing": {"pos": "NOUN"}, <add> "N_Prep_N_Punc_N_Conj_N__Number=Sing": {"pos": "NOUN"}, <add> "N_Prep_N__Number=Plur": {"pos": "NOUN"}, <add> "N_Prep_N__Number=Sing": {"pos": "NOUN"}, <add> "N_Prep_N___": {"pos": "NOUN"}, <add> "N_Prep_Num__Definite=Def|Number=Sing": {"pos": "NOUN"}, <add> "N_Prep_Pron_N___": {"pos": "NOUN"}, <add> "N_Prep|soort|ev|neut_voor__Number=Sing": {"pos": "NOUN"}, <add> "N_Pron___": {"pos": "NOUN"}, <add> "N_Punc_Adj_N___": {"pos": "NOUN"}, <add> "N_Punc_Adj_Pron_Punc__Degree=Pos|Number=Sing|Person=2": {"pos": "NOUN"}, <add> "N_Punc_Adv_V_Pron_N__Aspect=Imp|Mood=Ind|Number=Sing|Person=1|Tense=Pres|VerbForm=Fin": {"pos": "NOUN"}, <add> "N_Punc_Misc_Punc_N___": {"pos": "NOUN"}, <add> "N_Punc_N_N_N_N__Number=Sing": {"pos": "NOUN"}, <add> "N_Punc_N_Punc_N__Number=Sing": {"pos": "NOUN"}, <add> "N_Punc_N_Punc__Number=Sing": {"pos": "NOUN"}, <add> "N_Punc_N__Number=Sing": {"pos": "NOUN"}, <add> "N_Punc_Punc_N_N_Punc_Punc_N___": {"pos": "NOUN"}, <add> "N_V_N_N___": {"pos": "NOUN"}, <add> "N_V_N___": {"pos": "NOUN"}, <add> "N_V__Aspect=Imp|Mood=Ind|Number=Sing|Tense=Past|VerbForm=Fin": {"pos": "NOUN"}, <add> "N_V__Number=Sing|Tense=Past|VerbForm=Part": {"pos": "NOUN"}, <add> "N_V___": {"pos": "NOUN"}, <add> "N_V|eigen|ev|neut_trans|imp___": {"pos": "NOUN"}, <add> "N_V|soort|ev|neut_hulpofkopp|conj__Mood=Sub|Number=Sing|VerbForm=Fin": {"pos": "NOUN"}, <add> "N_V|soort|ev|neut_intrans|conj__Mood=Sub|Number=Sing|VerbForm=Fin": {"pos": "NOUN"}, <add> "Num_Adj_Adj_N___": {"pos": "NUM"}, <add> "Num_Adj_N___": {"pos": "NUM"}, <add> "Num_Adj__Definite=Def|Degree=Pos|NumType=Card": {"pos": "NUM"}, <add> "Num_Adj__NumForm=Digit|NumType=Card": {"pos": "NUM"}, <add> "Num_Adj___": {"pos": "NUM"}, <add> "Num_Conj_Adj__Case=Nom|Definite=Def|Degree=Pos|NumType=Card": {"pos": "NUM"}, <add> "Num_Conj_Art_Adj__Definite=Def|Degree=Pos|Number=Sing|NumType=Card": {"pos": "NUM"}, <add> "Num_Conj_Num_N__NumForm=Digit|NumType=Card": {"pos": "NUM"}, <add> "Num_Conj_Num__Degree=Cmp|NumType=Card|PronType=Ind": {"pos": "NUM"}, <add> "Num_N_N__Definite=Def|Number=Sing|NumType=Card": {"pos": "NUM"}, <add> "Num_N_Num_Num_N__NumForm=Digit|NumType=Card": {"pos": "NUM"}, <add> "Num_N_Num__Definite=Def|Number=Sing|NumType=Card": {"pos": "NUM"}, <add> "Num_N_Num__NumForm=Digit|NumType=Card": {"pos": "NUM"}, <add> "Num_N__Definite=Def|Number=Plur|NumType=Card": {"pos": "NUM"}, <add> "Num_N__Definite=Def|Number=Sing|NumType=Card": {"pos": "NUM"}, <add> "Num_N__NumForm=Digit|NumType=Card": {"pos": "NUM"}, <add> "Num_N___": {"pos": "NUM"}, <add> "Num_Num_N__NumForm=Digit|NumType=Card": {"pos": "NUM"}, <add> "Num_Num__Definite=Def|NumType=Card": {"pos": "NUM"}, <add> "Num_Num__NumForm=Digit|NumType=Card": {"pos": "NUM"}, <add> "Num_Prep_Num__Definite=Def|NumType=Card": {"pos": "NUM"}, <add> "Num_Punc_Num_N_N__NumForm=Digit|NumType=Card": {"pos": "NUM"}, <add> "Num_Punc_Num__NumForm=Digit|NumType=Card": {"pos": "NUM"}, <add> "Num_Punc__NumForm=Digit|NumType=Card": {"pos": "NUM"}, <add> "Num__Case=Nom|Degree=Cmp|NumType=Card|PronType=Ind": {"pos": "NUM"}, <add> "Num__Case=Nom|Degree=Pos|NumType=Card|PronType=Ind": {"pos": "NUM"}, <add> "Num__Case=Nom|Degree=Sup|NumType=Card|PronType=Ind": {"pos": "NUM"}, <add> "Num__Degree=Cmp|NumType=Card|PronType=Ind": {"pos": "NUM"}, <add> "Num__Degree=Pos|NumType=Card|PronType=Ind": {"pos": "NUM"}, <add> "Num__Degree=Pos|Number=Plur|NumType=Card|PronType=Ind": {"pos": "NUM"}, <add> "Num__Degree=Sup|NumType=Card|PronType=Ind": {"pos": "NUM"}, <add> "Num__Degree=Sup|Number=Plur|NumType=Card|PronType=Ind": {"pos": "NUM"}, <add> "Num|hoofd|bep|attr|onverv__Definite=Def|NumType=Card": {"pos": "NUM"}, <add> "Num|hoofd|bep|zelfst|onverv__Definite=Def|NumType=Card": {"pos": "NUM"}, <add> "Num|hoofd|bep|zelfst|vervmv__Definite=Def|Number=Plur|NumType=Card": {"pos": "NUM"}, <add> "Num|hoofd|onbep|attr|stell|onverv__Degree=Pos|NumType=Card|PronType=Ind": {"pos": "NUM"}, <add> "Num|hoofd|onbep|attr|vergr|onverv__Degree=Cmp|NumType=Card|PronType=Ind": {"pos": "NUM"}, <add> "Num|rang|bep|attr|onverv__Definite=Def|NumType=Ord": {"pos": "NUM"}, <add> "Num|rang|bep|zelfst|onverv__Definite=Def|NumType=Ord": {"pos": "NUM"}, <add> "N|eigen|ev|gen__Case=Gen|Number=Sing": {"pos": "NOUN"}, <add> "N|eigen|ev|neut__Number=Sing": {"pos": "NOUN"}, <add> "N|eigen|mv|neut__Number=Plur": {"pos": "NOUN"}, <add> "N|soort|ev|dat__Case=Dat|Number=Sing": {"pos": "NOUN"}, <add> "N|soort|ev|gen__Case=Gen|Number=Sing": {"pos": "NOUN"}, <add> "N|soort|ev|neut__Number=Sing": {"pos": "NOUN"}, <add> "N|soort|mv|neut__Number=Plur": {"pos": "NOUN"}, <add> "PROPN___": {"pos": "PROPN"}, <add> "PUNCT___": {"pos": "PUNCT"}, <add> "Prep_Adj_Conj_Prep_N__Degree=Pos|Number=Sing": {"pos": "PREP"}, <add> "Prep_Adj_N__Degree=Pos|Number=Plur": {"pos": "PREP"}, <add> "Prep_Adj|voor_adv|vergr|vervneut__Case=Nom|Degree=Cmp": {"pos": "PREP"}, <add> "Prep_Adj|voor_attr|stell|onverv__Degree=Pos": {"pos": "PREP"}, <add> "Prep_Adj|voor_attr|stell|vervneut__Case=Nom|Degree=Pos": {"pos": "PREP"}, <add> "Prep_Adv__AdpType=Prep": {"pos": "PREP"}, <add> "Prep_Adv__Case=Nom|Degree=Pos": {"pos": "PREP"}, <add> "Prep_Adv__Case=Nom|Degree=Sup": {"pos": "PREP"}, <add> "Prep_Adv__Degree=Pos": {"pos": "PREP"}, <add> "Prep_Adv|voor_gew|aanw__AdpType=Prep": {"pos": "PREP"}, <add> "Prep_Adv|voor_gew|aanw__Gender=Masc|Number=Sing|PronType=Tot": {"pos": "PREP"}, <add> "Prep_Adv|voor_gew|aanw__PronType=Dem": {"pos": "PREP"}, <add> "Prep_Adv|voor_pron|vrag__PronType=Int": {"pos": "PREP"}, <add> "Prep_Art_Adj_N__Degree=Pos|Number=Sing": {"pos": "PREP"}, <add> "Prep_Art_Adj__AdpType=Prep": {"pos": "PREP"}, <add> "Prep_Art_Adj__Case=Nom|Degree=Pos": {"pos": "PREP"}, <add> "Prep_Art_Adj__Degree=Cmp|Gender=Neut": {"pos": "PREP"}, <add> "Prep_Art_Misc_Misc___": {"pos": "PREP"}, <add> "Prep_Art_N_Adv__Number=Sing": {"pos": "PREP"}, <add> "Prep_Art_N_Adv__Number=Sing|PronType=Int": {"pos": "PREP"}, <add> "Prep_Art_N_Art_N__AdpType=Prep": {"pos": "PREP"}, <add> "Prep_Art_N_Prep_Art_N__AdpType=Prep": {"pos": "PREP"}, <add> "Prep_Art_N_Prep__AdpType=Prep": {"pos": "PREP"}, <add> "Prep_Art_N_Prep__Gender=Neut|Number=Sing": {"pos": "PREP"}, <add> "Prep_Art_N_Prep__Number=Sing": {"pos": "PREP"}, <add> "Prep_Art_N_V__Number=Plur|Tense=Past|VerbForm=Part": {"pos": "PREP"}, <add> "Prep_Art_N__AdpType=Prep": {"pos": "PREP"}, <add> "Prep_Art_N__Gender=Com|Number=Sing": {"pos": "PREP"}, <add> "Prep_Art_N__Gender=Neut|Number=Sing": {"pos": "PREP"}, <add> "Prep_Art_N__Number=Plur": {"pos": "PREP"}, <add> "Prep_Art_N__Number=Sing": {"pos": "PREP"}, <add> "Prep_Art_V__AdpType=Prep": {"pos": "PREP"}, <add> "Prep_Art_V__Gender=Neut|VerbForm=Inf": {"pos": "PREP"}, <add> "Prep_Art|voor_bep|onzijd|neut__Gender=Neut": {"pos": "PREP"}, <add> "Prep_Art|voor_onbep|zijdofonzijd|neut__Number=Sing": {"pos": "PREP"}, <add> "Prep_Conj_Prep|voor_neven_voor__Gender=Masc|Number=Sing|PronType=Tot": {"pos": "PREP"}, <add> "Prep_Misc|voor_vreemd___": {"pos": "PREP"}, <add> "Prep_N_Adv|voor_soort|ev|neut_deeladv__Number=Sing": {"pos": "PREP"}, <add> "Prep_N_Adv|voor_soort|ev|neut_pron|aanw__AdpType=Prep": {"pos": "PREP"}, <add> "Prep_N_Adv|voor_soort|ev|neut_pron|aanw__Number=Sing|PronType=Dem": {"pos": "PREP"}, <add> "Prep_N_Adv|voor_soort|ev|neut_pron|vrag__Number=Sing|PronType=Int": {"pos": "PREP"}, <add> "Prep_N_Adv|voor_soort|mv|neut_deelv__Gender=Masc|Number=Sing|PronType=Tot": {"pos": "PREP"}, <add> "Prep_N_Conj_N__Number=Sing": {"pos": "PREP"}, <add> "Prep_N_Conj__AdpType=Prep": {"pos": "PREP"}, <add> "Prep_N_Prep_N__Number=Sing": {"pos": "PREP"}, <add> "Prep_N_Prep|voor_soort|ev|dat_voor__Number=Sing": {"pos": "PREP"}, <add> "Prep_N_Prep|voor_soort|ev|neut_voor__AdpType=Prep": {"pos": "PREP"}, <add> "Prep_N_Prep|voor_soort|ev|neut_voor__Number=Sing": {"pos": "PREP"}, <add> "Prep_N_Prep|voor_soort|mv|neut_voor__Number=Plur": {"pos": "PREP"}, <add> "Prep_N_V__Case=Nom|Number=Sing|Tense=Past|VerbForm=Part": {"pos": "PREP"}, <add> "Prep_Num_N__Definite=Def|Number=Sing": {"pos": "PREP"}, <add> "Prep_Num__Case=Nom|Degree=Sup|PronType=Ind": {"pos": "PREP"}, <add> "Prep_Num__Degree=Cmp|PronType=Ind": {"pos": "PREP"}, <add> "Prep_N|voor_eigen|ev|neut__Number=Sing": {"pos": "PREP"}, <add> "Prep_N|voor_soort|ev|dat__AdpType=Prep": {"pos": "PREP"}, <add> "Prep_N|voor_soort|ev|dat__Case=Dat|Number=Sing": {"pos": "PREP"}, <add> "Prep_N|voor_soort|ev|neut__AdpType=Prep": {"pos": "PREP"}, <add> "Prep_N|voor_soort|ev|neut__Gender=Masc|Number=Sing|PronType=Tot": {"pos": "PREP"}, <add> "Prep_N|voor_soort|ev|neut__Number=Sing": {"pos": "PREP"}, <add> "Prep_N|voor_soort|mv|neut__AdpType=Prep": {"pos": "PREP"}, <add> "Prep_N|voor_soort|mv|neut__Number=Plur": {"pos": "PREP"}, <add> "Prep_Prep_Adj|voor_voor_adv|stell|onverv__Gender=Masc|Number=Sing|PronType=Tot": {"pos": "PREP"}, <add> "Prep_Prep_Adv__Degree=Pos": {"pos": "PREP"}, <add> "Prep_Pron_Adj__Degree=Cmp|Number=Sing|Person=3": {"pos": "PREP"}, <add> "Prep_Pron_N_Adv__Number=Plur": {"pos": "PREP"}, <add> "Prep_Pron_N__AdpType=Prep": {"pos": "PREP"}, <add> "Prep_Pron_N__Case=Dat|Number=Sing": {"pos": "PREP"}, <add> "Prep_Pron|voor_aanw|neut|zelfst___": {"pos": "PREP"}, <add> "Prep_Pron|voor_onbep|neut|attr___": {"pos": "PREP"}, <add> "Prep_Pron|voor_onbep|neut|zelfst___": {"pos": "PREP"}, <add> "Prep_Pron|voor_rec|neut__AdpType=Prep": {"pos": "PREP"}, <add> "Prep_Pron|voor_rec|neut___": {"pos": "PREP"}, <add> "Prep_Pron|voor_ref|3|evofmv__Number=Plur,Sing|Person=3": {"pos": "PREP"}, <add> "Prep_Punc_N_Conj_N__AdpType=Prep": {"pos": "PREP"}, <add> "Prep_V_N__Number=Sing|Tense=Pres|VerbForm=Part": {"pos": "PREP"}, <add> "Prep_V_Pron_Pron_Adv__Aspect=Imp|Mood=Ind|Number=Sing|Person=2|PronType=Dem|Tense=Pres|VerbForm=Fin": {"pos": "PREP"}, <add> "Prep_V|voor_intrans|inf__VerbForm=Inf": {"pos": "PREP"}, <add> "Prep_V|voorinf_trans|inf__VerbForm=Inf": {"pos": "PREP"}, <add> "Prep|achter__AdpType=Post": {"pos": "PREP"}, <add> "Prep|comb__AdpType=Circ": {"pos": "PREP"}, <add> "Prep|voor__AdpType=Prep": {"pos": "PREP"}, <add> "Prep|voorinf__AdpType=Prep|PartType=Inf": {"pos": "PREP"}, <add> "Pron_Adj_N_Punc_Art_Adj_N_Prep_Art_Adj_N__NumType=Card": {"pos": "PRON"}, <add> "Pron_Adj__Case=Nom|Degree=Sup|Number=Sing|Person=2|Poss=Yes|PronType=Prs": {"pos": "PRON"}, <add> "Pron_Adj__Degree=Cmp|PronType=Ind": {"pos": "PRON"}, <add> "Pron_Adv|vrag|neut|attr_deelv__PronType=Int": {"pos": "PRON"}, <add> "Pron_Art_N_N__Number=Plur|PronType=Ind": {"pos": "PRON"}, <add> "Pron_Art__Number=Sing|PronType=Int": {"pos": "PRON"}, <add> "Pron_N_Adv__Number=Sing|PronType=Ind": {"pos": "PRON"}, <add> "Pron_N_V_Adv_Num_Punc__Aspect=Imp|Definite=Def|Mood=Ind|Number=Sing|Person=3|PronType=Ind|Tense=Pres|VerbForm=Fin": {"pos": "PRON"}, <add> "Pron_N_V_Conj_N__Aspect=Imp|Mood=Ind|Number=Sing|Person=3|PronType=Ind|Tense=Pres|VerbForm=Fin": {"pos": "PRON"}, <add> "Pron_N__Case=Gen|Number=Sing|PronType=Ind": {"pos": "PRON"}, <add> "Pron_N__Number=Sing|PronType=Ind": {"pos": "PRON"}, <add> "Pron_N|aanw|gen|attr_soort|mv|neut__Case=Gen|Number=Plur|PronType=Dem": {"pos": "PRON"}, <add> "Pron_N|onbep|neut|attr_soort|ev|neut__Number=Sing|PronType=Ind": {"pos": "PRON"}, <add> "Pron_Prep_Art__Number=Sing|PronType=Int": {"pos": "PRON"}, <add> "Pron_Prep_Art__Number=Sing|PronType=Rel": {"pos": "PRON"}, <add> "Pron_Prep_N__Number=Plur|PronType=Int": {"pos": "PRON"}, <add> "Pron_Prep|betr|neut|zelfst_voor__PronType=Rel": {"pos": "PRON"}, <add> "Pron_Prep|onbep|neut|zelfst_voor__PronType=Ind": {"pos": "PRON"}, <add> "Pron_Prep|vrag|neut|attr_voor__PronType=Int": {"pos": "PRON"}, <add> "Pron_Pron_V__Aspect=Imp|Mood=Ind|Number=Sing|Person=2|PronType=Rel|Tense=Pres|VerbForm=Fin": {"pos": "PRON"}, <add> "Pron_Pron__Person=3|PronType=Prs|Reflex=Yes": {"pos": "PRON"}, <add> "Pron_V_V__Aspect=Imp|Mood=Ind|Person=3|PronType=Dem|Tense=Pres|VerbForm=Inf": {"pos": "PRON"}, <add> "Pron_V__Case=Gen|Number=Sing|Person=3|Poss=Yes|PronType=Prs|VerbForm=Inf": {"pos": "PRON"}, <add> "Pron_V__Number=Plur|Person=1|Poss=Yes|PronType=Prs|VerbForm=Inf": {"pos": "PRON"}, <add> "Pron|aanw|dat|attr__Case=Dat|PronType=Dem": {"pos": "PRON"}, <add> "Pron|aanw|gen|attr__Case=Gen|PronType=Dem": {"pos": "PRON"}, <add> "Pron|aanw|neut|attr__PronType=Dem": {"pos": "PRON"}, <add> "Pron|aanw|neut|attr|weigen__PronType=Dem": {"pos": "PRON"}, <add> "Pron|aanw|neut|attr|wzelf__PronType=Dem": {"pos": "PRON"}, <add> "Pron|aanw|neut|zelfst__PronType=Dem": {"pos": "PRON"}, <add> "Pron|betr|gen|zelfst__Case=Gen|PronType=Rel": {"pos": "PRON"}, <add> "Pron|betr|neut|attr__PronType=Rel": {"pos": "PRON"}, <add> "Pron|betr|neut|zelfst__PronType=Rel": {"pos": "PRON"}, <add> "Pron|bez|1|ev|neut|attr__Number=Sing|Person=1|Poss=Yes|PronType=Prs": {"pos": "PRON"}, <add> "Pron|bez|1|mv|neut|attr__Number=Plur|Person=1|Poss=Yes|PronType=Prs": {"pos": "PRON"}, <add> "Pron|bez|2|ev|neut|attr__Number=Sing|Person=2|Poss=Yes|PronType=Prs": {"pos": "PRON"}, <add> "Pron|bez|2|mv|neut|attr__Number=Plur|Person=2|Poss=Yes|PronType=Prs": {"pos": "PRON"}, <add> "Pron|bez|3|ev|gen|attr__Case=Gen|Number=Sing|Person=3|Poss=Yes|PronType=Prs": {"pos": "PRON"}, <add> "Pron|bez|3|ev|neut|attr__Number=Sing|Person=3|Poss=Yes|PronType=Prs": {"pos": "PRON"}, <add> "Pron|bez|3|ev|neut|zelfst__Number=Sing|Person=3|Poss=Yes|PronType=Prs": {"pos": "PRON"}, <add> "Pron|bez|3|mv|neut|attr__Number=Plur|Person=3|Poss=Yes|PronType=Prs": {"pos": "PRON"}, <add> "Pron|onbep|gen|attr__Case=Gen|PronType=Ind": {"pos": "PRON"}, <add> "Pron|onbep|gen|zelfst__Case=Gen|PronType=Ind": {"pos": "PRON"}, <add> "Pron|onbep|neut|attr__PronType=Ind": {"pos": "PRON"}, <add> "Pron|onbep|neut|zelfst__PronType=Ind": {"pos": "PRON"}, <add> "Pron|per|1|ev|datofacc__Case=Acc,Dat|Number=Sing|Person=1|PronType=Prs": {"pos": "PRON"}, <add> "Pron|per|1|ev|nom__Case=Nom|Number=Sing|Person=1|PronType=Prs": {"pos": "PRON"}, <add> "Pron|per|1|mv|datofacc__Case=Acc,Dat|Number=Plur|Person=1|PronType=Prs": {"pos": "PRON"}, <add> "Pron|per|1|mv|nom__Case=Nom|Number=Plur|Person=1|PronType=Prs": {"pos": "PRON"}, <add> "Pron|per|2|ev|datofacc__Case=Acc,Dat|Number=Sing|Person=2|PronType=Prs": {"pos": "PRON"}, <add> "Pron|per|2|ev|nom__Case=Nom|Number=Sing|Person=2|PronType=Prs": {"pos": "PRON"}, <add> "Pron|per|2|mv|datofacc__Case=Acc,Dat|Number=Plur|Person=2|PronType=Prs": {"pos": "PRON"}, <add> "Pron|per|2|mv|nom__Case=Nom|Number=Plur|Person=2|PronType=Prs": {"pos": "PRON"}, <add> "Pron|per|3|evofmv|datofacc__Case=Acc,Dat|Number=Plur,Sing|Person=3|PronType=Prs": {"pos": "PRON"}, <add> "Pron|per|3|evofmv|nom__Case=Nom|Number=Plur,Sing|Person=3|PronType=Prs": {"pos": "PRON"}, <add> "Pron|per|3|ev|datofacc__Case=Acc,Dat|Number=Sing|Person=3|PronType=Prs": {"pos": "PRON"}, <add> "Pron|per|3|ev|nom__Case=Nom|Number=Sing|Person=3|PronType=Prs": {"pos": "PRON"}, <add> "Pron|per|3|mv|datofacc__Case=Acc,Dat|Number=Plur|Person=3|PronType=Prs": {"pos": "PRON"}, <add> "Pron|rec|gen__Case=Gen|PronType=Rcp": {"pos": "PRON"}, <add> "Pron|rec|neut__PronType=Rcp": {"pos": "PRON"}, <add> "Pron|ref|1|ev__Number=Sing|Person=1|PronType=Prs|Reflex=Yes": {"pos": "PRON"}, <add> "Pron|ref|1|mv__Number=Plur|Person=1|PronType=Prs|Reflex=Yes": {"pos": "PRON"}, <add> "Pron|ref|2|ev__Number=Sing|Person=2|PronType=Prs|Reflex=Yes": {"pos": "PRON"}, <add> "Pron|ref|3|evofmv__Number=Plur,Sing|Person=3|PronType=Prs|Reflex=Yes": {"pos": "PRON"}, <add> "Pron|vrag|neut|attr__PronType=Int": {"pos": "PRON"}, <add> "Pron|vrag|neut|zelfst__PronType=Int": {"pos": "PRON"}, <add> "Punc_Int_Punc_N_N_N_Punc_Pron_V_Pron_Adj_V_Punc___": {"pos": "PUNCT"}, <add> "Punc_N_Punc_N___": {"pos": "PUNCT"}, <add> "Punc_Num_Num___": {"pos": "PUNCT"}, <add> "Punc_Num___": {"pos": "PUNCT"}, <add> "Punc|aanhaaldubb__PunctType=Quot": {"pos": "PUNCT"}, <add> "Punc|aanhaalenk__PunctType=Quot": {"pos": "PUNCT"}, <add> "Punc|dubbpunt__PunctType=Colo": {"pos": "PUNCT"}, <add> "Punc|haakopen__PunctSide=Ini|PunctType=Brck": {"pos": "PUNCT"}, <add> "Punc|haaksluit__PunctSide=Fin|PunctType=Brck": {"pos": "PUNCT"}, <add> "Punc|hellip__PunctType=Peri": {"pos": "PUNCT"}, <add> "Punc|isgelijk___": {"pos": "PUNCT"}, <add> "Punc|komma__PunctType=Comm": {"pos": "PUNCT"}, <add> "Punc|liggstreep___": {"pos": "PUNCT"}, <add> "Punc|maal___": {"pos": "PUNCT"}, <add> "Punc|punt__PunctType=Peri": {"pos": "PUNCT"}, <add> "Punc|puntkomma__PunctType=Semi": {"pos": "PUNCT"}, <add> "Punc|schuinstreep___": {"pos": "PUNCT"}, <add> "Punc|uitroep__PunctType=Excl": {"pos": "PUNCT"}, <add> "Punc|vraag__PunctType=Qest": {"pos": "PUNCT"}, <add> "V_Adv_Art_N_Prep_Pron_N__Degree=Pos|Number=Plur|Person=2|Subcat=Tran": {"pos": "VERB"}, <add> "V_Adv__Degree=Pos|Subcat=Tran": {"pos": "VERB"}, <add> "V_Art_N_Num_N__Aspect=Imp|Definite=Def|Mood=Ind|Number=Plur|Person=3|Tense=Pres|VerbForm=Fin|VerbType=Mod": {"pos": "VERB"}, <add> "V_Art_N__Number=Sing|Subcat=Tran": {"pos": "VERB"}, <add> "V_Conj_N_N__Number=Sing|Subcat=Tran|Tense=Past|VerbForm=Part": {"pos": "VERB"}, <add> "V_Conj_Pron__Subcat=Tran|Tense=Past|VerbForm=Part": {"pos": "VERB"}, <add> "V_N_Conj_Adj_N_Prep_Art_N__Degree=Pos|Number=Sing|Subcat=Tran|Tense=Past|VerbForm=Part": {"pos": "VERB"}, <add> "V_N_N__Number=Sing|Subcat=Intr|Tense=Pres|VerbForm=Part": {"pos": "VERB"}, <add> "V_N_N__Number=Sing|Subcat=Tran|Tense=Past|VerbForm=Part": {"pos": "VERB"}, <add> "V_N_V__Aspect=Imp|Mood=Ind|Number=Sing|Subcat=Intr|Tense=Pres|VerbForm=Inf": {"pos": "VERB"}, <add> "V_N__Number=Plur|Subcat=Tran|Tense=Past|VerbForm=Part": {"pos": "VERB"}, <add> "V_N|trans|imp_eigen|ev|neut__Number=Sing|Subcat=Tran": {"pos": "VERB"}, <add> "V_Prep|intrans|verldw|onverv_voor__Subcat=Intr|Tense=Past|VerbForm=Part": {"pos": "VERB"}, <add> "V_Pron_Adv_Adv_Pron_V__Aspect=Imp|Mood=Ind|Number=Sing|Person=2|Subcat=Tran|Tense=Pres|VerbForm=Fin": {"pos": "VERB"}, <add> "V_Pron_Adv__Aspect=Imp|Degree=Pos|Mood=Ind|Number=Sing|Person=2|Subcat=Tran|Tense=Pres|VerbForm=Fin": {"pos": "VERB"}, <add> "V_Pron_V__Aspect=Imp|Mood=Ind|Number=Sing|Person=3|Subcat=Tran|Tense=Pres|VerbForm=Fin": {"pos": "VERB"}, <add> "V_Pron__VerbType=Aux,Cop": {"pos": "VERB"}, <add> "V_V|hulp|imp_intrans|inf__VerbForm=Inf|VerbType=Mod": {"pos": "VERB"}, <add> "V|hulpofkopp|conj__Mood=Sub|VerbForm=Fin": {"pos": "VERB"}, <add> "V|hulpofkopp|conj__Mood=Sub|VerbForm=Fin|VerbType=Aux,Cop": {"pos": "VERB"}, <add> "V|hulpofkopp|imp__Mood=Imp|VerbForm=Fin": {"pos": "VERB"}, <add> "V|hulpofkopp|imp__Mood=Imp|VerbForm=Fin|VerbType=Aux,Cop": {"pos": "VERB"}, <add> "V|hulpofkopp|inf__VerbForm=Inf": {"pos": "VERB"}, <add> "V|hulpofkopp|inf__VerbForm=Inf|VerbType=Aux,Cop": {"pos": "VERB"}, <add> "V|hulpofkopp|inf|subst__VerbForm=Inf": {"pos": "VERB"}, <add> "V|hulpofkopp|ott|1of2of3|mv__Aspect=Imp|Mood=Ind|Number=Plur|Tense=Pres|VerbForm=Fin": {"pos": "VERB"}, <add> "V|hulpofkopp|ott|1of2of3|mv__Aspect=Imp|Mood=Ind|Number=Plur|Tense=Pres|VerbForm=Fin|VerbType=Aux,Cop": {"pos": "VERB"}, <add> "V|hulpofkopp|ott|1|ev__Aspect=Imp|Mood=Ind|Number=Sing|Person=1|Tense=Pres|VerbForm=Fin": {"pos": "VERB"}, <add> "V|hulpofkopp|ott|1|ev__Aspect=Imp|Mood=Ind|Number=Sing|Person=1|Tense=Pres|VerbForm=Fin|VerbType=Aux,Cop": {"pos": "VERB"}, <add> "V|hulpofkopp|ott|2|ev__Aspect=Imp|Mood=Ind|Number=Sing|Person=2|Tense=Pres|VerbForm=Fin": {"pos": "VERB"}, <add> "V|hulpofkopp|ott|2|ev__Aspect=Imp|Mood=Ind|Number=Sing|Person=2|Tense=Pres|VerbForm=Fin|VerbType=Aux,Cop": {"pos": "VERB"}, <add> "V|hulpofkopp|ott|3|ev__Aspect=Imp|Mood=Ind|Number=Sing|Person=3|Tense=Pres|VerbForm=Fin": {"pos": "VERB"}, <add> "V|hulpofkopp|ott|3|ev__Aspect=Imp|Mood=Ind|Number=Sing|Person=3|Tense=Pres|VerbForm=Fin|VerbType=Aux,Cop": {"pos": "VERB"}, <add> "V|hulpofkopp|ovt|1of2of3|ev__Aspect=Imp|Mood=Ind|Number=Sing|Tense=Past|VerbForm=Fin": {"pos": "VERB"}, <add> "V|hulpofkopp|ovt|1of2of3|ev__Aspect=Imp|Mood=Ind|Number=Sing|Tense=Past|VerbForm=Fin|VerbType=Aux,Cop": {"pos": "VERB"}, <add> "V|hulpofkopp|ovt|1of2of3|mv__Aspect=Imp|Mood=Ind|Number=Plur|Tense=Past|VerbForm=Fin": {"pos": "VERB"}, <add> "V|hulpofkopp|ovt|1of2of3|mv__Aspect=Imp|Mood=Ind|Number=Plur|Tense=Past|VerbForm=Fin|VerbType=Aux,Cop": {"pos": "VERB"}, <add> "V|hulpofkopp|tegdw|vervneut__Case=Nom|Tense=Pres|VerbForm=Part": {"pos": "VERB"}, <add> "V|hulpofkopp|tegdw|vervneut__Case=Nom|Tense=Pres|VerbForm=Part|VerbType=Aux,Cop": {"pos": "VERB"}, <add> "V|hulpofkopp|verldw|onverv__Tense=Past|VerbForm=Part": {"pos": "VERB"}, <add> "V|hulpofkopp|verldw|onverv__Tense=Past|VerbForm=Part|VerbType=Aux,Cop": {"pos": "VERB"}, <add> "V|hulp|conj__Mood=Sub|VerbForm=Fin|VerbType=Mod": {"pos": "VERB"}, <add> "V|hulp|inf__VerbForm=Inf": {"pos": "VERB"}, <add> "V|hulp|inf__VerbForm=Inf|VerbType=Mod": {"pos": "VERB"}, <add> "V|hulp|ott|1of2of3|mv__Aspect=Imp|Mood=Ind|Number=Plur|Tense=Pres|VerbForm=Fin": {"pos": "VERB"}, <add> "V|hulp|ott|1of2of3|mv__Aspect=Imp|Mood=Ind|Number=Plur|Tense=Pres|VerbForm=Fin|VerbType=Mod": {"pos": "VERB"}, <add> "V|hulp|ott|1|ev__Aspect=Imp|Mood=Ind|Number=Sing|Person=1|Tense=Pres|VerbForm=Fin": {"pos": "VERB"}, <add> "V|hulp|ott|1|ev__Aspect=Imp|Mood=Ind|Number=Sing|Person=1|Tense=Pres|VerbForm=Fin|VerbType=Mod": {"pos": "VERB"}, <add> "V|hulp|ott|2|ev__Aspect=Imp|Mood=Ind|Number=Sing|Person=2|Tense=Pres|VerbForm=Fin": {"pos": "VERB"}, <add> "V|hulp|ott|2|ev__Aspect=Imp|Mood=Ind|Number=Sing|Person=2|Tense=Pres|VerbForm=Fin|VerbType=Mod": {"pos": "VERB"}, <add> "V|hulp|ott|3|ev__Aspect=Imp|Mood=Ind|Number=Sing|Person=3|Tense=Pres|VerbForm=Fin": {"pos": "VERB"}, <add> "V|hulp|ott|3|ev__Aspect=Imp|Mood=Ind|Number=Sing|Person=3|Tense=Pres|VerbForm=Fin|VerbType=Mod": {"pos": "VERB"}, <add> "V|hulp|ovt|1of2of3|ev__Aspect=Imp|Mood=Ind|Number=Sing|Tense=Past|VerbForm=Fin": {"pos": "VERB"}, <add> "V|hulp|ovt|1of2of3|ev__Aspect=Imp|Mood=Ind|Number=Sing|Tense=Past|VerbForm=Fin|VerbType=Mod": {"pos": "VERB"}, <add> "V|hulp|ovt|1of2of3|mv__Aspect=Imp|Mood=Ind|Number=Plur|Tense=Past|VerbForm=Fin": {"pos": "VERB"}, <add> "V|hulp|ovt|1of2of3|mv__Aspect=Imp|Mood=Ind|Number=Plur|Tense=Past|VerbForm=Fin|VerbType=Mod": {"pos": "VERB"}, <add> "V|hulp|verldw|onverv__Tense=Past|VerbForm=Part": {"pos": "VERB"}, <add> "V|hulp|verldw|onverv__Tense=Past|VerbForm=Part|VerbType=Mod": {"pos": "VERB"}, <add> "V|intrans|conj__Mood=Sub|Subcat=Intr|VerbForm=Fin": {"pos": "VERB"}, <add> "V|intrans|imp__Mood=Imp|Subcat=Intr|VerbForm=Fin": {"pos": "VERB"}, <add> "V|intrans|inf__Subcat=Intr|VerbForm=Inf": {"pos": "VERB"}, <add> "V|intrans|inf|subst__Subcat=Intr|VerbForm=Inf": {"pos": "VERB"}, <add> "V|intrans|ott|1of2of3|mv__Aspect=Imp|Mood=Ind|Number=Plur|Subcat=Intr|Tense=Pres|VerbForm=Fin": {"pos": "VERB"}, <add> "V|intrans|ott|1|ev__Aspect=Imp|Mood=Ind|Number=Sing|Person=1|Subcat=Intr|Tense=Pres|VerbForm=Fin": {"pos": "VERB"}, <add> "V|intrans|ott|2|ev__Aspect=Imp|Mood=Ind|Number=Sing|Person=2|Subcat=Intr|Tense=Pres|VerbForm=Fin": {"pos": "VERB"}, <add> "V|intrans|ott|3|ev__Aspect=Imp|Mood=Ind|Number=Sing|Person=3|Subcat=Intr|Tense=Pres|VerbForm=Fin": {"pos": "VERB"}, <add> "V|intrans|ovt|1of2of3|ev__Aspect=Imp|Mood=Ind|Number=Sing|Subcat=Intr|Tense=Past|VerbForm=Fin": {"pos": "VERB"}, <add> "V|intrans|ovt|1of2of3|mv__Aspect=Imp|Mood=Ind|Number=Plur|Subcat=Intr|Tense=Past|VerbForm=Fin": {"pos": "VERB"}, <add> "V|intrans|tegdw|onverv__Subcat=Intr|Tense=Pres|VerbForm=Part": {"pos": "VERB"}, <add> "V|intrans|tegdw|vervmv__Number=Plur|Subcat=Intr|Tense=Pres|VerbForm=Part": {"pos": "VERB"}, <add> "V|intrans|tegdw|vervneut__Case=Nom|Subcat=Intr|Tense=Pres|VerbForm=Part": {"pos": "VERB"}, <add> "V|intrans|tegdw|vervvergr__Degree=Cmp|Subcat=Intr|Tense=Pres|VerbForm=Part": {"pos": "VERB"}, <add> "V|intrans|verldw|onverv__Subcat=Intr|Tense=Past|VerbForm=Part": {"pos": "VERB"}, <add> "V|intrans|verldw|vervmv__Number=Plur|Subcat=Intr|Tense=Past|VerbForm=Part": {"pos": "VERB"}, <add> "V|intrans|verldw|vervneut__Case=Nom|Subcat=Intr|Tense=Past|VerbForm=Part": {"pos": "VERB"}, <add> "V|refl|imp__Mood=Imp|Reflex=Yes|VerbForm=Fin": {"pos": "VERB"}, <add> "V|refl|inf__Reflex=Yes|VerbForm=Inf": {"pos": "VERB"}, <add> "V|refl|inf|subst__Reflex=Yes|VerbForm=Inf": {"pos": "VERB"}, <add> "V|refl|ott|1of2of3|mv__Aspect=Imp|Mood=Ind|Number=Plur|Reflex=Yes|Tense=Pres|VerbForm=Fin": {"pos": "VERB"}, <add> "V|refl|ott|1|ev__Aspect=Imp|Mood=Ind|Number=Sing|Person=1|Reflex=Yes|Tense=Pres|VerbForm=Fin": {"pos": "VERB"}, <add> "V|refl|ott|2|ev__Aspect=Imp|Mood=Ind|Number=Sing|Person=2|Reflex=Yes|Tense=Pres|VerbForm=Fin": {"pos": "VERB"}, <add> "V|refl|ott|3|ev__Aspect=Imp|Mood=Ind|Number=Sing|Person=3|Reflex=Yes|Tense=Pres|VerbForm=Fin": {"pos": "VERB"}, <add> "V|refl|ovt|1of2of3|ev__Aspect=Imp|Mood=Ind|Number=Sing|Reflex=Yes|Tense=Past|VerbForm=Fin": {"pos": "VERB"}, <add> "V|refl|ovt|1of2of3|mv__Aspect=Imp|Mood=Ind|Number=Plur|Reflex=Yes|Tense=Past|VerbForm=Fin": {"pos": "VERB"}, <add> "V|refl|tegdw|vervneut__Case=Nom|Reflex=Yes|Tense=Pres|VerbForm=Part": {"pos": "VERB"}, <add> "V|refl|verldw|onverv__Reflex=Yes|Tense=Past|VerbForm=Part": {"pos": "VERB"}, <add> "V|trans|conj__Mood=Sub|Subcat=Tran|VerbForm=Fin": {"pos": "VERB"}, <add> "V|trans|imp__Mood=Imp|Subcat=Tran|VerbForm=Fin": {"pos": "VERB"}, <add> "V|trans|inf__Subcat=Tran|VerbForm=Inf": {"pos": "VERB"}, <add> "V|trans|inf|subst__Subcat=Tran|VerbForm=Inf": {"pos": "VERB"}, <add> "V|trans|ott|1of2of3|mv__Aspect=Imp|Mood=Ind|Number=Plur|Subcat=Tran|Tense=Pres|VerbForm=Fin": {"pos": "VERB"}, <add> "V|trans|ott|1|ev__Aspect=Imp|Mood=Ind|Number=Sing|Person=1|Subcat=Tran|Tense=Pres|VerbForm=Fin": {"pos": "VERB"}, <add> "V|trans|ott|2|ev__Aspect=Imp|Mood=Ind|Number=Sing|Person=2|Subcat=Tran|Tense=Pres|VerbForm=Fin": {"pos": "VERB"}, <add> "V|trans|ott|3|ev__Aspect=Imp|Mood=Ind|Number=Sing|Person=3|Subcat=Tran|Tense=Pres|VerbForm=Fin": {"pos": "VERB"}, <add> "V|trans|ovt|1of2of3|ev__Aspect=Imp|Mood=Ind|Number=Sing|Subcat=Tran|Tense=Past|VerbForm=Fin": {"pos": "VERB"}, <add> "V|trans|ovt|1of2of3|mv__Aspect=Imp|Mood=Ind|Number=Plur|Subcat=Tran|Tense=Past|VerbForm=Fin": {"pos": "VERB"}, <add> "V|trans|tegdw|onverv__Subcat=Tran|Tense=Pres|VerbForm=Part": {"pos": "VERB"}, <add> "V|trans|tegdw|vervneut__Case=Nom|Subcat=Tran|Tense=Pres|VerbForm=Part": {"pos": "VERB"}, <add> "V|trans|verldw|onverv__Subcat=Tran|Tense=Past|VerbForm=Part": {"pos": "VERB"}, <add> "V|trans|verldw|vervmv__Number=Plur|Subcat=Tran|Tense=Past|VerbForm=Part": {"pos": "VERB"}, <add> "V|trans|verldw|vervneut__Case=Nom|Subcat=Tran|Tense=Past|VerbForm=Part": {"pos": "VERB"}, <add> "V|trans|verldw|vervvergr__Degree=Cmp|Subcat=Tran|Tense=Past|VerbForm=Part": {"pos": "VERB"}, <add> "X__Aspect=Imp|Definite=Def|Mood=Ind|Number=Plur|Person=3|Tense=Pres|VerbForm=Fin|VerbType=Mod": {"pos": "X"}, <add> "X__Aspect=Imp|Definite=Def|Mood=Ind|Number=Sing|Person=3|PronType=Ind|Tense=Pres|VerbForm=Fin": {"pos": "X"}, <add> "X__Aspect=Imp|Degree=Pos|Mood=Ind|Number=Sing|Person=2|Subcat=Tran|Tense=Pres|VerbForm=Fin": {"pos": "X"}, <add> "X__Aspect=Imp|Degree=Pos|Mood=Ind|Number=Sing|Person=2|Tense=Past|VerbForm=Part": {"pos": "X"}, <add> "X__Aspect=Imp|Degree=Pos|Mood=Ind|Number=Sing|Person=2|Tense=Pres|VerbForm=Inf": {"pos": "X"}, <add> "X__Aspect=Imp|Mood=Ind|Number=Sing|Person=1|Tense=Pres|VerbForm=Fin": {"pos": "X"}, <add> "X__Aspect=Imp|Mood=Ind|Number=Sing|Person=2|PronType=Dem|Tense=Pres|VerbForm=Fin": {"pos": "X"}, <add> "X__Aspect=Imp|Mood=Ind|Number=Sing|Person=2|PronType=Rel|Tense=Pres|VerbForm=Fin": {"pos": "X"}, <add> "X__Aspect=Imp|Mood=Ind|Number=Sing|Person=2|Subcat=Tran|Tense=Pres|VerbForm=Fin": {"pos": "X"}, <add> "X__Aspect=Imp|Mood=Ind|Number=Sing|Person=3|PronType=Ind|Tense=Pres|VerbForm=Fin": {"pos": "X"}, <add> "X__Aspect=Imp|Mood=Ind|Number=Sing|Person=3|Subcat=Tran|Tense=Pres|VerbForm=Fin": {"pos": "X"}, <add> "X__Aspect=Imp|Mood=Ind|Number=Sing|Person=3|Tense=Pres|VerbForm=Fin": {"pos": "X"}, <add> "X__Aspect=Imp|Mood=Ind|Number=Sing|Subcat=Intr|Tense=Pres|VerbForm=Inf": {"pos": "X"}, <add> "X__Aspect=Imp|Mood=Ind|Number=Sing|Tense=Past|VerbForm=Fin": {"pos": "X"}, <add> "X__Aspect=Imp|Mood=Ind|Person=3|PronType=Dem|Tense=Pres|VerbForm=Inf": {"pos": "X"}, <add> "X__Case=Dat|Degree=Pos|Number=Sing": {"pos": "X"}, <add> "X__Case=Dat|Number=Sing": {"pos": "X"}, <add> "X__Case=Gen|Definite=Def|Number=Sing": {"pos": "X"}, <add> "X__Case=Gen|Number=Plur|PronType=Dem": {"pos": "X"}, <add> "X__Case=Gen|Number=Plur|PronType=Ind": {"pos": "X"}, <add> "X__Case=Gen|Number=Sing": {"pos": "X"}, <add> "X__Case=Gen|Number=Sing|Person=3|Poss=Yes|PronType=Prs|VerbForm=Inf": {"pos": "X"}, <add> "X__Case=Gen|Number=Sing|PronType=Ind": {"pos": "X"}, <add> "X__Case=Nom|Definite=Def|Degree=Cmp|Gender=Neut": {"pos": "X"}, <add> "X__Case=Nom|Definite=Def|Degree=Sup": {"pos": "X"}, <add> "X__Case=Nom|Definite=Def|Degree=Sup|Gender=Neut": {"pos": "X"}, <add> "X__Case=Nom|Degree=Cmp": {"pos": "X"}, <add> "X__Case=Nom|Degree=Pos": {"pos": "X"}, <add> "X__Case=Nom|Degree=Pos|Gender=Neut": {"pos": "X"}, <add> "X__Case=Nom|Degree=Pos|Number=Plur": {"pos": "X"}, <add> "X__Case=Nom|Degree=Pos|Number=Sing": {"pos": "X"}, <add> "X__Case=Nom|Degree=Sup": {"pos": "X"}, <add> "X__Case=Nom|Degree=Sup|Number=Sing|Person=2|Poss=Yes|PronType=Prs": {"pos": "X"}, <add> "X__Case=Nom|Degree=Sup|PronType=Ind": {"pos": "X"}, <add> "X__Case=Nom|Number=Sing|Tense=Past|VerbForm=Part": {"pos": "X"}, <add> "X__Definite=Def": {"pos": "X"}, <add> "X__Definite=Def|Degree=Cmp|Gender=Neut": {"pos": "X"}, <add> "X__Definite=Def|Degree=Pos": {"pos": "X"}, <add> "X__Definite=Def|Degree=Pos|Number=Sing": {"pos": "X"}, <add> "X__Definite=Def|Degree=Pos|Variant=Short": {"pos": "X"}, <add> "X__Definite=Def|Degree=Sup|Gender=Neut": {"pos": "X"}, <add> "X__Definite=Def|Degree=Sup|Gender=Neut|Number=Sing": {"pos": "X"}, <add> "X__Definite=Def|Degree=Sup|Gender=Neut|PronType=Ind": {"pos": "X"}, <add> "X__Definite=Def|Gender=Neut": {"pos": "X"}, <add> "X__Definite=Def|Gender=Neut|Number=Plur|Person=3": {"pos": "X"}, <add> "X__Definite=Def|Gender=Neut|Number=Sing": {"pos": "X"}, <add> "X__Definite=Def|Number=Plur": {"pos": "X"}, <add> "X__Definite=Def|Number=Sing": {"pos": "X"}, <add> "X__Definite=Def|Number=Sing|Person=1": {"pos": "X"}, <add> "X__Definite=Def|Number=Sing|Tense=Past|VerbForm=Part": {"pos": "X"}, <add> "X__Definite=Def|Number=Sing|Tense=Pres|VerbForm=Part": {"pos": "X"}, <add> "X__Degree=Cmp": {"pos": "X"}, <add> "X__Degree=Cmp|Gender=Neut": {"pos": "X"}, <add> "X__Degree=Cmp|Number=Sing|Person=3": {"pos": "X"}, <add> "X__Degree=Cmp|PronType=Ind": {"pos": "X"}, <add> "X__Degree=Cmp|Variant=Short": {"pos": "X"}, <add> "X__Degree=Pos": {"pos": "X"}, <add> "X__Degree=Pos|Gender=Neut|Number=Sing": {"pos": "X"}, <add> "X__Degree=Pos|Mood=Imp|Variant=Short|VerbForm=Fin": {"pos": "X"}, <add> "X__Degree=Pos|Mood=Sub|VerbForm=Fin": {"pos": "X"}, <add> "X__Degree=Pos|Number=Plur": {"pos": "X"}, <add> "X__Degree=Pos|Number=Plur|Person=2|Subcat=Tran": {"pos": "X"}, <add> "X__Degree=Pos|Number=Plur|Variant=Short": {"pos": "X"}, <add> "X__Degree=Pos|Number=Sing": {"pos": "X"}, <add> "X__Degree=Pos|Number=Sing|Person=1|Poss=Yes|PronType=Prs": {"pos": "X"}, <add> "X__Degree=Pos|Number=Sing|Person=2": {"pos": "X"}, <add> "X__Degree=Pos|Number=Sing|Person=3": {"pos": "X"}, <add> "X__Degree=Pos|Number=Sing|PronType=Ind": {"pos": "X"}, <add> "X__Degree=Pos|Number=Sing|Subcat=Tran|Tense=Past|VerbForm=Part": {"pos": "X"}, <add> "X__Degree=Pos|Number=Sing|Tense=Past|VerbForm=Part": {"pos": "X"}, <add> "X__Degree=Pos|Number=Sing|Variant=Short": {"pos": "X"}, <add> "X__Degree=Pos|PronType=Dem": {"pos": "X"}, <add> "X__Degree=Pos|Subcat=Tran": {"pos": "X"}, <add> "X__Degree=Pos|Variant=Short": {"pos": "X"}, <add> "X__Degree=Pos|Variant=Short|VerbForm=Inf": {"pos": "X"}, <add> "X__Degree=Pos|VerbForm=Inf": {"pos": "X"}, <add> "X__Gender=Com|Number=Sing": {"pos": "X"}, <add> "X__Gender=Neut": {"pos": "X"}, <add> "X__Gender=Neut|Number=Sing": {"pos": "X"}, <add> "X__Gender=Neut|VerbForm=Inf": {"pos": "X"}, <add> "X__Mood=Sub|Number=Sing|VerbForm=Fin": {"pos": "X"}, <add> "X__Mood=Sub|VerbForm=Fin": {"pos": "X"}, <add> "X__Number=Plur": {"pos": "X"}, <add> "X__Number=Plur,Sing|Person=3": {"pos": "X"}, <add> "X__Number=Plur|Person=1|Poss=Yes|PronType=Prs|VerbForm=Inf": {"pos": "X"}, <add> "X__Number=Plur|PronType=Ind": {"pos": "X"}, <add> "X__Number=Plur|PronType=Int": {"pos": "X"}, <add> "X__Number=Plur|Subcat=Tran|Tense=Past|VerbForm=Part": {"pos": "X"}, <add> "X__Number=Plur|Tense=Past|VerbForm=Part": {"pos": "X"}, <add> "X__Number=Sing": {"pos": "X"}, <add> "X__Number=Sing|Person=3": {"pos": "X"}, <add> "X__Number=Sing|PronType=Dem": {"pos": "X"}, <add> "X__Number=Sing|PronType=Ind": {"pos": "X"}, <add> "X__Number=Sing|PronType=Int": {"pos": "X"}, <add> "X__Number=Sing|PronType=Rel": {"pos": "X"}, <add> "X__Number=Sing|Subcat=Intr|Tense=Pres|VerbForm=Part": {"pos": "X"}, <add> "X__Number=Sing|Subcat=Tran": {"pos": "X"}, <add> "X__Number=Sing|Subcat=Tran|Tense=Past|VerbForm=Part": {"pos": "X"}, <add> "X__Number=Sing|Tense=Past|VerbForm=Part": {"pos": "X"}, <add> "X__Number=Sing|Tense=Pres|VerbForm=Part": {"pos": "X"}, <add> "X__Person=3|PronType=Prs|Reflex=Yes": {"pos": "X"}, <add> "X__PronType=Dem": {"pos": "X"}, <add> "X__PronType=Ind": {"pos": "X"}, <add> "X__PronType=Int": {"pos": "X"}, <add> "X__PronType=Rel": {"pos": "X"}, <add> "X__Subcat=Intr|Tense=Past|VerbForm=Part": {"pos": "X"}, <add> "X__Subcat=Tran|Tense=Past|VerbForm=Part": {"pos": "X"}, <add> "X__VerbForm=Inf": {"pos": "X"}, <add> "X__VerbForm=Inf|VerbType=Mod": {"pos": "X"}, <add> "X__VerbType=Aux,Cop": {"pos": "X"}, <add> "X___": {"pos": "X"}, <add> "_SP": {"pos": "SPACE"} <add>}
2
Java
Java
fix minor code nit from d2977441
9edfd945d141bdcb428ad3387c08a362883dbe17
<ide><path>ReactAndroid/src/main/java/com/facebook/react/modules/intent/IntentModule.java <ide> public void openURL(String url, Promise promise) { <ide> getReactApplicationContext().getPackageManager()); <ide> String otherPackageName = (componentName != null ? componentName.getPackageName() : ""); <ide> <del> // Always add the FLAG_ACTIVITY_NEW_TASK if we are launching to a different package <del> if (!selfPackageName.equals(otherPackageName)) { <add> // If there is no currentActivity or we are launching to a different package we need to set <add> // the FLAG_ACTIVITY_NEW_TASK flag <add> if (currentActivity == null || !selfPackageName.equals(otherPackageName)) { <ide> intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); <ide> } <ide> <ide> if (currentActivity != null) { <ide> currentActivity.startActivity(intent); <ide> } else { <del> // If no currentActivity, we want to always start a new task regardless of logic above <del> intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); <ide> getReactApplicationContext().startActivity(intent); <ide> } <ide>
1
Text
Text
improve process event headers
b92c6563024044c34b48165270e8464499e3c0bb
<ide><path>doc/api/net.md <ide> added: v0.3.4 <ide> Creates a new socket object. <ide> <ide> * `options` {Object} Available options are: <del> * `fd`: {number} If specified, wrap around an existing socket with <add> * `fd` {number} If specified, wrap around an existing socket with <ide> the given file descriptor, otherwise a new socket will be created. <ide> * `allowHalfOpen` {boolean} Indicates whether half-opened TCP connections <ide> are allowed. See [`net.createServer()`][] and the [`'end'`][] event <ide><path>doc/api/process.md <ide> the IPC channel is closed. <ide> added: v0.1.7 <ide> --> <ide> <add>* `code` {integer} <add> <ide> The `'exit'` event is emitted when the Node.js process is about to exit as a <ide> result of either: <ide> <ide> all `'exit'` listeners have finished running the Node.js process will terminate. <ide> <ide> The listener callback function is invoked with the exit code specified either <ide> by the [`process.exitCode`][] property, or the `exitCode` argument passed to the <del>[`process.exit()`] method, as the only argument. <add>[`process.exit()`] method. <ide> <ide> ```js <ide> process.on('exit', (code) => { <ide> process.on('exit', (code) => { <ide> added: v0.5.10 <ide> --> <ide> <add>* `message` {Object} a parsed JSON object or primitive value. <add>* `sendHandle` {net.Server|net.Socket} a [`net.Server`][] or [`net.Socket`][] <add> object, or undefined. <add> <ide> If the Node.js process is spawned with an IPC channel (see the [Child Process][] <ide> and [Cluster][] documentation), the `'message'` event is emitted whenever a <ide> message sent by a parent process using [`childprocess.send()`][] is received by <ide> the child process. <ide> <del>The listener callback is invoked with the following arguments: <del>* `message` {Object} a parsed JSON object or primitive value. <del>* `sendHandle` {net.Server|net.Socket} a [`net.Server`][] or [`net.Socket`][] <del> object, or undefined. <del> <ide> The message goes through serialization and parsing. The resulting message might <ide> not be the same as what is originally sent. <ide> <ide> not be the same as what is originally sent. <ide> added: v1.4.1 <ide> --> <ide> <add>* `promise` {Promise} The late handled promise. <add> <ide> The `'rejectionHandled'` event is emitted whenever a `Promise` has been rejected <ide> and an error handler was attached to it (using [`promise.catch()`][], for <ide> example) later than one turn of the Node.js event loop. <ide> <del>The listener callback is invoked with a reference to the rejected `Promise` as <del>the only argument. <del> <ide> The `Promise` object would have previously been emitted in an <ide> `'unhandledRejection'` event, but during the course of processing gained a <ide> rejection handler. <ide> when the list of unhandled rejections shrinks. <ide> <ide> ```js <ide> const unhandledRejections = new Map(); <del>process.on('unhandledRejection', (reason, p) => { <del> unhandledRejections.set(p, reason); <add>process.on('unhandledRejection', (reason, promise) => { <add> unhandledRejections.set(promise, reason); <ide> }); <del>process.on('rejectionHandled', (p) => { <del> unhandledRejections.delete(p); <add>process.on('rejectionHandled', (promise) => { <add> unhandledRejections.delete(promise); <ide> }); <ide> ``` <ide> <ide> being emitted. Alternatively, the [`'rejectionHandled'`][] event may be used. <ide> added: v6.0.0 <ide> --> <ide> <add>* `warning` {Error} Key properties of the warning are: <add> * `name` {string} The name of the warning. **Default:** `'Warning'`. <add> * `message` {string} A system-provided description of the warning. <add> * `stack` {string} A stack trace to the location in the code where the warning <add> was issued. <add> <ide> The `'warning'` event is emitted whenever Node.js emits a process warning. <ide> <ide> A process warning is similar to an error in that it describes exceptional <ide> are not part of the normal Node.js and JavaScript error handling flow. <ide> Node.js can emit warnings whenever it detects bad coding practices that could <ide> lead to sub-optimal application performance, bugs, or security vulnerabilities. <ide> <del>The listener function is called with a single `warning` argument whose value is <del>an `Error` object. There are three key properties that describe the warning: <del> <del>* `name` {string} The name of the warning (currently `'Warning'` by default). <del>* `message` {string} A system-provided description of the warning. <del>* `stack` {string} A stack trace to the location in the code where the warning <del> was issued. <del> <ide> ```js <ide> process.on('warning', (warning) => { <ide> console.warn(warning.name); // Print the warning name
2
Text
Text
add russian translation
0b2f63f939f1395394b00f59031fd08a1229f69c
<ide><path>curriculum/challenges/russian/03-front-end-libraries/jquery/target-the-children-of-an-element-using-jquery.russian.md <ide> id: bad87fee1348bd9aed208826 <ide> title: Target the Children of an Element Using jQuery <ide> challengeType: 6 <ide> videoUrl: '' <del>localeTitle: Цель детей элемента с помощью jQuery <add>localeTitle: Выбрать дочерние элементы с помощью jQuery <ide> --- <ide> <ide> ## Description <del>undefined <add>Когда HTML элементы размещены на один уровень ниже другого, они называются `дочерними` этого элемента. Например, элементы кнопки в этом задании с текстом "#target1", "#target2", и "#target3" являются `дочерними` элемента `<div class="well" id="left-well">`. <add> <add>В jQuery есть функция `children()`, которая позволяет вам получить доступ к дочерним элементам любого выбранного вами элемента. <add> <add>Ниже пример того, как бы вы использовали функцию `children()`, чтобы дать `синий` цвет дочерним элементам вашего `left-well`. <add> <add>`$("#left-well").children().css("color", "blue")` <ide> <ide> ## Instructions <del><section id="instructions"> Дайте всем детям вашего <code>right-well</code> элемента колорит оранжевый цвет. </section> <add><section id="instructions"> Дайте всем дочерним элементам вашего <code>right-well</code> элемента колорит оранжевый цвет. </section> <ide> <ide> ## Tests <ide> <section id='tests'> <ide> <ide> ```yml <ide> tests: <del> - text: '' <add> - text: 'Все дочерние элементы <code>#right-well</code> должны иметь оранжевый текст' <ide> testString: 'assert($("#right-well").children().css("color") === "rgb(255, 165, 0)", "All children of <code>#right-well</code> should have orange text.");' <ide> - text: Вы должны использовать функцию <code>children()</code> для изменения этих элементов. <ide> testString: 'assert(code.match(/\.children\(\)\.css/g), "You should use the <code>children&#40&#41</code> function to modify these elements.");' <del> - text: '' <add> - text: 'Используйте только jQuery, чтобы добавить эти классы к элементу.' <ide> testString: 'assert(code.match(/<div class="well" id="right-well">/g), "Only use jQuery to add these classes to the element.");' <ide> <ide> ```
1
Python
Python
fix mypy errors in `dev/*`
08e835729b50cac2a68fab24bf2b52a587112776
<ide><path>dev/import_all_classes.py <ide> import traceback <ide> import warnings <ide> from inspect import isclass <del>from typing import List, Set, Tuple <add>from typing import List, Optional, Set, Tuple <ide> from warnings import WarningMessage <ide> <ide> from rich import print <ide> def import_all_classes( <ide> paths: List[str], <ide> prefix: str, <del> provider_ids: List[str] = None, <add> provider_ids: Optional[List[str]] = None, <ide> print_imports: bool = False, <ide> print_skips: bool = False, <ide> ) -> Tuple[List[str], List[WarningMessage]]: <ide><path>dev/prepare_release_issue.py <ide> import subprocess <ide> import textwrap <ide> from collections import defaultdict <del>from typing import Any, Dict, List, NamedTuple, Optional, Set <add>from typing import Any, Dict, List, NamedTuple, Optional, Set, Union <ide> <ide> import click <ide> from github import Github, Issue, PullRequest, UnknownObjectException <ide> <ide> console = Console(width=400, color_system="standard") <ide> <add>PullRequestOrIssue = Union[PullRequest.PullRequest, Issue.Issue] <add> <ide> MY_DIR_PATH = os.path.dirname(__file__) <ide> SOURCE_DIR_PATH = os.path.abspath(os.path.join(MY_DIR_PATH, os.pardir)) <ide> PR_PATTERN = re.compile(r".*\(#([0-9]+)\)") <ide> def render_template( <ide> <ide> def print_issue_content( <ide> current_release: str, <del> pull_requests: Dict[int, PullRequest.PullRequest], <add> pull_requests: Dict[int, PullRequestOrIssue], <ide> linked_issues: Dict[int, List[Issue.Issue]], <ide> users: Dict[int, Set[str]], <ide> ): <ide> def generate_issue_content( <ide> else: <ide> excluded_prs = [] <ide> changes = get_changes(verbose, previous_release, current_release) <del> prs = list( <del> filter(lambda pr: pr is not None and pr not in excluded_prs, [change.pr for change in changes]) <del> ) <add> change_prs = [change.pr for change in changes] <add> prs = [pr for pr in change_prs if pr is not None and pr not in excluded_prs] <add> <ide> g = Github(github_token) <ide> repo = g.get_repo("apache/airflow") <del> pull_requests: Dict[int, PullRequest.PullRequest] = {} <add> pull_requests: Dict[int, PullRequestOrIssue] = {} <ide> linked_issues: Dict[int, List[Issue.Issue]] = defaultdict(lambda: []) <ide> users: Dict[int, Set[str]] = defaultdict(lambda: set()) <ide> count_prs = len(prs) <ide> def generate_issue_content( <ide> progress.console.print( <ide> f"Retrieving PR#{pr_number}: " f"https://github.com/apache/airflow/pull/{pr_number}" <ide> ) <add> <add> pr: PullRequestOrIssue <ide> try: <ide> pr = repo.get_pull(pr_number) <ide> except UnknownObjectException: <ide><path>dev/provider_packages/prepare_provider_packages.py <ide> from os.path import dirname, relpath <ide> from pathlib import Path <ide> from shutil import copyfile <del>from typing import Any, Dict, Iterable, List, NamedTuple, Optional, Set, Tuple, Type <add>from typing import Any, Dict, Iterable, List, NamedTuple, Optional, Set, Tuple, Type, Union <ide> <ide> import click <ide> import jsonschema <del>from github import Github, PullRequest, UnknownObjectException <add>from github import Github, Issue, PullRequest, UnknownObjectException <ide> from packaging.version import Version <ide> from rich.console import Console <ide> from rich.progress import Progress <ide> def get_all_changes_for_package( <ide> provider_package_id: str, <ide> source_provider_package_path: str, <ide> verbose: bool, <del>) -> Tuple[bool, Optional[List[List[Change]]], str]: <add>) -> Tuple[bool, Optional[Union[List[List[Change]], Change]], str]: <ide> """ <ide> Retrieves all changes for the package. <ide> :param versions: list of versions <ide> def update_release_notes( <ide> return False <ide> else: <ide> if interactive and confirm("Are those changes documentation-only?"): <del> mark_latest_changes_as_documentation_only(provider_details, latest_change) <add> if isinstance(latest_change, Change): <add> mark_latest_changes_as_documentation_only(provider_details, latest_change) <add> else: <add> raise ValueError( <add> "Expected only one change to be present to mark changes " <add> f"in provider {provider_package_id} as docs-only. " <add> f"Received {len(latest_change)}." <add> ) <ide> return False <ide> <ide> jinja_context["DETAILED_CHANGES_RST"] = changes <ide> def get_all_providers() -> List[str]: <ide> return list(PROVIDERS_REQUIREMENTS.keys()) <ide> <ide> <del>def verify_provider_package(provider_package_id: str) -> str: <add>def verify_provider_package(provider_package_id: str) -> None: <ide> """ <ide> Verifies if the provider package is good. <ide> :param provider_package_id: package id to verify <ide> def get_prs_for_package(package_id: str) -> List[int]: <ide> return prs <ide> <ide> <add>PullRequestOrIssue = Union[PullRequest.PullRequest, Issue.Issue] <add> <add> <ide> class ProviderPRInfo(NamedTuple): <ide> provider_details: ProviderPackageDetails <del> pr_list: List[PullRequest.PullRequest] <add> pr_list: List[PullRequestOrIssue] <ide> <ide> <ide> @cli.command() <ide> def generate_issue_content(package_ids: List[str], github_token: str, suffix: st <ide> all_prs.update(provider_prs[package_id]) <ide> g = Github(github_token) <ide> repo = g.get_repo("apache/airflow") <del> pull_requests: Dict[int, PullRequest.PullRequest] = {} <add> pull_requests: Dict[int, PullRequestOrIssue] = {} <ide> with Progress(console=console) as progress: <ide> task = progress.add_task(f"Retrieving {len(all_prs)} PRs ", total=len(all_prs)) <ide> pr_list = list(all_prs) <ide><path>dev/validate_version_added_fields_in_config.py <ide> def read_local_config_options() -> Set[Tuple[str, str, str]]: <ide> to_check_versions: List[str] = [d for d in airflow_version if d.startswith("2.")] <ide> <ide> # 2. Compute expected options set with version added fields <del>computed_options: Set[Tuple[str, str, str]] = set() <add>expected_computed_options: Set[Tuple[str, str, str]] = set() <ide> for prev_version, curr_version in zip(to_check_versions[:-1], to_check_versions[1:]): <ide> print("Processing version:", curr_version) <ide> options_1 = fetch_config_options_for_version(prev_version) <ide> options_2 = fetch_config_options_for_version(curr_version) <ide> new_options = options_2 - options_1 <del> computed_options.update( <add> expected_computed_options.update( <ide> {(section_name, option_name, curr_version) for section_name, option_name in new_options} <ide> ) <del>print("Computed options count:", len(computed_options)) <add>print("Expected computed options count:", len(expected_computed_options)) <ide> <ide> # 3. Read local options set <ide> local_options = read_local_config_options() <ide> def read_local_config_options() -> Set[Tuple[str, str, str]]: <ide> } <ide> computed_options: Set[Tuple[str, str, str]] = { <ide> (section_name, option_name, version_added) <del> for section_name, option_name, version_added in computed_options <add> for section_name, option_name, version_added in expected_computed_options <ide> if (section_name, option_name) in local_options_plain <ide> } <ide> print("Visible computed options count:", len(computed_options))
4
Python
Python
add init_checkpoint for nhnet benchmark
986b08256273c8f5ee592130422e9c021be6b2b6
<ide><path>official/benchmark/nhnet_benchmark.py <ide> MIN_LOSS = 0.40 <ide> MAX_LOSS = 0.55 <ide> NHNET_DATA = 'gs://tf-perfzero-data/nhnet/v1/processed/train.tfrecord*' <add>PRETRAINED_CHECKPOINT_PATH = 'gs://cloud-tpu-checkpoints/bert/keras_bert/uncased_L-24_H-1024_A-16/bert_model.ckpt' <ide> <ide> FLAGS = flags.FLAGS <ide> <ide> def benchmark_accuracy_4x4_tpu_f32_50k_steps(self): <ide> FLAGS.train_steps = 50000 <ide> FLAGS.checkpoint_interval = FLAGS.train_steps <ide> FLAGS.distribution_strategy = 'tpu' <add> FLAGS.init_checkpoint = PRETRAINED_CHECKPOINT_PATH <ide> FLAGS.model_dir = self._get_model_dir( <ide> 'benchmark_accuracy_4x4_tpu_bf32_50k_steps') <ide> self._run_and_report_benchmark()
1
Javascript
Javascript
shorten jquery/jqlite describe
ff2cb86d5db4150cded494728b64095d05be4a71
<ide><path>docs/src/ngdoc.js <ide> Doc.prototype = { <ide> function scenarios(docs){ <ide> var specs = []; <ide> <del> specs.push('describe("angular without jquery", function() {'); <add> specs.push('describe("angular+jqlite", function() {'); <ide> appendSpecs('index.html'); <ide> specs.push('});'); <ide> <ide> specs.push(''); <ide> specs.push(''); <ide> <del> specs.push('describe("angular with jquery", function() {'); <add> specs.push('describe("angular+jquery", function() {'); <ide> appendSpecs('index-jq.html'); <ide> specs.push('});'); <ide>
1
Ruby
Ruby
fix handling of parseerror in controllers
7d2d00a334418ff040a646f5b9446fb3283d0694
<ide><path>actionpack/lib/action_controller/metal/params_wrapper.rb <ide> def _wrapper_enabled? <ide> return false unless request.has_content_type? <ide> <ide> ref = request.content_mime_type.ref <add> <ide> _wrapper_formats.include?(ref) && _wrapper_key && !request.parameters.key?(_wrapper_key) <add> rescue ActionDispatch::Http::Parameters::ParseError <add> false <ide> end <ide> <ide> def _perform_parameter_wrapping <ide> def _perform_parameter_wrapping <ide> <ide> # This will display the wrapped hash in the log file. <ide> request.filtered_parameters.merge! wrapped_filtered_hash <del> rescue ActionDispatch::Http::Parameters::ParseError <del> # swallow parse error exception <ide> end <ide> end <ide> end <ide><path>actionpack/test/controller/rescue_test.rb <ide> class ResourceUnavailable < StandardError <ide> class ResourceUnavailableToRescueAsString < StandardError <ide> end <ide> <add> wrap_parameters format: :json <add> <ide> # We use a fully qualified name in some strings, and a relative constant <ide> # name in some other to test correct handling of both cases. <ide>
2
Javascript
Javascript
extract createrouter from application#initialize
b6159885e88c842922e53395e531f5220327c3f8
<ide><path>packages/ember-application/lib/system/application.js <ide> Ember.Application = Ember.Namespace.extend( <ide> @param router {Ember.Router} <ide> */ <ide> initialize: function(router) { <del> if (!router && Ember.Router.detect(this.Router)) { <del> router = this.Router.create(); <del> this._createdRouter = router; <del> } <del> <del> if (router) { <del> set(this, 'router', router); <del> <del> // By default, the router's namespace is the current application. <del> // <del> // This allows it to find model classes when a state has a <del> // route like `/posts/:post_id`. In that case, it would first <del> // convert `post_id` into `Post`, and then look it up on its <del> // namespace. <del> set(router, 'namespace', this); <del> } <add> router = this.createRouter(router); <ide> <ide> this.runInjections(router); <ide> <ide> Ember.Application = Ember.Namespace.extend( <ide> }); <ide> }, <ide> <add> /** @private */ <add> createRouter: function(router) { <add> if (!router && Ember.Router.detect(this.Router)) { <add> router = this.Router.create(); <add> this._createdRouter = router; <add> } <add> <add> if (router) { <add> set(this, 'router', router); <add> <add> // By default, the router's namespace is the current application. <add> // <add> // This allows it to find model classes when a state has a <add> // route like `/posts/:post_id`. In that case, it would first <add> // convert `post_id` into `Post`, and then look it up on its <add> // namespace. <add> set(router, 'namespace', this); <add> } <add> <add> return router; <add> }, <add> <add> /** @private */ <ide> didBecomeReady: function() { <ide> var eventDispatcher = get(this, 'eventDispatcher'), <ide> customEvents = get(this, 'customEvents'),
1
PHP
PHP
extract method for readability
f25833f216ca208550b00cf19ae5806cbe419822
<ide><path>src/Illuminate/Auth/Access/Gate.php <ide> public function check($ability, $arguments = []) <ide> $arguments = [$arguments]; <ide> } <ide> <del> if (isset($arguments[0]) && isset($this->policies[$argumentClass = get_class($arguments[0])])) { <del> $callback = [$this->resolvePolicy($this->policies[$argumentClass]), $ability]; <add> if ($this->firstArgumentCorrespondsToPolicy($arguments)) { <add> $callback = [$this->resolvePolicy($this->policies[get_class($arguments[0])]), $ability]; <ide> } elseif (isset($this->abilities[$ability])) { <ide> $callback = $this->abilities[$ability]; <ide> } else { <ide> public function check($ability, $arguments = []) <ide> return call_user_func_array($callback, $arguments); <ide> } <ide> <add> /** <add> * Determine if the first argument in the array corresponds to a policy. <add> * <add> * @param array $arguments <add> * @return bool <add> */ <add> protected function firstArgumentCorrespondsToPolicy(array $arguments) <add> { <add> return isset($arguments[0]) && is_object($arguments[0]) && <add> isset($this->policies[get_class($arguments[0])]); <add> } <add> <ide> /** <ide> * Get a policy instance for a given class. <ide> *
1
Ruby
Ruby
reduce allocations in action_view cache expiry
732372c928744a4da441691f84bc137969ba4eff
<ide><path>actionview/lib/action_view/cache_expiry.rb <ide> def clear_cache <ide> <ide> private <ide> def dirs_to_watch <del> fs_paths = all_view_paths.grep(FileSystemResolver) <del> fs_paths.map(&:path).sort.uniq <add> all_view_paths.grep(FileSystemResolver).map!(&:path).tap(&:uniq!).sort! <ide> end <ide> <ide> def all_view_paths
1
Python
Python
fix usage of `click.get_terminal_size()`
5f67cc0747ea661b703e4c44c77e7cd005cb9588
<ide><path>dev/send_email.py <ide> # This tool is based on the Superset send_email script: <ide> # https://github.com/apache/incubator-superset/blob/master/RELEASING/send_email.py <ide> import os <add>import shutil <ide> import smtplib <ide> import ssl <ide> import sys <ide> def show_message(entity: str, message: str): <ide> """ <ide> Show message on the Command Line <ide> """ <del> width, _ = click.get_terminal_size() # type: ignore[attr-defined] <add> width, _ = shutil.get_terminal_size() <ide> click.secho("-" * width, fg="blue") <ide> click.secho(f"{entity} Message:", fg="bright_red", bold=True) <ide> click.secho("-" * width, fg="blue")
1
Go
Go
increase timeout on testrunoomexitcode test
8d1455d88b66011713da67098dc3464b897af9cd
<ide><path>integration-cli/docker_cli_run_test.go <ide> func TestRunOOMExitCode(t *testing.T) { <ide> go func() { <ide> defer close(done) <ide> <del> runCmd := exec.Command(dockerBinary, "run", "-m", "4MB", "busybox", "sh", "-c", "x=a; while true; do x=$x$x; done") <add> runCmd := exec.Command(dockerBinary, "run", "-m", "4MB", "busybox", "sh", "-c", "x=a; while true; do x=$x$x$x$x; done") <ide> out, exitCode, _ := runCommandWithOutput(runCmd) <ide> if expected := 137; exitCode != expected { <ide> t.Fatalf("wrong exit code for OOM container: expected %d, got %d (output: %q)", expected, exitCode, out) <ide> func TestRunOOMExitCode(t *testing.T) { <ide> <ide> select { <ide> case <-done: <del> case <-time.After(3 * time.Second): <add> case <-time.After(30 * time.Second): <ide> t.Fatal("Timeout waiting for container to die on OOM") <ide> } <ide>
1
PHP
PHP
fix errors with postgres tests
b20ca3f4e01a49b3f4e93505a57ec77f1502ce50
<ide><path>lib/Cake/Test/Case/Model/Behavior/TranslateBehaviorTest.php <ide> public function testFetchTranslationsWithZero() { <ide> <ide> $model = new TranslatedItem(); <ide> $translateModel = $model->translateModel(); <del> $translateModel->updateAll(array('content' => '"0"')); <add> $translateModel->updateAll(array('content' => "'0'")); <ide> $model->locale = 'eng'; <ide> <ide> $result = $model->read(null, 1);
1
Go
Go
extract createtarfile() from applylayer
710d5a48fb751623fbf77a51b89f2dfbf0edac68
<ide><path>archive/archive.go <ide> import ( <ide> "os/exec" <ide> "path" <ide> "path/filepath" <add> "syscall" <ide> ) <ide> <ide> type Archive io.Reader <ide> func (compression *Compression) Extension() string { <ide> return "" <ide> } <ide> <add>func createTarFile(path, extractDir string, hdr *tar.Header, reader *tar.Reader) error { <add> switch hdr.Typeflag { <add> case tar.TypeDir: <add> // Create directory unless it exists as a directory already. <add> // In that case we just want to merge the two <add> if fi, err := os.Lstat(path); !(err == nil && fi.IsDir()) { <add> if err := os.Mkdir(path, os.FileMode(hdr.Mode)); err != nil { <add> return err <add> } <add> } <add> <add> case tar.TypeReg, tar.TypeRegA: <add> // Source is regular file <add> file, err := os.OpenFile(path, os.O_CREATE|os.O_WRONLY, os.FileMode(hdr.Mode)) <add> if err != nil { <add> return err <add> } <add> if _, err := io.Copy(file, reader); err != nil { <add> file.Close() <add> return err <add> } <add> file.Close() <add> <add> case tar.TypeBlock, tar.TypeChar, tar.TypeFifo: <add> mode := uint32(hdr.Mode & 07777) <add> switch hdr.Typeflag { <add> case tar.TypeBlock: <add> mode |= syscall.S_IFBLK <add> case tar.TypeChar: <add> mode |= syscall.S_IFCHR <add> case tar.TypeFifo: <add> mode |= syscall.S_IFIFO <add> } <add> <add> if err := syscall.Mknod(path, mode, int(mkdev(hdr.Devmajor, hdr.Devminor))); err != nil { <add> return err <add> } <add> <add> case tar.TypeLink: <add> if err := os.Link(filepath.Join(extractDir, hdr.Linkname), path); err != nil { <add> return err <add> } <add> <add> case tar.TypeSymlink: <add> if err := os.Symlink(hdr.Linkname, path); err != nil { <add> return err <add> } <add> <add> default: <add> return fmt.Errorf("Unhandled tar header type %d\n", hdr.Typeflag) <add> } <add> <add> if err := syscall.Lchown(path, hdr.Uid, hdr.Gid); err != nil { <add> return err <add> } <add> <add> // There is no LChmod, so ignore mode for symlink. Also, this <add> // must happen after chown, as that can modify the file mode <add> if hdr.Typeflag != tar.TypeSymlink { <add> if err := syscall.Chmod(path, uint32(hdr.Mode&07777)); err != nil { <add> return err <add> } <add> } <add> <add> ts := []syscall.Timespec{timeToTimespec(hdr.AccessTime), timeToTimespec(hdr.ModTime)} <add> // syscall.UtimesNano doesn't support a NOFOLLOW flag atm, and <add> if hdr.Typeflag != tar.TypeSymlink { <add> if err := syscall.UtimesNano(path, ts); err != nil { <add> return err <add> } <add> } else { <add> if err := LUtimesNano(path, ts); err != nil { <add> return err <add> } <add> } <add> return nil <add>} <add> <ide> // Tar creates an archive from the directory at `path`, and returns it as a <ide> // stream of bytes. <ide> func Tar(path string, compression Compression) (io.Reader, error) { <ide><path>archive/diff.go <ide> package archive <ide> <ide> import ( <ide> "archive/tar" <del> "github.com/dotcloud/docker/utils" <ide> "io" <ide> "os" <ide> "path/filepath" <ide> func ApplyLayer(dest string, layer Archive) error { <ide> // The only exception is when it is a directory *and* the file from <ide> // the layer is also a directory. Then we want to merge them (i.e. <ide> // just apply the metadata from the layer). <del> hasDir := false <ide> if fi, err := os.Lstat(path); err == nil { <del> if fi.IsDir() && hdr.Typeflag == tar.TypeDir { <del> hasDir = true <del> } else { <add> if !(fi.IsDir() && hdr.Typeflag == tar.TypeDir) { <ide> if err := os.RemoveAll(path); err != nil { <ide> return err <ide> } <ide> } <ide> } <ide> <del> switch hdr.Typeflag { <del> case tar.TypeDir: <del> if !hasDir { <del> err = os.Mkdir(path, os.FileMode(hdr.Mode)) <del> if err != nil { <del> return err <del> } <del> } <del> dirs = append(dirs, hdr) <del> <del> case tar.TypeReg, tar.TypeRegA: <del> // Source is regular file <del> file, err := os.OpenFile(path, os.O_CREATE|os.O_WRONLY, os.FileMode(hdr.Mode)) <del> if err != nil { <del> return err <del> } <del> if _, err := io.Copy(file, tr); err != nil { <del> file.Close() <del> return err <del> } <del> file.Close() <del> <del> case tar.TypeBlock, tar.TypeChar, tar.TypeFifo: <del> mode := uint32(hdr.Mode & 07777) <del> switch hdr.Typeflag { <del> case tar.TypeBlock: <del> mode |= syscall.S_IFBLK <del> case tar.TypeChar: <del> mode |= syscall.S_IFCHR <del> case tar.TypeFifo: <del> mode |= syscall.S_IFIFO <del> } <del> <del> if err := syscall.Mknod(path, mode, int(mkdev(hdr.Devmajor, hdr.Devminor))); err != nil { <del> return err <del> } <del> <del> case tar.TypeLink: <del> if err := os.Link(filepath.Join(dest, hdr.Linkname), path); err != nil { <del> return err <del> } <del> <del> case tar.TypeSymlink: <del> if err := os.Symlink(hdr.Linkname, path); err != nil { <del> return err <del> } <del> <del> default: <del> utils.Debugf("unhandled type %d\n", hdr.Typeflag) <del> } <del> <del> if err = syscall.Lchown(path, hdr.Uid, hdr.Gid); err != nil { <add> if err := createTarFile(path, dest, hdr, tr); err != nil { <ide> return err <ide> } <ide> <del> // There is no LChmod, so ignore mode for symlink. Also, this <del> // must happen after chown, as that can modify the file mode <del> if hdr.Typeflag != tar.TypeSymlink { <del> err = syscall.Chmod(path, uint32(hdr.Mode&07777)) <del> if err != nil { <del> return err <del> } <del> } <del> <del> // Directories must be handled at the end to avoid further <del> // file creation in them to modify the mtime <del> if hdr.Typeflag != tar.TypeDir { <del> ts := []syscall.Timespec{timeToTimespec(hdr.AccessTime), timeToTimespec(hdr.ModTime)} <del> // syscall.UtimesNano doesn't support a NOFOLLOW flag atm, and <del> if hdr.Typeflag != tar.TypeSymlink { <del> if err := syscall.UtimesNano(path, ts); err != nil { <del> return err <del> } <del> } else { <del> if err := LUtimesNano(path, ts); err != nil { <del> return err <del> } <del> } <add> // Directory mtimes must be handled at the end to avoid further <add> // file creation in them to modify the directory mtime <add> if hdr.Typeflag == tar.TypeDir { <add> dirs = append(dirs, hdr) <ide> } <ide> } <ide> }
2
Javascript
Javascript
add support for capturerejection option
e490d9b1539a7ec5f6b9d9b2f18753ce1c3459f7
<ide><path>lib/_stream_readable.js <ide> function Readable(options) { <ide> this._destroy = options.destroy; <ide> } <ide> <del> Stream.call(this); <add> Stream.call(this, options); <ide> } <ide> <ide> ObjectDefineProperty(Readable.prototype, 'destroyed', { <ide> Readable.prototype._destroy = function(err, cb) { <ide> cb(err); <ide> }; <ide> <add>Readable.prototype[EE.captureRejectionSymbol] = function(err) { <add> // TODO(mcollina): remove the destroyed if once errorEmitted lands in <add> // Readable. <add> if (!this.destroyed) { <add> this.destroy(err); <add> } <add>}; <add> <ide> // Manually shove something into the read() buffer. <ide> // This returns true if the highWaterMark has not been hit yet, <ide> // similar to how Writable.write() returns true if you should <ide><path>lib/_stream_writable.js <ide> module.exports = Writable; <ide> Writable.WritableState = WritableState; <ide> <ide> const internalUtil = require('internal/util'); <add>const EE = require('events'); <ide> const Stream = require('stream'); <ide> const { Buffer } = require('buffer'); <ide> const destroyImpl = require('internal/streams/destroy'); <ide> function Writable(options) { <ide> this._final = options.final; <ide> } <ide> <del> Stream.call(this); <add> Stream.call(this, options); <ide> } <ide> <ide> // Otherwise people can pipe Writable streams, which is just wrong. <ide> Writable.prototype._undestroy = destroyImpl.undestroy; <ide> Writable.prototype._destroy = function(err, cb) { <ide> cb(err); <ide> }; <add> <add>Writable.prototype[EE.captureRejectionSymbol] = function(err) { <add> this.destroy(err); <add>}; <ide><path>lib/internal/streams/legacy.js <ide> const { <ide> <ide> const EE = require('events'); <ide> <del>function Stream() { <del> EE.call(this); <add>function Stream(opts) { <add> EE.call(this, opts); <ide> } <ide> ObjectSetPrototypeOf(Stream.prototype, EE.prototype); <ide> ObjectSetPrototypeOf(Stream, EE); <ide><path>test/parallel/test-stream-catch-rejections.js <add>'use strict'; <add> <add>const common = require('../common'); <add>const stream = require('stream'); <add>const assert = require('assert'); <add> <add>{ <add> const r = new stream.Readable({ <add> captureRejections: true, <add> read() { <add> this.push('hello'); <add> this.push('world'); <add> this.push(null); <add> } <add> }); <add> <add> const err = new Error('kaboom'); <add> <add> r.on('error', common.mustCall((_err) => { <add> assert.strictEqual(err, _err); <add> assert.strictEqual(r.destroyed, true); <add> })); <add> <add> r.on('data', async () => { <add> throw err; <add> }); <add>} <add> <add>{ <add> const w = new stream.Writable({ <add> captureRejections: true, <add> highWaterMark: 1, <add> write(chunk, enc, cb) { <add> cb(); <add> } <add> }); <add> <add> const err = new Error('kaboom'); <add> <add> w.write('hello', () => { <add> w.write('world'); <add> }); <add> <add> w.on('error', common.mustCall((_err) => { <add> assert.strictEqual(err, _err); <add> assert.strictEqual(w.destroyed, true); <add> })); <add> <add> w.on('drain', common.mustCall(async () => { <add> throw err; <add> }, 2)); <add>}
4
Javascript
Javascript
ignore private function
a1080d93578b6cae80819fd96f3429536c542e18
<ide><path>packages/ember-testing/lib/support.js <ide> function testCheckboxClick(handler) { <ide> } <ide> <ide> $(function() { <del> /** <add> /* <ide> Determine whether a checkbox checked using jQuery's "click" method will have <ide> the correct value for its checked property. <ide>
1
Javascript
Javascript
fix non-hidden cumulative chart on duration view
f105343759a30fbab6a0a95617e9df3493b1ed3e
<ide><path>airflow/www/static/js/duration_chart.js <ide> function handleCheck() { <ide> } <ide> } <ide> $(document).on('chartload', handleCheck); <add>$(document).ready(handleCheck); <ide> <ide> $('#isCumulative').on('click', handleCheck);
1
Python
Python
escape \u2028 and \u2029 in json output
23fa6e54ce978055f7d4af5f5f99bc6f419f990b
<ide><path>rest_framework/renderers.py <ide> def render(self, data, accepted_media_type=None, renderer_context=None): <ide> # and may (or may not) be unicode. <ide> # On python 3.x json.dumps() returns unicode strings. <ide> if isinstance(ret, six.text_type): <add> # We always fully escape \u2028 and \u2029 to ensure we output JSON <add> # that is a strict javascript subset. If bytes were returned <add> # by json.dumps() then we don't have these characters in any case. <add> # See: http://timelessrepo.com/json-isnt-a-javascript-subset <add> ret = ret.replace('\u2028', '\\u2028').replace('\u2029', '\\u2029') <ide> return bytes(ret.encode('utf-8')) <ide> return ret <ide> <ide><path>tests/test_renderers.py <ide> def test_proper_encoding(self): <ide> content = renderer.render(obj, 'application/json') <ide> self.assertEqual(content, '{"countries":["United Kingdom","France","España"]}'.encode('utf-8')) <ide> <add> def test_u2028_u2029(self): <add> # The \u2028 and \u2029 characters should be escaped, <add> # even when the non-escaping unicode representation is used. <add> # Regression test for #2169 <add> obj = {'should_escape': '\u2028\u2029'} <add> renderer = JSONRenderer() <add> content = renderer.render(obj, 'application/json') <add> self.assertEqual(content, '{"should_escape":"\\u2028\\u2029"}'.encode('utf-8')) <add> <ide> <ide> class AsciiJSONRendererTests(TestCase): <ide> """
2
Python
Python
fix bug of multi-gpu training in lm finetuning
b8ff56896ccbd27a54035a90a3bc278a44541a74
<ide><path>examples/lm_finetuning/finetune_on_pregenerated.py <ide> def main(): <ide> global_step += 1 <ide> <ide> # Save a trained model <del> if n_gpu > 1 and torch.distributed.get_rank() == 0 or n_gpu <=1 : <add> if args.local_rank == -1 or torch.distributed.get_rank() == 0: <ide> logging.info("** ** * Saving fine-tuned model ** ** * ") <ide> model.save_pretrained(args.output_dir) <ide> tokenizer.save_pretrained(args.output_dir) <ide><path>examples/lm_finetuning/simple_lm_finetuning.py <ide> def main(): <ide> <ide> if os.path.exists(args.output_dir) and os.listdir(args.output_dir): <ide> raise ValueError("Output directory ({}) already exists and is not empty.".format(args.output_dir)) <del> if not os.path.exists(args.output_dir) and ( n_gpu > 1 and torch.distributed.get_rank() == 0 or n_gpu <=1 ): <add> if not os.path.exists(args.output_dir) and (args.local_rank == -1 or torch.distributed.get_rank() == 0): <ide> os.makedirs(args.output_dir) <ide> <ide> tokenizer = BertTokenizer.from_pretrained(args.bert_model, do_lower_case=args.do_lower_case) <ide> def main(): <ide> global_step += 1 <ide> <ide> # Save a trained model <del> if args.do_train and ( n_gpu > 1 and torch.distributed.get_rank() == 0 or n_gpu <=1): <add> if args.do_train and (args.local_rank == -1 or torch.distributed.get_rank() == 0): <ide> logger.info("** ** * Saving fine - tuned model ** ** * ") <ide> model.save_pretrained(args.output_dir) <ide> tokenizer.save_pretrained(args.output_dir)
2
Text
Text
add the text "software" , "operating through"
199ebeaef691610ca752860091ece6f6aebed73c
<ide><path>guide/english/python/anaconda/index.md <ide> --- <ide> title: Anaconda <ide> --- <del>![alt text](https://www.anaconda.com/wp-content/themes/anaconda/images/logo-dark.png) <ide> <del>**Anaconda** is a package manager, environment manager and Python distribution with a collection of numerous packages. Anaconda is platform-agnostic, so you can use it whether you are on Windows, macOS or Linux. <del>Anaconda easily creates, saves, loads and switches between environments on your local computer. It was created for Python programs, but it can package and distribute software for any language. <del>Anaconda as a package manager helps you find and install packages. If you need a package that requires a different version of Python, you do not need to switch to a different environment manager, because Anaconda is also an environment manager. With just a few commands, you can set up a totally separate environment to run that different version of Python, while continuing to run your usual version of Python in your normal environment. <add>![alt text](https://www.anaconda.com/wp-content/themes/anaconda/images/logo-dark.png) <ide> <add>**Anaconda** is a package manager, environment manager and Python distribution software with a collection of numerous packages. Anaconda is platform-agnostic, so you can use it whether you are on Windows, macOS or Linux. <add>Anaconda easily creates, saves, loads and switches between environments on your system. It was initially created for Python programs, but it can package and distribute software for any language. <add>Anaconda, as a package manager, helps you find and install packages. If you need a package that requires a different version of Python, you do not need to switch to a different environment manager, because Anaconda is also an environment manager. With just a few commands, you can set up a totally separate environment to run that different version of Python, while continuing to run your usual version of Python in your normal environment. <ide> <ide> ## Overview <ide>
1
Python
Python
convert a number of layers
a744b600e94ae00fbec71ef493afdff48bc3816b
<ide><path>keras/layers/containers.py <ide> from __future__ import print_function <ide> <ide> from collections import OrderedDict <del>import theano.tensor as T <add>from .. import backend as K <ide> from ..layers.core import Layer, Merge <del>from ..utils.theano_utils import ndim_tensor <ide> from six.moves import range <ide> <ide> <ide> def get_output(self, train=False): <ide> def set_input(self): <ide> for l in self.layers: <ide> if hasattr(l, 'input'): <del> ndim = l.input.ndim <del> self.layers[0].input = ndim_tensor(ndim) <add> ndim = len(K.get_shape(l.input)) <add> self.layers[0].input = K.placeholder(ndim=ndim) <ide> break <ide> <ide> def get_input(self, train=False): <ide> if not hasattr(self.layers[0], 'input'): <ide> self.set_input() <ide> return self.layers[0].get_input(train) <del> <add> <ide> @property <ide> def input_shape(self): <ide> return self.layers[0].input_shape <del> <add> <ide> @property <ide> def input(self): <ide> return self.get_input() <ide> def add_input(self, name, input_shape, dtype='float'): <ide> layer.set_input_shape(input_shape) <ide> ndim = len(input_shape) + 1 <ide> if dtype == 'float': <del> layer.input = ndim_tensor(ndim) <add> layer.input = K.placeholder(ndim=ndim) <ide> else: <ide> if ndim == 2: <del> layer.input = T.imatrix() <add> layer.input = K.placeholder(ndim=2, dtype='int32') <ide> else: <ide> raise Exception('Type "int" can only be used with ndim==2 (Embedding).') <ide> layer.input.name = name <ide> def add_input(self, name, input_shape, dtype='float'): <ide> 'dtype': dtype}) <ide> <ide> def add_node(self, layer, name, input=None, inputs=[], <del> merge_mode='concat', concat_axis=-1, dot_axes=-1, create_output=False): <del> if hasattr(layer, 'set_name'): <del> layer.set_name(name) <add> merge_mode='concat', concat_axis=-1, dot_axes=-1, <add> create_output=False): <ide> if name in self.namespace: <ide> raise Exception('Duplicate node identifier: ' + name) <ide> if input: <ide> def add_node(self, layer, name, input=None, inputs=[], <ide> to_merge.append(self.inputs[n]) <ide> else: <ide> raise Exception('Unknown identifier: ' + n) <del> merge = Merge(to_merge, mode=merge_mode, concat_axis=concat_axis, dot_axes=dot_axes) <add> merge = Merge(to_merge, mode=merge_mode, <add> concat_axis=concat_axis, dot_axes=dot_axes) <ide> layer.set_previous(merge) <ide> <ide> self.namespace.add(name) <ide> def add_output(self, name, input=None, inputs=[], <ide> if n not in self.nodes: <ide> raise Exception('Unknown identifier: ' + n) <ide> to_merge.append(self.nodes[n]) <del> merge = Merge(to_merge, mode=merge_mode, concat_axis=concat_axis, dot_axes=dot_axes) <add> merge = Merge(to_merge, mode=merge_mode, <add> concat_axis=concat_axis, dot_axes=dot_axes) <ide> self.outputs[name] = merge <ide> <ide> self.output_order.append(name) <ide><path>keras/layers/core.py <ide> from __future__ import absolute_import <ide> from __future__ import division <ide> <del>import theano <del>import theano.tensor as T <ide> import numpy as np <ide> <ide> from collections import OrderedDict <ide> import copy <add>from six.moves import zip <ide> <add>from .. import backend as K <ide> from .. import activations, initializations, regularizers, constraints <del>from ..utils.theano_utils import shared_zeros, floatX, ndim_tensor <del>from ..utils.generic_utils import make_tuple <del>from ..regularizers import ActivityRegularizer, Regularizer <del> <del>from theano.sandbox.rng_mrg import MRG_RandomStreams as RandomStreams <del>from six.moves import zip <add>from ..regularizers import ActivityRegularizer <ide> <ide> <ide> class Layer(object): <ide> def set_input_shape(self, input_shape): <ide> raise Exception('Invalid input shape - Layer expects input ndim=' + <ide> str(self.input_ndim) + ', was provided with input shape ' + str(input_shape)) <ide> self._input_shape = input_shape <del> self.input = ndim_tensor(len(self._input_shape)) <add> self.input = K.placeholder(ndim=len(self._input_shape)) <ide> self.build() <ide> <ide> @property <ide> def set_weights(self, weights): <ide> assert len(self.params) == len(weights), 'Provided weight array does not match layer weights (' + \ <ide> str(len(self.params)) + ' layer params vs. ' + str(len(weights)) + ' provided weights)' <ide> for p, w in zip(self.params, weights): <del> if p.eval().shape != w.shape: <del> raise Exception("Layer shape %s not compatible with weight shape %s." % (p.eval().shape, w.shape)) <del> p.set_value(floatX(w)) <add> if K.get_value(p).shape != w.shape: <add> raise Exception("Layer shape %s not compatible with weight shape %s." % (K.get_value(p).shape, w.shape)) <add> K.set_value(p, w) <ide> <ide> def get_weights(self): <ide> weights = [] <ide> for p in self.params: <del> weights.append(p.get_value()) <add> weights.append(K.get_value(p)) <ide> return weights <ide> <ide> def get_config(self): <ide> def get_params(self): <ide> <ide> return self.params, regularizers, consts, updates <ide> <del> def set_name(self, name): <del> for i in range(len(self.params)): <del> self.params[i].name = '%s_p%d' % (name, i) <del> <ide> def count_params(self): <del> return sum([np.prod(p.shape.eval()) for p in self.params]) <add> return sum([K.count_params(p) for p in self.params]) <ide> <ide> <ide> class MaskedLayer(Layer): <ide> ''' <del> If your layer trivially supports masking (by simply copying the input mask to the output), then subclass MaskedLayer <del> instead of Layer, and make sure that you incorporate the input mask into your calculation of get_output() <add> If your layer trivially supports masking <add> (by simply copying the input mask to the output), <add> then subclass MaskedLayer instead of Layer, <add> and make sure that you incorporate the input mask <add> into your calculation of get_output() <ide> ''' <ide> def supports_masked_input(self): <ide> return True <ide> def get_input_mask(self, train=False): <ide> return None <ide> <ide> def get_output_mask(self, train=False): <del> ''' The default output mask is just the input mask unchanged. Override this in your own <del> implementations if, for instance, you are reshaping the input''' <add> ''' The default output mask is just the input mask unchanged. <add> Override this in your own implementations if, <add> for instance, you are reshaping the input''' <ide> return self.get_input_mask(train) <ide> <ide> <ide> class Masking(MaskedLayer): <ide> def __init__(self, mask_value=0., **kwargs): <ide> super(Masking, self).__init__(**kwargs) <ide> self.mask_value = mask_value <del> self.input = T.tensor3() <add> self.input = K.placeholder(ndim=3) <ide> <ide> def get_output_mask(self, train=False): <ide> X = self.get_input(train) <del> return T.any(T.ones_like(X) * (1. - T.eq(X, self.mask_value)), axis=-1) <add> return K.any(K.ones_like(X) * (1. - K.equal(X, self.mask_value)), <add> axis=-1) <ide> <ide> def get_output(self, train=False): <ide> X = self.get_input(train) <del> return X * T.shape_padright(T.any((1. - T.eq(X, self.mask_value)), axis=-1)) <add> return X * K.any((1. - K.equal(X, self.mask_value)), <add> axis=-1, keepdims=True) <ide> <ide> def get_config(self): <ide> config = {"name": self.__class__.__name__, <ide> def output_shape(self): <ide> def get_output(self, train=False): <ide> X = self.get_input(train) <ide> if self.mode == 'ave': <del> s = theano.tensor.mean(X, axis=1) <add> s = K.mean(X, axis=1) <ide> return s <ide> if self.mode == 'sum': <del> s = theano.tensor.sum(X, axis=1) <add> s = K.sum(X, axis=1) <ide> return s <ide> elif self.mode == 'mul': <del> s = theano.tensor.mul(X, axis=1) <add> s = K.prod(X, axis=1) <ide> return s <ide> else: <ide> raise Exception('Unknown merge mode') <ide> def __init__(self, layers, mode='sum', concat_axis=-1, dot_axes=-1): <ide> raise Exception("Only layers of same output shape can be merged using " + mode + " mode. " + <ide> "Layer shapes: %s" % ([l.output_shape for l in layers])) <ide> if mode in {'cos', 'dot'}: <add> if K._BACKEND != 'theano': <add> raise Exception('"' + mode + '" merge mode will only work with Theano.') <add> <ide> if len(layers) > 2: <ide> raise Exception(mode + " merge takes exactly 2 layers") <ide> shape1 = layers[0].output_shape <ide> def get_output(self, train=False): <ide> return s <ide> elif self.mode == 'concat': <ide> inputs = [self.layers[i].get_output(train) for i in range(len(self.layers))] <del> return T.concatenate(inputs, axis=self.concat_axis) <add> return K.concatenate(inputs, axis=self.concat_axis) <ide> elif self.mode == 'join': <ide> inputs = OrderedDict() <ide> for i in range(len(self.layers)): <ide> def get_output(self, train=False): <ide> s *= self.layers[i].get_output(train) <ide> return s <ide> elif self.mode == 'dot': <add> if K._BACKEND != 'theano': <add> raise Exception('"dot" merge mode will only work with Theano.') <add> from theano import tensor as T <ide> l1 = self.layers[0].get_output(train) <ide> l2 = self.layers[1].get_output(train) <ide> output = T.batched_tensordot(l1, l2, self.dot_axes) <ide> def get_output(self, train=False): <ide> output = output.reshape(tuple(output_shape)) <ide> return output <ide> elif self.mode == 'cos': <add> if K._BACKEND != 'theano': <add> raise Exception('"dot" merge mode will only work with Theano.') <add> import theano <ide> l1 = self.layers[0].get_output(train) <ide> l2 = self.layers[1].get_output(train) <del> output, _ = theano.scan(lambda v1, v2: T.dot(v1, v2) / T.sqrt(T.dot(v1, v1) * T.dot(v2, v2)), <add> output, _ = theano.scan(lambda v1, v2: K.dot(v1, v2) / K.sqrt(K.dot(v1, v1) * K.dot(v2, v2)), <ide> sequences=[l1, l2], <ide> outputs_info=None) <ide> return output <ide> class Dropout(MaskedLayer): <ide> def __init__(self, p, **kwargs): <ide> super(Dropout, self).__init__(**kwargs) <ide> self.p = p <del> self.srng = RandomStreams(seed=np.random.randint(10e6)) <ide> <ide> def get_output(self, train=False): <ide> X = self.get_input(train) <ide> if self.p > 0.: <del> retain_prob = 1. - self.p <ide> if train: <del> X *= self.srng.binomial(X.shape, p=retain_prob, dtype=theano.config.floatX) / retain_prob <add> X = K.dropout(X, level=self.p) <ide> return X <ide> <ide> def get_config(self): <ide> def output_shape(self): <ide> def get_output(self, train=False): <ide> X = self.get_input(train) <ide> new_shape = (X.shape[0],) + self.dims <del> return theano.tensor.reshape(X, new_shape) <add> return K.reshape(X, new_shape) <ide> <ide> def get_config(self): <ide> config = {"name": self.__class__.__name__, <ide> def output_shape(self): <ide> <ide> def get_output(self, train=False): <ide> X = self.get_input(train) <del> return X.dimshuffle((0,) + self.dims) <add> return K.permute_dimensions(X, (0,) + self.dims) <ide> <ide> def get_config(self): <ide> config = {"name": self.__class__.__name__, <ide> def output_shape(self): <ide> <ide> def get_output(self, train=False): <ide> X = self.get_input(train) <del> size = theano.tensor.prod(X.shape) // X.shape[0] <del> nshape = (X.shape[0], size) <del> return theano.tensor.reshape(X, nshape) <add> return K.flatten(X) <ide> <ide> <ide> class RepeatVector(Layer): <ide> def output_shape(self): <ide> <ide> def get_output(self, train=False): <ide> X = self.get_input(train) <del> tensors = [X]*self.n <del> stacked = theano.tensor.stack(*tensors) <del> return stacked.dimshuffle((1, 0, 2)) <add> return K.repeat(X, self.n) <ide> <ide> def get_config(self): <ide> config = {"name": self.__class__.__name__, <ide> def __init__(self, output_dim, init='glorot_uniform', activation='linear', weigh <ide> def build(self): <ide> input_dim = self.input_shape[1] <ide> <del> self.input = T.matrix() <add> self.input = K.placeholder(ndim=2) <ide> self.W = self.init((input_dim, self.output_dim)) <del> self.b = shared_zeros((self.output_dim,)) <add> self.b = K.zeros((self.output_dim,)) <ide> <ide> self.params = [self.W, self.b] <ide> <ide> def output_shape(self): <ide> <ide> def get_output(self, train=False): <ide> X = self.get_input(train) <del> output = self.activation(T.dot(X, self.W) + self.b) <add> output = self.activation(K.dot(X, self.W) + self.b) <ide> return output <ide> <ide> def get_config(self): <ide> def __init__(self, output_dim, init='glorot_uniform', activation='linear', weigh <ide> def build(self): <ide> input_dim = self.input_shape[2] <ide> <del> self.input = T.tensor3() <add> self.input = K.placeholder(ndim=3) <ide> self.W = self.init((input_dim, self.output_dim)) <del> self.b = shared_zeros((self.output_dim)) <add> self.b = K.zeros((self.output_dim)) <ide> <ide> self.params = [self.W, self.b] <ide> self.regularizers = [] <ide> def output_shape(self): <ide> <ide> def get_output(self, train=False): <ide> X = self.get_input(train) <del> output = self.activation(T.dot(X.dimshuffle(1, 0, 2), self.W) + self.b) <del> return output.dimshuffle(1, 0, 2) <add> output = self.activation(K.dot(K.permute_dimensions(X, (1, 0, 2)), <add> self.W) + self.b) <add> return K.permute_dimensions(output, (1, 0, 2)) <ide> <ide> def get_config(self): <ide> config = {"name": self.__class__.__name__, <ide> def __init__(self, output_dim, nb_feature=4, init='glorot_uniform', weights=None <ide> def build(self): <ide> input_dim = self.input_shape[1] <ide> <del> self.input = T.matrix() <add> self.input = K.placeholder(ndim=2) <ide> self.W = self.init((self.nb_feature, input_dim, self.output_dim)) <del> self.b = shared_zeros((self.nb_feature, self.output_dim)) <add> self.b = K.zeros((self.nb_feature, self.output_dim)) <ide> <ide> self.params = [self.W, self.b] <ide> self.regularizers = [] <ide> def output_shape(self): <ide> def get_output(self, train=False): <ide> X = self.get_input(train) <ide> # -- don't need activation since it's just linear. <del> output = T.max(T.dot(X, self.W) + self.b, axis=1) <add> output = K.max(K.dot(X, self.W) + self.b, axis=1) <ide> return output <ide> <ide> def get_config(self): <ide><path>keras/layers/normalization.py <ide> from ..layers.core import Layer <del>from ..utils.theano_utils import shared_zeros, shared_ones, ndim_tensor, floatX <ide> from .. import initializations <del> <del>import theano.tensor as T <add>from .. import backend as K <ide> <ide> <ide> class BatchNormalization(Layer): <ide> ''' <ide> Reference: <del> Batch Normalization: Accelerating Deep Network Training by Reducing Internal Covariate Shift <add> Batch Normalization: Accelerating Deep Network Training <add> by Reducing Internal Covariate Shift <ide> http://arxiv.org/pdf/1502.03167v3.pdf <ide> <ide> mode: 0 -> featurewise normalization <del> 1 -> samplewise normalization (may sometimes outperform featurewise mode) <add> 1 -> samplewise normalization <add> (may sometimes outperform featurewise mode) <ide> <del> momentum: momentum term in the computation of a running estimate of the mean and std of the data <add> momentum: momentum term in the computation <add> of a running estimate of the mean and std of the data <ide> ''' <del> def __init__(self, epsilon=1e-6, mode=0, momentum=0.9, weights=None, **kwargs): <add> def __init__(self, epsilon=1e-6, mode=0, momentum=0.9, <add> weights=None, **kwargs): <ide> self.init = initializations.get("uniform") <ide> self.epsilon = epsilon <ide> self.mode = mode <ide> def __init__(self, epsilon=1e-6, mode=0, momentum=0.9, weights=None, **kwargs): <ide> def build(self): <ide> input_shape = self.input_shape # starts with samples axis <ide> input_shape = input_shape[1:] <del> self.input = ndim_tensor(len(input_shape) + 1) <add> self.input = K.placeholder(ndim=len(input_shape) + 1) <ide> <ide> self.gamma = self.init((input_shape)) <del> self.beta = shared_zeros(input_shape) <add> self.beta = K.zeros(input_shape) <ide> <ide> self.params = [self.gamma, self.beta] <del> self.running_mean = shared_zeros(input_shape) <del> self.running_std = shared_ones((input_shape)) <add> self.running_mean = K.zeros(input_shape) <add> self.running_std = K.ones((input_shape)) <ide> <ide> # initialize self.updates: batch mean/std computation <ide> X = self.get_input(train=True) <del> m = X.mean(axis=0) <del> std = T.mean((X - m) ** 2 + self.epsilon, axis=0) ** 0.5 <add> m = K.mean(X, axis=0) <add> std = K.mean((X - m) ** 2 + self.epsilon, axis=0) ** 0.5 <ide> mean_update = self.momentum * self.running_mean + (1-self.momentum) * m <ide> std_update = self.momentum * self.running_std + (1-self.momentum) * std <del> self.updates = [(self.running_mean, mean_update), (self.running_std, std_update)] <add> self.updates = [(self.running_mean, mean_update), <add> (self.running_std, std_update)] <ide> <ide> if self.initial_weights is not None: <ide> self.set_weights(self.initial_weights) <ide> del self.initial_weights <ide> <ide> def get_weights(self): <del> return super(BatchNormalization, self).get_weights() + [self.running_mean.get_value(), self.running_std.get_value()] <add> super_weights = super(BatchNormalization, self).get_weights() <add> return super_weights + [K.get_value(self.running_mean), <add> K.get_value(self.running_std)] <ide> <ide> def set_weights(self, weights): <del> self.running_mean.set_value(floatX(weights[-2])) <del> self.running_std.set_value(floatX(weights[-1])) <add> K.set_value(self.running_mean, weights[-2]) <add> K.set_value(self.running_std, weights[-1]) <ide> super(BatchNormalization, self).set_weights(weights[:-2]) <ide> <ide> def get_output(self, train): <ide> X = self.get_input(train) <del> <ide> if self.mode == 0: <del> X_normed = (X - self.running_mean) / (self.running_std + self.epsilon) <del> <add> X_normed = ((X - self.running_mean) / <add> (self.running_std + self.epsilon)) <ide> elif self.mode == 1: <del> m = X.mean(axis=-1, keepdims=True) <del> std = X.std(axis=-1, keepdims=True) <add> m = K.mean(X, axis=-1, keepdims=True) <add> std = K.std(X, axis=-1, keepdims=True) <ide> X_normed = (X - m) / (std + self.epsilon) <del> <ide> out = self.gamma * X_normed + self.beta <ide> return out <ide> <ide> def __init__(self, alpha=1e-4, k=2, beta=0.75, n=5, **kwargs): <ide> <ide> def get_output(self, train): <ide> X = self.get_input(train) <del> b, ch, r, c = X.shape <add> b, ch, r, c = K.shape(X) <ide> half_n = self.n // 2 <del> input_sqr = T.sqr(X) <del> extra_channels = T.alloc(0., b, ch + 2*half_n, r, c) <del> # TODO: use concatenate instead <del> input_sqr = T.set_subtensor(extra_channels[:, half_n:half_n+ch, :, :], input_sqr) <add> input_sqr = K.square(X) <add> extra_channels = K.zeros((b, ch + 2*half_n, r, c)) <add> input_sqr = K.concatenate([extra_channels[:, :half_n, :, :], <add> input_sqr, <add> extra_channels[:, half_n+ch:, :, :]], <add> axis=1) <ide> scale = self.k <ide> for i in range(self.n): <ide> scale += self.alpha * input_sqr[:, i:i+ch, :, :] <ide><path>keras/utils/layer_utils.py <ide> from __future__ import print_function <ide> import inspect <ide> import numpy as np <del>import theano <ide> import copy <ide> <ide> from ..layers.advanced_activations import LeakyReLU, PReLU <del>from ..layers.core import Dense, Merge, Dropout, Activation, Reshape, Flatten, RepeatVector, Layer, AutoEncoder, Masking, Permute <del>from ..layers.core import ActivityRegularization, TimeDistributedDense, TimeDistributedMerge, AutoEncoder, MaxoutDense <del>from ..layers.convolutional import Convolution1D, Convolution2D, MaxPooling1D, MaxPooling2D, ZeroPadding2D <del>from ..layers.embeddings import Embedding, WordContextProduct <del>from ..layers.noise import GaussianNoise, GaussianDropout <del>from ..layers.normalization import BatchNormalization, LRN2D <del>from ..layers.recurrent import SimpleRNN, SimpleDeepRNN, GRU, LSTM, JZS1, JZS2, JZS3 <add>from ..layers.core import * <add>from ..layers.convolutional import * <add>from ..layers.embeddings import * <add>from ..layers.noise import * <add>from ..layers.normalization import * <add>from ..layers.recurrent import * <ide> from ..layers import containers <ide> from .. import regularizers <ide> from .. import constraints <ide> def container_from_config(original_layer_dict, custom_objects={}): <ide> layer_dict = copy.deepcopy(original_layer_dict) <ide> name = layer_dict.get('name') <ide> <del> # Insert custom layers into globals so they can be accessed by `get_from_module`. <add> # Insert custom layers into globals so they can <add> # be accessed by `get_from_module`. <ide> for cls_key in custom_objects: <ide> globals()[cls_key] = custom_objects[cls_key] <ide> <ide> def container_from_config(original_layer_dict, custom_objects={}): <ide> layer_dict[k] = constraints.get(vname, v) <ide> elif vname in [x for x, y in inspect.getmembers(regularizers, predicate=inspect.isclass)]: <ide> layer_dict[k] = regularizers.get(vname, v) <del> else: # not a regularizer of constraint, don't touch it <add> else: <add> # not a regularizer of constraint, don't touch it <ide> v['name'] = vname <ide> <ide> base_layer = get_layer(name, layer_dict) <ide> return base_layer <ide> <ide> <del>def print_layer_shapes(model, input_shapes): <del> """ <del> Utility function to print the shape of the output at each layer of a Model <del> <del> Arguments: <del> model: instance of Model / Merge <del> input_shapes: dict (Graph), list of tuples (Merge) or tuple (Sequential) <del> """ <del> if model.__class__.__name__ in ['Sequential', 'Merge']: <del> # in this case input_shapes is a tuple, or a list [shape1, shape2] <del> if not isinstance(input_shapes[0], tuple): <del> input_shapes = [input_shapes] <del> <del> inputs = model.get_input(train=False) <del> if not isinstance(inputs, list): <del> inputs = [inputs] <del> input_dummy = [np.zeros(shape, dtype=np.float32) <del> for shape in input_shapes] <del> layers = model.layers <del> <del> elif model.__class__.__name__ == 'Graph': <del> # in this case input_shapes is a dictionary <del> inputs = [model.inputs[name].input <del> for name in model.input_order] <del> input_dummy = [np.zeros(input_shapes[name], dtype=np.float32) <del> for name in model.input_order] <del> layers = [model.nodes[c['name']] for c in model.node_config] <del> <del> print("input shapes : ", input_shapes) <del> for l in layers: <del> shape_f = theano.function(inputs, l.get_output(train=False).shape, <del> on_unused_input='ignore') <del> out_shape = tuple(shape_f(*input_dummy)) <del> config = l.get_config() <del> print('shape after %s: %s' % (config['name'], out_shape)) <del> <del> <ide> from .generic_utils import get_from_module <ide> def get_layer(identifier, kwargs=None): <del> return get_from_module(identifier, globals(), 'layer', instantiate=True, kwargs=kwargs) <add> return get_from_module(identifier, globals(), 'layer', <add> instantiate=True, kwargs=kwargs)
4
Python
Python
simplify release utils
cec89e1a0e6f6df92de8976daacc765eeca198bc
<ide><path>utils/release.py <ide> import os <ide> import re <ide> <del>import git <ide> import packaging.version <ide> <ide> <ide> "setup": "setup.py", <ide> } <ide> README_FILE = "README.md" <del>CUSTOM_JS_FILE = "docs/source/_static/js/custom.js" <del>DEPLOY_SH_FILE = ".circleci/deploy.sh" <ide> <ide> <ide> def update_version_in_file(fname, version, pattern): <ide> def post_release_work(): <ide> current_version = get_version() <ide> dev_version = f"{current_version.major}.{current_version.minor + 1}.0.dev0" <ide> current_version = current_version.base_version <del> # Get the current commit hash <del> repo = git.Repo(".", search_parent_directories=True) <del> version_commit = repo.head.object.hexsha[:7] <ide> <ide> # Check with the user we got that right. <ide> version = input(f"Which version are we developing now? [{dev_version}]") <del> commit = input(f"Commit hash to associate to v{current_version}? [{version_commit}]") <ide> if len(version) == 0: <ide> version = dev_version <del> if len(commit) == 0: <del> commit = version_commit <ide> <ide> print(f"Updating version to {version}.") <ide> global_version_update(version) <ide> <ide> <del>def post_patch_work(): <del> """Do all the necesarry post-patch steps.""" <del> # Try to guess the right info: last patch in the minor release before current version and its commit hash. <del> current_version = get_version() <del> repo = git.Repo(".", search_parent_directories=True) <del> repo_tags = repo.tags <del> default_version = None <del> version_commit = None <del> for tag in repo_tags: <del> if str(tag).startswith(f"v{current_version.major}.{current_version.minor - 1}"): <del> if default_version is None: <del> default_version = packaging.version.parse(str(tag)[1:]) <del> version_commit = str(tag.commit)[:7] <del> elif packaging.version.parse(str(tag)[1:]) > default_version: <del> default_version = packaging.version.parse(str(tag)[1:]) <del> version_commit = str(tag.commit)[:7] <del> <del> # Confirm with the user or ask for the info if not found. <del> if default_version is None: <del> version = input("Which patch version was just released?") <del> commit = input("Commit hash to associated to it?") <del> else: <del> version = input(f"Which patch version was just released? [{default_version}]") <del> commit = input(f"Commit hash to associated to it? [{version_commit}]") <del> if len(version) == 0: <del> version = default_version <del> if len(commit) == 0: <del> commit = version_commit <del> <del> <ide> if __name__ == "__main__": <ide> parser = argparse.ArgumentParser() <ide> parser.add_argument("--post_release", action="store_true", help="Whether this is pre or post release.") <ide> def post_patch_work(): <ide> if not args.post_release: <ide> pre_release_work(patch=args.patch) <ide> elif args.patch: <del> post_patch_work() <add> print("Nothing to do after a patch :-)") <ide> else: <ide> post_release_work()
1
PHP
PHP
fix cs error
0df3fe242bd5d3743a94e070d335f99869467097
<ide><path>src/Core/functions.php <ide> function h($text, $double = true, $charset = null) <ide> } <ide> <ide> return htmlspecialchars($text, ENT_QUOTES | ENT_SUBSTITUTE, $charset ?: $defaultCharset, $double); <del> <ide> } <ide> <ide> }
1
PHP
PHP
add space to css
ad386c8468fe93714a1ba676a1c67ed52876060a
<ide><path>application/views/error/500.php <ide> font: normal normal normal 14px/1.253 Ubuntu, sans-serif; <ide> margin: 0 0 25px 0; <ide> min-width: 800px; <del> padding:0; <add> padding: 0; <ide> } <ide> <ide> #main {
1
PHP
PHP
avoid unneeded query in delete()
cf18e8d38b4cb0f7646d3cacc721132e81e20826
<ide><path>lib/Cake/Model/Model.php <ide> public function delete($id = null, $cascade = true) { <ide> break; <ide> } <ide> } <del> <del> $keys = $this->find('first', array( <del> 'fields' => $this->_collectForeignKeys(), <del> 'conditions' => array($this->alias . '.' . $this->primaryKey => $id), <del> 'recursive' => -1, <del> 'callbacks' => false <del> )); <add> if ($updateCounterCache) { <add> $keys = $this->find('first', array( <add> 'fields' => $this->_collectForeignKeys(), <add> 'conditions' => array($this->alias . '.' . $this->primaryKey => $id), <add> 'recursive' => -1, <add> 'callbacks' => false <add> )); <add> } <ide> } <ide> <ide> if ($db->delete($this, array($this->alias . '.' . $this->primaryKey => $id))) {
1
Python
Python
address typos in dispatch docs
ad91f48f729c6bc67a7dc31428ce725d6fe789e6
<ide><path>numpy/doc/dispatch.py <ide> class to indicate that it would like to handle computations in a custom-defined <ide> - ``inputs``, which could be a mixture of different types <ide> - ``kwargs``, keyword arguments passed to the function <ide> <del>For this example we will only handle the method ``'__call__``. <add>For this example we will only handle the method ``__call__``. <ide> <ide> >>> from numbers import Number <ide> >>> class DiagonalArray: <ide> class to indicate that it would like to handle computations in a custom-defined <ide> calls ``numpy.sum(self)``, and the same for ``mean``. <ide> <ide> >>> @implements(np.sum) <del>... def sum(a): <add>... def sum(arr): <ide> ... "Implementation of np.sum for DiagonalArray objects" <ide> ... return arr._i * arr._N <ide> ... <ide> >>> @implements(np.mean) <del>... def sum(a): <add>... def sum(arr): <ide> ... "Implementation of np.mean for DiagonalArray objects" <ide> ... return arr._i / arr._N <ide> ...
1
Ruby
Ruby
modularize postgresql adapter
232d2223ebcfe5c9e0425c821f5d30a7d5968512
<ide><path>activerecord/lib/active_record/connection_adapters/postgresql/cast.rb <add>module ActiveRecord <add> module ConnectionAdapters <add> class PostgreSQLColumn < Column <add> module Cast <add> def string_to_time(string) <add> return string unless String === string <add> <add> case string <add> when 'infinity'; 1.0 / 0.0 <add> when '-infinity'; -1.0 / 0.0 <add> else <add> super <add> end <add> end <add> <add> def hstore_to_string(object) <add> if Hash === object <add> object.map { |k,v| <add> "#{escape_hstore(k)}=>#{escape_hstore(v)}" <add> }.join ',' <add> else <add> object <add> end <add> end <add> <add> def string_to_hstore(string) <add> if string.nil? <add> nil <add> elsif String === string <add> Hash[string.scan(HstorePair).map { |k,v| <add> v = v.upcase == 'NULL' ? nil : v.gsub(/^"(.*)"$/,'\1').gsub(/\\(.)/, '\1') <add> k = k.gsub(/^"(.*)"$/,'\1').gsub(/\\(.)/, '\1') <add> [k,v] <add> }] <add> else <add> string <add> end <add> end <add> <add> def string_to_cidr(string) <add> if string.nil? <add> nil <add> elsif String === string <add> IPAddr.new(string) <add> else <add> string <add> end <add> end <add> <add> def cidr_to_string(object) <add> if IPAddr === object <add> "#{object.to_s}/#{object.instance_variable_get(:@mask_addr).to_s(2).count('1')}" <add> else <add> object <add> end <add> end <add> <add> private <add> <add> HstorePair = begin <add> quoted_string = /"[^"\\]*(?:\\.[^"\\]*)*"/ <add> unquoted_string = /(?:\\.|[^\s,])[^\s=,\\]*(?:\\.[^\s=,\\]*|=[^,>])*/ <add> /(#{quoted_string}|#{unquoted_string})\s*=>\s*(#{quoted_string}|#{unquoted_string})/ <add> end <add> <add> def escape_hstore(value) <add> if value.nil? <add> 'NULL' <add> else <add> if value == "" <add> '""' <add> else <add> '"%s"' % value.to_s.gsub(/(["\\])/, '\\\\\1') <add> end <add> end <add> end <add> end <add> end <add> end <add>end <ide><path>activerecord/lib/active_record/connection_adapters/postgresql/database_statements.rb <add>module ActiveRecord <add> module ConnectionAdapters <add> class PostgreSQLAdapter < AbstractAdapter <add> module DatabaseStatements <add> def explain(arel, binds = []) <add> sql = "EXPLAIN #{to_sql(arel, binds)}" <add> ExplainPrettyPrinter.new.pp(exec_query(sql, 'EXPLAIN', binds)) <add> end <add> <add> class ExplainPrettyPrinter # :nodoc: <add> # Pretty prints the result of a EXPLAIN in a way that resembles the output of the <add> # PostgreSQL shell: <add> # <add> # QUERY PLAN <add> # ------------------------------------------------------------------------------ <add> # Nested Loop Left Join (cost=0.00..37.24 rows=8 width=0) <add> # Join Filter: (posts.user_id = users.id) <add> # -> Index Scan using users_pkey on users (cost=0.00..8.27 rows=1 width=4) <add> # Index Cond: (id = 1) <add> # -> Seq Scan on posts (cost=0.00..28.88 rows=8 width=4) <add> # Filter: (posts.user_id = 1) <add> # (6 rows) <add> # <add> def pp(result) <add> header = result.columns.first <add> lines = result.rows.map(&:first) <add> <add> # We add 2 because there's one char of padding at both sides, note <add> # the extra hyphens in the example above. <add> width = [header, *lines].map(&:length).max + 2 <add> <add> pp = [] <add> <add> pp << header.center(width).rstrip <add> pp << '-' * width <add> <add> pp += lines.map {|line| " #{line}"} <add> <add> nrows = result.rows.length <add> rows_label = nrows == 1 ? 'row' : 'rows' <add> pp << "(#{nrows} #{rows_label})" <add> <add> pp.join("\n") + "\n" <add> end <add> end <add> <add> # Executes a SELECT query and returns an array of rows. Each row is an <add> # array of field values. <add> def select_rows(sql, name = nil) <add> select_raw(sql, name).last <add> end <add> <add> # Executes an INSERT query and returns the new record's ID <add> def insert_sql(sql, name = nil, pk = nil, id_value = nil, sequence_name = nil) <add> unless pk <add> # Extract the table from the insert sql. Yuck. <add> table_ref = extract_table_ref_from_insert_sql(sql) <add> pk = primary_key(table_ref) if table_ref <add> end <add> <add> if pk && use_insert_returning? <add> select_value("#{sql} RETURNING #{quote_column_name(pk)}") <add> elsif pk <add> super <add> last_insert_id_value(sequence_name || default_sequence_name(table_ref, pk)) <add> else <add> super <add> end <add> end <add> <add> def create <add> super.insert <add> end <add> <add> # create a 2D array representing the result set <add> def result_as_array(res) #:nodoc: <add> # check if we have any binary column and if they need escaping <add> ftypes = Array.new(res.nfields) do |i| <add> [i, res.ftype(i)] <add> end <add> <add> rows = res.values <add> return rows unless ftypes.any? { |_, x| <add> x == BYTEA_COLUMN_TYPE_OID || x == MONEY_COLUMN_TYPE_OID <add> } <add> <add> typehash = ftypes.group_by { |_, type| type } <add> binaries = typehash[BYTEA_COLUMN_TYPE_OID] || [] <add> monies = typehash[MONEY_COLUMN_TYPE_OID] || [] <add> <add> rows.each do |row| <add> # unescape string passed BYTEA field (OID == 17) <add> binaries.each do |index, _| <add> row[index] = unescape_bytea(row[index]) <add> end <add> <add> # If this is a money type column and there are any currency symbols, <add> # then strip them off. Indeed it would be prettier to do this in <add> # PostgreSQLColumn.string_to_decimal but would break form input <add> # fields that call value_before_type_cast. <add> monies.each do |index, _| <add> data = row[index] <add> # Because money output is formatted according to the locale, there are two <add> # cases to consider (note the decimal separators): <add> # (1) $12,345,678.12 <add> # (2) $12.345.678,12 <add> case data <add> when /^-?\D+[\d,]+\.\d{2}$/ # (1) <add> data.gsub!(/[^-\d.]/, '') <add> when /^-?\D+[\d.]+,\d{2}$/ # (2) <add> data.gsub!(/[^-\d,]/, '').sub!(/,/, '.') <add> end <add> end <add> end <add> end <add> <add> # Queries the database and returns the results in an Array-like object <add> def query(sql, name = nil) #:nodoc: <add> log(sql, name) do <add> result_as_array @connection.async_exec(sql) <add> end <add> end <add> <add> # Executes an SQL statement, returning a PGresult object on success <add> # or raising a PGError exception otherwise. <add> def execute(sql, name = nil) <add> log(sql, name) do <add> @connection.async_exec(sql) <add> end <add> end <add> <add> def substitute_at(column, index) <add> Arel::Nodes::BindParam.new "$#{index + 1}" <add> end <add> <add> def exec_query(sql, name = 'SQL', binds = []) <add> log(sql, name, binds) do <add> result = binds.empty? ? exec_no_cache(sql, binds) : <add> exec_cache(sql, binds) <add> <add> types = {} <add> result.fields.each_with_index do |fname, i| <add> ftype = result.ftype i <add> fmod = result.fmod i <add> types[fname] = OID::TYPE_MAP.fetch(ftype, fmod) { |oid, mod| <add> warn "unknown OID: #{fname}(#{oid}) (#{sql})" <add> OID::Identity.new <add> } <add> end <add> <add> ret = ActiveRecord::Result.new(result.fields, result.values, types) <add> result.clear <add> return ret <add> end <add> end <add> <add> def exec_delete(sql, name = 'SQL', binds = []) <add> log(sql, name, binds) do <add> result = binds.empty? ? exec_no_cache(sql, binds) : <add> exec_cache(sql, binds) <add> affected = result.cmd_tuples <add> result.clear <add> affected <add> end <add> end <add> alias :exec_update :exec_delete <add> <add> def sql_for_insert(sql, pk, id_value, sequence_name, binds) <add> unless pk <add> # Extract the table from the insert sql. Yuck. <add> table_ref = extract_table_ref_from_insert_sql(sql) <add> pk = primary_key(table_ref) if table_ref <add> end <add> <add> if pk && use_insert_returning? <add> sql = "#{sql} RETURNING #{quote_column_name(pk)}" <add> end <add> <add> [sql, binds] <add> end <add> <add> def exec_insert(sql, name, binds, pk = nil, sequence_name = nil) <add> val = exec_query(sql, name, binds) <add> if !use_insert_returning? && pk <add> unless sequence_name <add> table_ref = extract_table_ref_from_insert_sql(sql) <add> sequence_name = default_sequence_name(table_ref, pk) <add> return val unless sequence_name <add> end <add> last_insert_id_result(sequence_name) <add> else <add> val <add> end <add> end <add> <add> # Executes an UPDATE query and returns the number of affected tuples. <add> def update_sql(sql, name = nil) <add> super.cmd_tuples <add> end <add> <add> # Begins a transaction. <add> def begin_db_transaction <add> execute "BEGIN" <add> end <add> <add> # Commits a transaction. <add> def commit_db_transaction <add> execute "COMMIT" <add> end <add> <add> # Aborts a transaction. <add> def rollback_db_transaction <add> execute "ROLLBACK" <add> end <add> <add> def outside_transaction? <add> @connection.transaction_status == PGconn::PQTRANS_IDLE <add> end <add> <add> def create_savepoint <add> execute("SAVEPOINT #{current_savepoint_name}") <add> end <add> <add> def rollback_to_savepoint <add> execute("ROLLBACK TO SAVEPOINT #{current_savepoint_name}") <add> end <add> <add> def release_savepoint <add> execute("RELEASE SAVEPOINT #{current_savepoint_name}") <add> end <add> end <add> end <add> end <add>end <ide><path>activerecord/lib/active_record/connection_adapters/postgresql/quoting.rb <add>module ActiveRecord <add> module ConnectionAdapters <add> class PostgreSQLAdapter < AbstractAdapter <add> module Quoting <add> # Escapes binary strings for bytea input to the database. <add> def escape_bytea(value) <add> PGconn.escape_bytea(value) if value <add> end <add> <add> # Unescapes bytea output from a database to the binary string it represents. <add> # NOTE: This is NOT an inverse of escape_bytea! This is only to be used <add> # on escaped binary output from database drive. <add> def unescape_bytea(value) <add> PGconn.unescape_bytea(value) if value <add> end <add> <add> # Quotes PostgreSQL-specific data types for SQL input. <add> def quote(value, column = nil) #:nodoc: <add> return super unless column <add> <add> case value <add> when Hash <add> case column.sql_type <add> when 'hstore' then super(PostgreSQLColumn.hstore_to_string(value), column) <add> else super <add> end <add> when IPAddr <add> case column.sql_type <add> when 'inet', 'cidr' then super(PostgreSQLColumn.cidr_to_string(value), column) <add> else super <add> end <add> when Float <add> if value.infinite? && column.type == :datetime <add> "'#{value.to_s.downcase}'" <add> elsif value.infinite? || value.nan? <add> "'#{value.to_s}'" <add> else <add> super <add> end <add> when Numeric <add> return super unless column.sql_type == 'money' <add> # Not truly string input, so doesn't require (or allow) escape string syntax. <add> "'#{value}'" <add> when String <add> case column.sql_type <add> when 'bytea' then "'#{escape_bytea(value)}'" <add> when 'xml' then "xml '#{quote_string(value)}'" <add> when /^bit/ <add> case value <add> when /^[01]*$/ then "B'#{value}'" # Bit-string notation <add> when /^[0-9A-F]*$/i then "X'#{value}'" # Hexadecimal notation <add> end <add> else <add> super <add> end <add> else <add> super <add> end <add> end <add> <add> def type_cast(value, column) <add> return super unless column <add> <add> case value <add> when String <add> return super unless 'bytea' == column.sql_type <add> { :value => value, :format => 1 } <add> when Hash <add> return super unless 'hstore' == column.sql_type <add> PostgreSQLColumn.hstore_to_string(value) <add> when IPAddr <add> return super unless ['inet','cidr'].includes? column.sql_type <add> PostgreSQLColumn.cidr_to_string(value) <add> else <add> super <add> end <add> end <add> <add> # Quotes strings for use in SQL input. <add> def quote_string(s) #:nodoc: <add> @connection.escape(s) <add> end <add> <add> # Checks the following cases: <add> # <add> # - table_name <add> # - "table.name" <add> # - schema_name.table_name <add> # - schema_name."table.name" <add> # - "schema.name".table_name <add> # - "schema.name"."table.name" <add> def quote_table_name(name) <add> schema, name_part = extract_pg_identifier_from_name(name.to_s) <add> <add> unless name_part <add> quote_column_name(schema) <add> else <add> table_name, name_part = extract_pg_identifier_from_name(name_part) <add> "#{quote_column_name(schema)}.#{quote_column_name(table_name)}" <add> end <add> end <add> <add> # Quotes column names for use in SQL queries. <add> def quote_column_name(name) #:nodoc: <add> PGconn.quote_ident(name.to_s) <add> end <add> <add> # Quote date/time values for use in SQL input. Includes microseconds <add> # if the value is a Time responding to usec. <add> def quoted_date(value) #:nodoc: <add> if value.acts_like?(:time) && value.respond_to?(:usec) <add> "#{super}.#{sprintf("%06d", value.usec)}" <add> else <add> super <add> end <add> end <add> end <add> end <add> end <add>end <ide><path>activerecord/lib/active_record/connection_adapters/postgresql/referential_integrity.rb <add>module ActiveRecord <add> module ConnectionAdapters <add> class PostgreSQLAdapter < AbstractAdapter <add> module ReferentialIntegrity <add> def supports_disable_referential_integrity? #:nodoc: <add> true <add> end <add> <add> def disable_referential_integrity #:nodoc: <add> if supports_disable_referential_integrity? then <add> execute(tables.collect { |name| "ALTER TABLE #{quote_table_name(name)} DISABLE TRIGGER ALL" }.join(";")) <add> end <add> yield <add> ensure <add> if supports_disable_referential_integrity? then <add> execute(tables.collect { |name| "ALTER TABLE #{quote_table_name(name)} ENABLE TRIGGER ALL" }.join(";")) <add> end <add> end <add> end <add> end <add> end <add>end <ide><path>activerecord/lib/active_record/connection_adapters/postgresql/schema_statements.rb <add>module ActiveRecord <add> module ConnectionAdapters <add> class PostgreSQLAdapter < AbstractAdapter <add> module SchemaStatements <add> # Drops the database specified on the +name+ attribute <add> # and creates it again using the provided +options+. <add> def recreate_database(name, options = {}) #:nodoc: <add> drop_database(name) <add> create_database(name, options) <add> end <add> <add> # Create a new PostgreSQL database. Options include <tt>:owner</tt>, <tt>:template</tt>, <add> # <tt>:encoding</tt>, <tt>:collation</tt>, <tt>:ctype</tt>, <add> # <tt>:tablespace</tt>, and <tt>:connection_limit</tt> (note that MySQL uses <add> # <tt>:charset</tt> while PostgreSQL uses <tt>:encoding</tt>). <add> # <add> # Example: <add> # create_database config[:database], config <add> # create_database 'foo_development', :encoding => 'unicode' <add> def create_database(name, options = {}) <add> options = options.reverse_merge(:encoding => "utf8") <add> <add> option_string = options.symbolize_keys.sum do |key, value| <add> case key <add> when :owner <add> " OWNER = \"#{value}\"" <add> when :template <add> " TEMPLATE = \"#{value}\"" <add> when :encoding <add> " ENCODING = '#{value}'" <add> when :collation <add> " LC_COLLATE = '#{value}'" <add> when :ctype <add> " LC_CTYPE = '#{value}'" <add> when :tablespace <add> " TABLESPACE = \"#{value}\"" <add> when :connection_limit <add> " CONNECTION LIMIT = #{value}" <add> else <add> "" <add> end <add> end <add> <add> execute "CREATE DATABASE #{quote_table_name(name)}#{option_string}" <add> end <add> <add> # Drops a PostgreSQL database. <add> # <add> # Example: <add> # drop_database 'matt_development' <add> def drop_database(name) #:nodoc: <add> execute "DROP DATABASE IF EXISTS #{quote_table_name(name)}" <add> end <add> <add> # Returns the list of all tables in the schema search path or a specified schema. <add> def tables(name = nil) <add> query(<<-SQL, 'SCHEMA').map { |row| row[0] } <add> SELECT tablename <add> FROM pg_tables <add> WHERE schemaname = ANY (current_schemas(false)) <add> SQL <add> end <add> <add> # Returns true if table exists. <add> # If the schema is not specified as part of +name+ then it will only find tables within <add> # the current schema search path (regardless of permissions to access tables in other schemas) <add> def table_exists?(name) <add> schema, table = Utils.extract_schema_and_table(name.to_s) <add> return false unless table <add> <add> binds = [[nil, table]] <add> binds << [nil, schema] if schema <add> <add> exec_query(<<-SQL, 'SCHEMA').rows.first[0].to_i > 0 <add> SELECT COUNT(*) <add> FROM pg_class c <add> LEFT JOIN pg_namespace n ON n.oid = c.relnamespace <add> WHERE c.relkind in ('v','r') <add> AND c.relname = '#{table.gsub(/(^"|"$)/,'')}' <add> AND n.nspname = #{schema ? "'#{schema}'" : 'ANY (current_schemas(false))'} <add> SQL <add> end <add> <add> # Returns true if schema exists. <add> def schema_exists?(name) <add> exec_query(<<-SQL, 'SCHEMA').rows.first[0].to_i > 0 <add> SELECT COUNT(*) <add> FROM pg_namespace <add> WHERE nspname = '#{name}' <add> SQL <add> end <add> <add> # Returns an array of indexes for the given table. <add> def indexes(table_name, name = nil) <add> result = query(<<-SQL, 'SCHEMA') <add> SELECT distinct i.relname, d.indisunique, d.indkey, pg_get_indexdef(d.indexrelid), t.oid <add> FROM pg_class t <add> INNER JOIN pg_index d ON t.oid = d.indrelid <add> INNER JOIN pg_class i ON d.indexrelid = i.oid <add> WHERE i.relkind = 'i' <add> AND d.indisprimary = 'f' <add> AND t.relname = '#{table_name}' <add> AND i.relnamespace IN (SELECT oid FROM pg_namespace WHERE nspname = ANY (current_schemas(false)) ) <add> ORDER BY i.relname <add> SQL <add> <add> result.map do |row| <add> index_name = row[0] <add> unique = row[1] == 't' <add> indkey = row[2].split(" ") <add> inddef = row[3] <add> oid = row[4] <add> <add> columns = Hash[query(<<-SQL, "Columns for index #{row[0]} on #{table_name}")] <add> SELECT a.attnum, a.attname <add> FROM pg_attribute a <add> WHERE a.attrelid = #{oid} <add> AND a.attnum IN (#{indkey.join(",")}) <add> SQL <add> <add> column_names = columns.values_at(*indkey).compact <add> <add> # add info on sort order for columns (only desc order is explicitly specified, asc is the default) <add> desc_order_columns = inddef.scan(/(\w+) DESC/).flatten <add> orders = desc_order_columns.any? ? Hash[desc_order_columns.map {|order_column| [order_column, :desc]}] : {} <add> where = inddef.scan(/WHERE (.+)$/).flatten[0] <add> <add> column_names.empty? ? nil : IndexDefinition.new(table_name, index_name, unique, column_names, [], orders, where) <add> end.compact <add> end <add> <add> # Returns the list of all column definitions for a table. <add> def columns(table_name) <add> # Limit, precision, and scale are all handled by the superclass. <add> column_definitions(table_name).map do |column_name, type, default, notnull, oid, fmod| <add> oid = OID::TYPE_MAP.fetch(oid.to_i, fmod.to_i) { <add> OID::Identity.new <add> } <add> PostgreSQLColumn.new(column_name, default, oid, type, notnull == 'f') <add> end <add> end <add> <add> # Returns the current database name. <add> def current_database <add> query('select current_database()', 'SCHEMA')[0][0] <add> end <add> <add> # Returns the current schema name. <add> def current_schema <add> query('SELECT current_schema', 'SCHEMA')[0][0] <add> end <add> <add> # Returns the current database encoding format. <add> def encoding <add> query(<<-end_sql, 'SCHEMA')[0][0] <add> SELECT pg_encoding_to_char(pg_database.encoding) FROM pg_database <add> WHERE pg_database.datname LIKE '#{current_database}' <add> end_sql <add> end <add> <add> # Returns the current database collation. <add> def collation <add> query(<<-end_sql, 'SCHEMA')[0][0] <add> SELECT pg_database.datcollate FROM pg_database WHERE pg_database.datname LIKE '#{current_database}' <add> end_sql <add> end <add> <add> # Returns the current database ctype. <add> def ctype <add> query(<<-end_sql, 'SCHEMA')[0][0] <add> SELECT pg_database.datctype FROM pg_database WHERE pg_database.datname LIKE '#{current_database}' <add> end_sql <add> end <add> <add> # Returns an array of schema names. <add> def schema_names <add> query(<<-SQL, 'SCHEMA').flatten <add> SELECT nspname <add> FROM pg_namespace <add> WHERE nspname !~ '^pg_.*' <add> AND nspname NOT IN ('information_schema') <add> ORDER by nspname; <add> SQL <add> end <add> <add> # Creates a schema for the given schema name. <add> def create_schema schema_name <add> execute "CREATE SCHEMA #{schema_name}" <add> end <add> <add> # Drops the schema for the given schema name. <add> def drop_schema schema_name <add> execute "DROP SCHEMA #{schema_name} CASCADE" <add> end <add> <add> # Sets the schema search path to a string of comma-separated schema names. <add> # Names beginning with $ have to be quoted (e.g. $user => '$user'). <add> # See: http://www.postgresql.org/docs/current/static/ddl-schemas.html <add> # <add> # This should be not be called manually but set in database.yml. <add> def schema_search_path=(schema_csv) <add> if schema_csv <add> execute("SET search_path TO #{schema_csv}", 'SCHEMA') <add> @schema_search_path = schema_csv <add> end <add> end <add> <add> # Returns the active schema search path. <add> def schema_search_path <add> @schema_search_path ||= query('SHOW search_path', 'SCHEMA')[0][0] <add> end <add> <add> # Returns the current client message level. <add> def client_min_messages <add> query('SHOW client_min_messages', 'SCHEMA')[0][0] <add> end <add> <add> # Set the client message level. <add> def client_min_messages=(level) <add> execute("SET client_min_messages TO '#{level}'", 'SCHEMA') <add> end <add> <add> # Returns the sequence name for a table's primary key or some other specified key. <add> def default_sequence_name(table_name, pk = nil) #:nodoc: <add> result = serial_sequence(table_name, pk || 'id') <add> return nil unless result <add> result.split('.').last <add> rescue ActiveRecord::StatementInvalid <add> "#{table_name}_#{pk || 'id'}_seq" <add> end <add> <add> def serial_sequence(table, column) <add> result = exec_query(<<-eosql, 'SCHEMA') <add> SELECT pg_get_serial_sequence('#{table}', '#{column}') <add> eosql <add> result.rows.first.first <add> end <add> <add> # Resets the sequence of a table's primary key to the maximum value. <add> def reset_pk_sequence!(table, pk = nil, sequence = nil) #:nodoc: <add> unless pk and sequence <add> default_pk, default_sequence = pk_and_sequence_for(table) <add> <add> pk ||= default_pk <add> sequence ||= default_sequence <add> end <add> <add> if @logger && pk && !sequence <add> @logger.warn "#{table} has primary key #{pk} with no default sequence" <add> end <add> <add> if pk && sequence <add> quoted_sequence = quote_table_name(sequence) <add> <add> select_value <<-end_sql, 'Reset sequence' <add> SELECT setval('#{quoted_sequence}', (SELECT COALESCE(MAX(#{quote_column_name pk})+(SELECT increment_by FROM #{quoted_sequence}), (SELECT min_value FROM #{quoted_sequence})) FROM #{quote_table_name(table)}), false) <add> end_sql <add> end <add> end <add> <add> # Returns a table's primary key and belonging sequence. <add> def pk_and_sequence_for(table) #:nodoc: <add> # First try looking for a sequence with a dependency on the <add> # given table's primary key. <add> result = query(<<-end_sql, 'PK and serial sequence')[0] <add> SELECT attr.attname, seq.relname <add> FROM pg_class seq, <add> pg_attribute attr, <add> pg_depend dep, <add> pg_namespace name, <add> pg_constraint cons <add> WHERE seq.oid = dep.objid <add> AND seq.relkind = 'S' <add> AND attr.attrelid = dep.refobjid <add> AND attr.attnum = dep.refobjsubid <add> AND attr.attrelid = cons.conrelid <add> AND attr.attnum = cons.conkey[1] <add> AND cons.contype = 'p' <add> AND dep.refobjid = '#{quote_table_name(table)}'::regclass <add> end_sql <add> <add> if result.nil? or result.empty? <add> # If that fails, try parsing the primary key's default value. <add> # Support the 7.x and 8.0 nextval('foo'::text) as well as <add> # the 8.1+ nextval('foo'::regclass). <add> result = query(<<-end_sql, 'PK and custom sequence')[0] <add> SELECT attr.attname, <add> CASE <add> WHEN split_part(def.adsrc, '''', 2) ~ '.' THEN <add> substr(split_part(def.adsrc, '''', 2), <add> strpos(split_part(def.adsrc, '''', 2), '.')+1) <add> ELSE split_part(def.adsrc, '''', 2) <add> END <add> FROM pg_class t <add> JOIN pg_attribute attr ON (t.oid = attrelid) <add> JOIN pg_attrdef def ON (adrelid = attrelid AND adnum = attnum) <add> JOIN pg_constraint cons ON (conrelid = adrelid AND adnum = conkey[1]) <add> WHERE t.oid = '#{quote_table_name(table)}'::regclass <add> AND cons.contype = 'p' <add> AND def.adsrc ~* 'nextval' <add> end_sql <add> end <add> <add> [result.first, result.last] <add> rescue <add> nil <add> end <add> <add> # Returns just a table's primary key <add> def primary_key(table) <add> row = exec_query(<<-end_sql, 'SCHEMA').rows.first <add> SELECT DISTINCT(attr.attname) <add> FROM pg_attribute attr <add> INNER JOIN pg_depend dep ON attr.attrelid = dep.refobjid AND attr.attnum = dep.refobjsubid <add> INNER JOIN pg_constraint cons ON attr.attrelid = cons.conrelid AND attr.attnum = cons.conkey[1] <add> WHERE cons.contype = 'p' <add> AND dep.refobjid = '#{table}'::regclass <add> end_sql <add> <add> row && row.first <add> end <add> <add> # Renames a table. <add> # Also renames a table's primary key sequence if the sequence name matches the <add> # Active Record default. <add> # <add> # Example: <add> # rename_table('octopuses', 'octopi') <add> def rename_table(name, new_name) <add> clear_cache! <add> execute "ALTER TABLE #{quote_table_name(name)} RENAME TO #{quote_table_name(new_name)}" <add> pk, seq = pk_and_sequence_for(new_name) <add> if seq == "#{name}_#{pk}_seq" <add> new_seq = "#{new_name}_#{pk}_seq" <add> execute "ALTER TABLE #{quote_table_name(seq)} RENAME TO #{quote_table_name(new_seq)}" <add> end <add> end <add> <add> # Adds a new column to the named table. <add> # See TableDefinition#column for details of the options you can use. <add> def add_column(table_name, column_name, type, options = {}) <add> clear_cache! <add> add_column_sql = "ALTER TABLE #{quote_table_name(table_name)} ADD COLUMN #{quote_column_name(column_name)} #{type_to_sql(type, options[:limit], options[:precision], options[:scale])}" <add> add_column_options!(add_column_sql, options) <add> <add> execute add_column_sql <add> end <add> <add> # Changes the column of a table. <add> def change_column(table_name, column_name, type, options = {}) <add> clear_cache! <add> quoted_table_name = quote_table_name(table_name) <add> <add> execute "ALTER TABLE #{quoted_table_name} ALTER COLUMN #{quote_column_name(column_name)} TYPE #{type_to_sql(type, options[:limit], options[:precision], options[:scale])}" <add> <add> change_column_default(table_name, column_name, options[:default]) if options_include_default?(options) <add> change_column_null(table_name, column_name, options[:null], options[:default]) if options.key?(:null) <add> end <add> <add> # Changes the default value of a table column. <add> def change_column_default(table_name, column_name, default) <add> clear_cache! <add> execute "ALTER TABLE #{quote_table_name(table_name)} ALTER COLUMN #{quote_column_name(column_name)} SET DEFAULT #{quote(default)}" <add> end <add> <add> def change_column_null(table_name, column_name, null, default = nil) <add> clear_cache! <add> unless null || default.nil? <add> execute("UPDATE #{quote_table_name(table_name)} SET #{quote_column_name(column_name)}=#{quote(default)} WHERE #{quote_column_name(column_name)} IS NULL") <add> end <add> execute("ALTER TABLE #{quote_table_name(table_name)} ALTER #{quote_column_name(column_name)} #{null ? 'DROP' : 'SET'} NOT NULL") <add> end <add> <add> # Renames a column in a table. <add> def rename_column(table_name, column_name, new_column_name) <add> clear_cache! <add> execute "ALTER TABLE #{quote_table_name(table_name)} RENAME COLUMN #{quote_column_name(column_name)} TO #{quote_column_name(new_column_name)}" <add> end <add> <add> def remove_index!(table_name, index_name) #:nodoc: <add> execute "DROP INDEX #{quote_table_name(index_name)}" <add> end <add> <add> def rename_index(table_name, old_name, new_name) <add> execute "ALTER INDEX #{quote_column_name(old_name)} RENAME TO #{quote_table_name(new_name)}" <add> end <add> <add> def index_name_length <add> 63 <add> end <add> <add> # Maps logical Rails types to PostgreSQL-specific data types. <add> def type_to_sql(type, limit = nil, precision = nil, scale = nil) <add> case type.to_s <add> when 'binary' <add> # PostgreSQL doesn't support limits on binary (bytea) columns. <add> # The hard limit is 1Gb, because of a 32-bit size field, and TOAST. <add> case limit <add> when nil, 0..0x3fffffff; super(type) <add> else raise(ActiveRecordError, "No binary type has byte size #{limit}.") <add> end <add> when 'integer' <add> return 'integer' unless limit <add> <add> case limit <add> when 1, 2; 'smallint' <add> when 3, 4; 'integer' <add> when 5..8; 'bigint' <add> else raise(ActiveRecordError, "No integer type has byte size #{limit}. Use a numeric with precision 0 instead.") <add> end <add> when 'datetime' <add> return super unless precision <add> <add> case precision <add> when 0..6; "timestamp(#{precision})" <add> else raise(ActiveRecordError, "No timestamp type has precision of #{precision}. The allowed range of precision is from 0 to 6") <add> end <add> else <add> super <add> end <add> end <add> <add> # Returns a SELECT DISTINCT clause for a given set of columns and a given ORDER BY clause. <add> # <add> # PostgreSQL requires the ORDER BY columns in the select list for distinct queries, and <add> # requires that the ORDER BY include the distinct column. <add> # <add> # distinct("posts.id", "posts.created_at desc") <add> def distinct(columns, orders) #:nodoc: <add> return "DISTINCT #{columns}" if orders.empty? <add> <add> # Construct a clean list of column names from the ORDER BY clause, removing <add> # any ASC/DESC modifiers <add> order_columns = orders.collect do |s| <add> s = s.to_sql unless s.is_a?(String) <add> s.gsub(/\s+(ASC|DESC)\s*(NULLS\s+(FIRST|LAST)\s*)?/i, '') <add> end <add> order_columns.delete_if { |c| c.blank? } <add> order_columns = order_columns.zip((0...order_columns.size).to_a).map { |s,i| "#{s} AS alias_#{i}" } <add> <add> "DISTINCT #{columns}, #{order_columns * ', '}" <add> end <add> end <add> end <add> end <add>end <ide><path>activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb <ide> require 'active_record/connection_adapters/abstract_adapter' <ide> require 'active_record/connection_adapters/statement_pool' <ide> require 'active_record/connection_adapters/postgresql/oid' <add>require 'active_record/connection_adapters/postgresql/cast' <add>require 'active_record/connection_adapters/postgresql/quoting' <add>require 'active_record/connection_adapters/postgresql/schema_statements' <add>require 'active_record/connection_adapters/postgresql/database_statements' <add>require 'active_record/connection_adapters/postgresql/referential_integrity' <ide> require 'arel/visitors/bind_visitor' <ide> <ide> # Make sure we're using pg high enough for PGResult#values <ide> def initialize(name, default, oid_type, sql_type = nil, null = true) <ide> <ide> # :stopdoc: <ide> class << self <del> attr_accessor :money_precision <del> def string_to_time(string) <del> return string unless String === string <del> <del> case string <del> when 'infinity' then 1.0 / 0.0 <del> when '-infinity' then -1.0 / 0.0 <del> else <del> super <del> end <del> end <del> <del> def hstore_to_string(object) <del> if Hash === object <del> object.map { |k,v| <del> "#{escape_hstore(k)}=>#{escape_hstore(v)}" <del> }.join ',' <del> else <del> object <del> end <del> end <del> <del> def string_to_hstore(string) <del> if string.nil? <del> nil <del> elsif String === string <del> Hash[string.scan(HstorePair).map { |k,v| <del> v = v.upcase == 'NULL' ? nil : v.gsub(/^"(.*)"$/,'\1').gsub(/\\(.)/, '\1') <del> k = k.gsub(/^"(.*)"$/,'\1').gsub(/\\(.)/, '\1') <del> [k,v] <del> }] <del> else <del> string <del> end <del> end <del> <del> def string_to_cidr(string) <del> if string.nil? <del> nil <del> elsif String === string <del> IPAddr.new(string) <del> else <del> string <del> end <del> end <add> include ConnectionAdapters::PostgreSQLColumn::Cast <ide> <del> def cidr_to_string(object) <del> if IPAddr === object <del> "#{object.to_s}/#{object.instance_variable_get(:@mask_addr).to_s(2).count('1')}" <del> else <del> object <del> end <del> end <del> <del> private <del> HstorePair = begin <del> quoted_string = /"[^"\\]*(?:\\.[^"\\]*)*"/ <del> unquoted_string = /(?:\\.|[^\s,])[^\s=,\\]*(?:\\.[^\s=,\\]*|=[^,>])*/ <del> /(#{quoted_string}|#{unquoted_string})\s*=>\s*(#{quoted_string}|#{unquoted_string})/ <del> end <del> <del> def escape_hstore(value) <del> value.nil? ? 'NULL' <del> : value == "" ? '""' <del> : '"%s"' % value.to_s.gsub(/(["\\])/, '\\\\\1') <del> end <add> attr_accessor :money_precision <ide> end <ide> # :startdoc: <ide> <ide> def type_cast(value) <ide> end <ide> <ide> private <del> def extract_limit(sql_type) <del> case sql_type <del> when /^bigint/i; 8 <del> when /^smallint/i; 2 <del> when /^timestamp/i; nil <del> else super <add> <add> def extract_limit(sql_type) <add> case sql_type <add> when /^bigint/i; 8 <add> when /^smallint/i; 2 <add> when /^timestamp/i; nil <add> else super <add> end <ide> end <del> end <ide> <del> # Extracts the scale from PostgreSQL-specific data types. <del> def extract_scale(sql_type) <del> # Money type has a fixed scale of 2. <del> sql_type =~ /^money/ ? 2 : super <del> end <add> # Extracts the scale from PostgreSQL-specific data types. <add> def extract_scale(sql_type) <add> # Money type has a fixed scale of 2. <add> sql_type =~ /^money/ ? 2 : super <add> end <ide> <del> # Extracts the precision from PostgreSQL-specific data types. <del> def extract_precision(sql_type) <del> if sql_type == 'money' <del> self.class.money_precision <del> elsif sql_type =~ /timestamp/i <del> $1.to_i if sql_type =~ /\((\d+)\)/ <del> else <del> super <add> # Extracts the precision from PostgreSQL-specific data types. <add> def extract_precision(sql_type) <add> if sql_type == 'money' <add> self.class.money_precision <add> elsif sql_type =~ /timestamp/i <add> $1.to_i if sql_type =~ /\((\d+)\)/ <add> else <add> super <add> end <ide> end <del> end <ide> <del> # Maps PostgreSQL-specific data types to logical Rails types. <del> def simplified_type(field_type) <del> case field_type <del> # Numeric and monetary types <del> when /^(?:real|double precision)$/ <del> :float <del> # Monetary types <del> when 'money' <del> :decimal <del> when 'hstore' <del> :hstore <del> # Network address types <del> when 'inet' <del> :inet <del> when 'cidr' <del> :cidr <del> when 'macaddr' <del> :macaddr <del> # Character types <del> when /^(?:character varying|bpchar)(?:\(\d+\))?$/ <del> :string <del> # Binary data types <del> when 'bytea' <del> :binary <del> # Date/time types <del> when /^timestamp with(?:out)? time zone$/ <del> :datetime <del> when 'interval' <del> :string <del> # Geometric types <del> when /^(?:point|line|lseg|box|"?path"?|polygon|circle)$/ <del> :string <del> # Bit strings <del> when /^bit(?: varying)?(?:\(\d+\))?$/ <del> :string <del> # XML type <del> when 'xml' <del> :xml <del> # tsvector type <del> when 'tsvector' <del> :tsvector <del> # Arrays <del> when /^\D+\[\]$/ <del> :string <del> # Object identifier types <del> when 'oid' <del> :integer <del> # UUID type <del> when 'uuid' <del> :uuid <del> # Small and big integer types <del> when /^(?:small|big)int$/ <del> :integer <del> # Pass through all types that are not specific to PostgreSQL. <del> else <del> super <add> # Maps PostgreSQL-specific data types to logical Rails types. <add> def simplified_type(field_type) <add> case field_type <add> # Numeric and monetary types <add> when /^(?:real|double precision)$/ <add> :float <add> # Monetary types <add> when 'money' <add> :decimal <add> when 'hstore' <add> :hstore <add> # Network address types <add> when 'inet' <add> :inet <add> when 'cidr' <add> :cidr <add> when 'macaddr' <add> :macaddr <add> # Character types <add> when /^(?:character varying|bpchar)(?:\(\d+\))?$/ <add> :string <add> # Binary data types <add> when 'bytea' <add> :binary <add> # Date/time types <add> when /^timestamp with(?:out)? time zone$/ <add> :datetime <add> when 'interval' <add> :string <add> # Geometric types <add> when /^(?:point|line|lseg|box|"?path"?|polygon|circle)$/ <add> :string <add> # Bit strings <add> when /^bit(?: varying)?(?:\(\d+\))?$/ <add> :string <add> # XML type <add> when 'xml' <add> :xml <add> # tsvector type <add> when 'tsvector' <add> :tsvector <add> # Arrays <add> when /^\D+\[\]$/ <add> :string <add> # Object identifier types <add> when 'oid' <add> :integer <add> # UUID type <add> when 'uuid' <add> :uuid <add> # Small and big integer types <add> when /^(?:small|big)int$/ <add> :integer <add> # Pass through all types that are not specific to PostgreSQL. <add> else <add> super <add> end <ide> end <del> end <ide> end <ide> <ide> # The PostgreSQL adapter works with the native C (https://bitbucket.org/ged/ruby-pg) driver. <ide> def uuid(name, options = {}) <ide> ADAPTER_NAME = 'PostgreSQL' <ide> <ide> NATIVE_DATABASE_TYPES = { <del> :primary_key => "serial primary key", <del> :string => { :name => "character varying", :limit => 255 }, <del> :text => { :name => "text" }, <del> :integer => { :name => "integer" }, <del> :float => { :name => "float" }, <del> :decimal => { :name => "decimal" }, <del> :datetime => { :name => "timestamp" }, <del> :timestamp => { :name => "timestamp" }, <del> :time => { :name => "time" }, <del> :date => { :name => "date" }, <del> :binary => { :name => "bytea" }, <del> :boolean => { :name => "boolean" }, <del> :xml => { :name => "xml" }, <del> :tsvector => { :name => "tsvector" }, <del> :hstore => { :name => "hstore" }, <del> :inet => { :name => "inet" }, <del> :cidr => { :name => "cidr" }, <del> :macaddr => { :name => "macaddr" }, <del> :uuid => { :name => "uuid" } <add> primary_key: "serial primary key", <add> string: { name: "character varying", limit: 255 }, <add> text: { name: "text" }, <add> integer: { name: "integer" }, <add> float: { name: "float" }, <add> decimal: { name: "decimal" }, <add> datetime: { name: "timestamp" }, <add> timestamp: { name: "timestamp" }, <add> time: { name: "time" }, <add> date: { name: "date" }, <add> binary: { name: "bytea" }, <add> boolean: { name: "boolean" }, <add> xml: { name: "xml" }, <add> tsvector: { name: "tsvector" }, <add> hstore: { name: "hstore" }, <add> inet: { name: "inet" }, <add> cidr: { name: "cidr" }, <add> macaddr: { name: "macaddr" }, <add> uuid: { name: "uuid" } <ide> } <ide> <add> include Quoting <add> include ReferentialIntegrity <add> include SchemaStatements <add> include DatabaseStatements <add> <ide> # Returns 'PostgreSQL' as adapter name for identification purposes. <ide> def adapter_name <ide> ADAPTER_NAME <ide> def delete(sql_key) <ide> end <ide> <ide> private <del> def cache <del> @cache[Process.pid] <del> end <ide> <del> def dealloc(key) <del> @connection.query "DEALLOCATE #{key}" if connection_active? <del> end <add> def cache <add> @cache[Process.pid] <add> end <ide> <del> def connection_active? <del> @connection.status == PGconn::CONNECTION_OK <del> rescue PGError <del> false <del> end <add> def dealloc(key) <add> @connection.query "DEALLOCATE #{key}" if connection_active? <add> end <add> <add> def connection_active? <add> @connection.status == PGconn::CONNECTION_OK <add> rescue PGError <add> false <add> end <ide> end <ide> <ide> class BindSubstitution < Arel::Visitors::PostgreSQL # :nodoc: <ide> def table_alias_length <ide> @table_alias_length ||= query('SHOW max_identifier_length', 'SCHEMA')[0][0].to_i <ide> end <ide> <del> # QUOTING ================================================== <del> <del> # Escapes binary strings for bytea input to the database. <del> def escape_bytea(value) <del> PGconn.escape_bytea(value) if value <del> end <del> <del> # Unescapes bytea output from a database to the binary string it represents. <del> # NOTE: This is NOT an inverse of escape_bytea! This is only to be used <del> # on escaped binary output from database drive. <del> def unescape_bytea(value) <del> PGconn.unescape_bytea(value) if value <del> end <del> <del> # Quotes PostgreSQL-specific data types for SQL input. <del> def quote(value, column = nil) #:nodoc: <del> return super unless column <del> <del> case value <del> when Hash <del> case column.sql_type <del> when 'hstore' then super(PostgreSQLColumn.hstore_to_string(value), column) <del> else super <del> end <del> when IPAddr <del> case column.sql_type <del> when 'inet', 'cidr' then super(PostgreSQLColumn.cidr_to_string(value), column) <del> else super <del> end <del> when Float <del> if value.infinite? && column.type == :datetime <del> "'#{value.to_s.downcase}'" <del> elsif value.infinite? || value.nan? <del> "'#{value.to_s}'" <del> else <del> super <del> end <del> when Numeric <del> return super unless column.sql_type == 'money' <del> # Not truly string input, so doesn't require (or allow) escape string syntax. <del> "'#{value}'" <del> when String <del> case column.sql_type <del> when 'bytea' then "'#{escape_bytea(value)}'" <del> when 'xml' then "xml '#{quote_string(value)}'" <del> when /^bit/ <del> case value <del> when /^[01]*$/ then "B'#{value}'" # Bit-string notation <del> when /^[0-9A-F]*$/i then "X'#{value}'" # Hexadecimal notation <del> end <del> else <del> super <del> end <del> else <del> super <del> end <del> end <del> <del> def type_cast(value, column) <del> return super unless column <del> <del> case value <del> when String <del> return super unless 'bytea' == column.sql_type <del> { :value => value, :format => 1 } <del> when Hash <del> return super unless 'hstore' == column.sql_type <del> PostgreSQLColumn.hstore_to_string(value) <del> when IPAddr <del> return super unless ['inet','cidr'].includes? column.sql_type <del> PostgreSQLColumn.cidr_to_string(value) <del> else <del> super <del> end <del> end <del> <del> # Quotes strings for use in SQL input. <del> def quote_string(s) #:nodoc: <del> @connection.escape(s) <del> end <del> <del> # Checks the following cases: <del> # <del> # - table_name <del> # - "table.name" <del> # - schema_name.table_name <del> # - schema_name."table.name" <del> # - "schema.name".table_name <del> # - "schema.name"."table.name" <del> def quote_table_name(name) <del> schema, name_part = extract_pg_identifier_from_name(name.to_s) <del> <del> unless name_part <del> quote_column_name(schema) <del> else <del> table_name, name_part = extract_pg_identifier_from_name(name_part) <del> "#{quote_column_name(schema)}.#{quote_column_name(table_name)}" <del> end <del> end <del> <del> # Quotes column names for use in SQL queries. <del> def quote_column_name(name) #:nodoc: <del> PGconn.quote_ident(name.to_s) <del> end <del> <del> # Quote date/time values for use in SQL input. Includes microseconds <del> # if the value is a Time responding to usec. <del> def quoted_date(value) #:nodoc: <del> if value.acts_like?(:time) && value.respond_to?(:usec) <del> "#{super}.#{sprintf("%06d", value.usec)}" <del> else <del> super <del> end <del> end <del> <ide> # Set the authorized user for this session <ide> def session_auth=(user) <ide> clear_cache! <ide> exec_query "SET SESSION AUTHORIZATION #{user}" <ide> end <ide> <del> # REFERENTIAL INTEGRITY ==================================== <del> <del> def supports_disable_referential_integrity? #:nodoc: <del> true <del> end <del> <del> def disable_referential_integrity #:nodoc: <del> if supports_disable_referential_integrity? then <del> execute(tables.collect { |name| "ALTER TABLE #{quote_table_name(name)} DISABLE TRIGGER ALL" }.join(";")) <del> end <del> yield <del> ensure <del> if supports_disable_referential_integrity? then <del> execute(tables.collect { |name| "ALTER TABLE #{quote_table_name(name)} ENABLE TRIGGER ALL" }.join(";")) <del> end <del> end <del> <del> # DATABASE STATEMENTS ====================================== <del> <del> def explain(arel, binds = []) <del> sql = "EXPLAIN #{to_sql(arel, binds)}" <del> ExplainPrettyPrinter.new.pp(exec_query(sql, 'EXPLAIN', binds)) <del> end <del> <del> class ExplainPrettyPrinter # :nodoc: <del> # Pretty prints the result of a EXPLAIN in a way that resembles the output of the <del> # PostgreSQL shell: <del> # <del> # QUERY PLAN <del> # ------------------------------------------------------------------------------ <del> # Nested Loop Left Join (cost=0.00..37.24 rows=8 width=0) <del> # Join Filter: (posts.user_id = users.id) <del> # -> Index Scan using users_pkey on users (cost=0.00..8.27 rows=1 width=4) <del> # Index Cond: (id = 1) <del> # -> Seq Scan on posts (cost=0.00..28.88 rows=8 width=4) <del> # Filter: (posts.user_id = 1) <del> # (6 rows) <del> # <del> def pp(result) <del> header = result.columns.first <del> lines = result.rows.map(&:first) <del> <del> # We add 2 because there's one char of padding at both sides, note <del> # the extra hyphens in the example above. <del> width = [header, *lines].map(&:length).max + 2 <del> <del> pp = [] <del> <del> pp << header.center(width).rstrip <del> pp << '-' * width <del> <del> pp += lines.map {|line| " #{line}"} <del> <del> nrows = result.rows.length <del> rows_label = nrows == 1 ? 'row' : 'rows' <del> pp << "(#{nrows} #{rows_label})" <del> <del> pp.join("\n") + "\n" <del> end <del> end <del> <del> # Executes a SELECT query and returns an array of rows. Each row is an <del> # array of field values. <del> def select_rows(sql, name = nil) <del> select_raw(sql, name).last <del> end <del> <del> # Executes an INSERT query and returns the new record's ID <del> def insert_sql(sql, name = nil, pk = nil, id_value = nil, sequence_name = nil) <del> unless pk <del> # Extract the table from the insert sql. Yuck. <del> table_ref = extract_table_ref_from_insert_sql(sql) <del> pk = primary_key(table_ref) if table_ref <del> end <del> <del> if pk && use_insert_returning? <del> select_value("#{sql} RETURNING #{quote_column_name(pk)}") <del> elsif pk <del> super <del> last_insert_id_value(sequence_name || default_sequence_name(table_ref, pk)) <del> else <del> super <del> end <del> end <del> alias :create :insert <del> <del> # create a 2D array representing the result set <del> def result_as_array(res) #:nodoc: <del> # check if we have any binary column and if they need escaping <del> ftypes = Array.new(res.nfields) do |i| <del> [i, res.ftype(i)] <del> end <del> <del> rows = res.values <del> return rows unless ftypes.any? { |_, x| <del> x == BYTEA_COLUMN_TYPE_OID || x == MONEY_COLUMN_TYPE_OID <del> } <del> <del> typehash = ftypes.group_by { |_, type| type } <del> binaries = typehash[BYTEA_COLUMN_TYPE_OID] || [] <del> monies = typehash[MONEY_COLUMN_TYPE_OID] || [] <del> <del> rows.each do |row| <del> # unescape string passed BYTEA field (OID == 17) <del> binaries.each do |index, _| <del> row[index] = unescape_bytea(row[index]) <del> end <del> <del> # If this is a money type column and there are any currency symbols, <del> # then strip them off. Indeed it would be prettier to do this in <del> # PostgreSQLColumn.string_to_decimal but would break form input <del> # fields that call value_before_type_cast. <del> monies.each do |index, _| <del> data = row[index] <del> # Because money output is formatted according to the locale, there are two <del> # cases to consider (note the decimal separators): <del> # (1) $12,345,678.12 <del> # (2) $12.345.678,12 <del> case data <del> when /^-?\D+[\d,]+\.\d{2}$/ # (1) <del> data.gsub!(/[^-\d.]/, '') <del> when /^-?\D+[\d.]+,\d{2}$/ # (2) <del> data.gsub!(/[^-\d,]/, '').sub!(/,/, '.') <del> end <del> end <del> end <del> end <del> <del> <del> # Queries the database and returns the results in an Array-like object <del> def query(sql, name = nil) #:nodoc: <del> log(sql, name) do <del> result_as_array @connection.async_exec(sql) <del> end <del> end <del> <del> # Executes an SQL statement, returning a PGresult object on success <del> # or raising a PGError exception otherwise. <del> def execute(sql, name = nil) <del> log(sql, name) do <del> @connection.async_exec(sql) <del> end <del> end <del> <del> def substitute_at(column, index) <del> Arel::Nodes::BindParam.new "$#{index + 1}" <del> end <del> <del> def exec_query(sql, name = 'SQL', binds = []) <del> log(sql, name, binds) do <del> result = binds.empty? ? exec_no_cache(sql, binds) : <del> exec_cache(sql, binds) <del> <del> types = {} <del> result.fields.each_with_index do |fname, i| <del> ftype = result.ftype i <del> fmod = result.fmod i <del> types[fname] = OID::TYPE_MAP.fetch(ftype, fmod) { |oid, mod| <del> warn "unknown OID: #{fname}(#{oid}) (#{sql})" <del> OID::Identity.new <del> } <del> end <del> <del> ret = ActiveRecord::Result.new(result.fields, result.values, types) <del> result.clear <del> return ret <del> end <del> end <del> <del> def exec_delete(sql, name = 'SQL', binds = []) <del> log(sql, name, binds) do <del> result = binds.empty? ? exec_no_cache(sql, binds) : <del> exec_cache(sql, binds) <del> affected = result.cmd_tuples <del> result.clear <del> affected <del> end <del> end <del> alias :exec_update :exec_delete <del> <del> def sql_for_insert(sql, pk, id_value, sequence_name, binds) <del> unless pk <del> # Extract the table from the insert sql. Yuck. <del> table_ref = extract_table_ref_from_insert_sql(sql) <del> pk = primary_key(table_ref) if table_ref <del> end <del> <del> if pk && use_insert_returning? <del> sql = "#{sql} RETURNING #{quote_column_name(pk)}" <del> end <del> <del> [sql, binds] <del> end <del> <del> def exec_insert(sql, name, binds, pk = nil, sequence_name = nil) <del> val = exec_query(sql, name, binds) <del> if !use_insert_returning? && pk <del> unless sequence_name <del> table_ref = extract_table_ref_from_insert_sql(sql) <del> sequence_name = default_sequence_name(table_ref, pk) <del> return val unless sequence_name <del> end <del> last_insert_id_result(sequence_name) <del> else <del> val <del> end <del> end <del> <del> # Executes an UPDATE query and returns the number of affected tuples. <del> def update_sql(sql, name = nil) <del> super.cmd_tuples <del> end <del> <del> # Begins a transaction. <del> def begin_db_transaction <del> execute "BEGIN" <del> end <del> <del> # Commits a transaction. <del> def commit_db_transaction <del> execute "COMMIT" <del> end <del> <del> # Aborts a transaction. <del> def rollback_db_transaction <del> execute "ROLLBACK" <del> end <del> <del> def outside_transaction? <del> @connection.transaction_status == PGconn::PQTRANS_IDLE <del> end <del> <del> def create_savepoint <del> execute("SAVEPOINT #{current_savepoint_name}") <del> end <del> <del> def rollback_to_savepoint <del> execute("ROLLBACK TO SAVEPOINT #{current_savepoint_name}") <del> end <del> <del> def release_savepoint <del> execute("RELEASE SAVEPOINT #{current_savepoint_name}") <del> end <del> <del> # SCHEMA STATEMENTS ======================================== <del> <del> # Drops the database specified on the +name+ attribute <del> # and creates it again using the provided +options+. <del> def recreate_database(name, options = {}) #:nodoc: <del> drop_database(name) <del> create_database(name, options) <del> end <del> <del> # Create a new PostgreSQL database. Options include <tt>:owner</tt>, <tt>:template</tt>, <del> # <tt>:encoding</tt>, <tt>:collation</tt>, <tt>:ctype</tt>, <del> # <tt>:tablespace</tt>, and <tt>:connection_limit</tt> (note that MySQL uses <del> # <tt>:charset</tt> while PostgreSQL uses <tt>:encoding</tt>). <del> # <del> # Example: <del> # create_database config[:database], config <del> # create_database 'foo_development', :encoding => 'unicode' <del> def create_database(name, options = {}) <del> options = options.reverse_merge(:encoding => "utf8") <del> <del> option_string = options.symbolize_keys.sum do |key, value| <del> case key <del> when :owner <del> " OWNER = \"#{value}\"" <del> when :template <del> " TEMPLATE = \"#{value}\"" <del> when :encoding <del> " ENCODING = '#{value}'" <del> when :collation <del> " LC_COLLATE = '#{value}'" <del> when :ctype <del> " LC_CTYPE = '#{value}'" <del> when :tablespace <del> " TABLESPACE = \"#{value}\"" <del> when :connection_limit <del> " CONNECTION LIMIT = #{value}" <del> else <del> "" <del> end <del> end <del> <del> execute "CREATE DATABASE #{quote_table_name(name)}#{option_string}" <del> end <del> <del> # Drops a PostgreSQL database. <del> # <del> # Example: <del> # drop_database 'matt_development' <del> def drop_database(name) #:nodoc: <del> execute "DROP DATABASE IF EXISTS #{quote_table_name(name)}" <del> end <del> <del> # Returns the list of all tables in the schema search path or a specified schema. <del> def tables(name = nil) <del> query(<<-SQL, 'SCHEMA').map { |row| row[0] } <del> SELECT tablename <del> FROM pg_tables <del> WHERE schemaname = ANY (current_schemas(false)) <del> SQL <del> end <del> <del> # Returns true if table exists. <del> # If the schema is not specified as part of +name+ then it will only find tables within <del> # the current schema search path (regardless of permissions to access tables in other schemas) <del> def table_exists?(name) <del> schema, table = Utils.extract_schema_and_table(name.to_s) <del> return false unless table <del> <del> binds = [[nil, table]] <del> binds << [nil, schema] if schema <del> <del> exec_query(<<-SQL, 'SCHEMA').rows.first[0].to_i > 0 <del> SELECT COUNT(*) <del> FROM pg_class c <del> LEFT JOIN pg_namespace n ON n.oid = c.relnamespace <del> WHERE c.relkind in ('v','r') <del> AND c.relname = '#{table.gsub(/(^"|"$)/,'')}' <del> AND n.nspname = #{schema ? "'#{schema}'" : 'ANY (current_schemas(false))'} <del> SQL <del> end <del> <del> # Returns true if schema exists. <del> def schema_exists?(name) <del> exec_query(<<-SQL, 'SCHEMA').rows.first[0].to_i > 0 <del> SELECT COUNT(*) <del> FROM pg_namespace <del> WHERE nspname = '#{name}' <del> SQL <del> end <del> <del> # Returns an array of indexes for the given table. <del> def indexes(table_name, name = nil) <del> result = query(<<-SQL, 'SCHEMA') <del> SELECT distinct i.relname, d.indisunique, d.indkey, pg_get_indexdef(d.indexrelid), t.oid <del> FROM pg_class t <del> INNER JOIN pg_index d ON t.oid = d.indrelid <del> INNER JOIN pg_class i ON d.indexrelid = i.oid <del> WHERE i.relkind = 'i' <del> AND d.indisprimary = 'f' <del> AND t.relname = '#{table_name}' <del> AND i.relnamespace IN (SELECT oid FROM pg_namespace WHERE nspname = ANY (current_schemas(false)) ) <del> ORDER BY i.relname <del> SQL <del> <del> result.map do |row| <del> index_name = row[0] <del> unique = row[1] == 't' <del> indkey = row[2].split(" ") <del> inddef = row[3] <del> oid = row[4] <del> <del> columns = Hash[query(<<-SQL, "Columns for index #{row[0]} on #{table_name}")] <del> SELECT a.attnum, a.attname <del> FROM pg_attribute a <del> WHERE a.attrelid = #{oid} <del> AND a.attnum IN (#{indkey.join(",")}) <del> SQL <del> <del> column_names = columns.values_at(*indkey).compact <del> <del> # add info on sort order for columns (only desc order is explicitly specified, asc is the default) <del> desc_order_columns = inddef.scan(/(\w+) DESC/).flatten <del> orders = desc_order_columns.any? ? Hash[desc_order_columns.map {|order_column| [order_column, :desc]}] : {} <del> where = inddef.scan(/WHERE (.+)$/).flatten[0] <del> <del> column_names.empty? ? nil : IndexDefinition.new(table_name, index_name, unique, column_names, [], orders, where) <del> end.compact <del> end <del> <del> # Returns the list of all column definitions for a table. <del> def columns(table_name) <del> # Limit, precision, and scale are all handled by the superclass. <del> column_definitions(table_name).map do |column_name, type, default, notnull, oid, fmod| <del> oid = OID::TYPE_MAP.fetch(oid.to_i, fmod.to_i) { <del> OID::Identity.new <del> } <del> PostgreSQLColumn.new(column_name, default, oid, type, notnull == 'f') <del> end <del> end <del> <del> # Returns the current database name. <del> def current_database <del> query('select current_database()', 'SCHEMA')[0][0] <del> end <del> <del> # Returns the current schema name. <del> def current_schema <del> query('SELECT current_schema', 'SCHEMA')[0][0] <del> end <del> <del> # Returns the current database encoding format. <del> def encoding <del> query(<<-end_sql, 'SCHEMA')[0][0] <del> SELECT pg_encoding_to_char(pg_database.encoding) FROM pg_database <del> WHERE pg_database.datname LIKE '#{current_database}' <del> end_sql <del> end <del> <del> # Returns the current database collation. <del> def collation <del> query(<<-end_sql, 'SCHEMA')[0][0] <del> SELECT pg_database.datcollate FROM pg_database WHERE pg_database.datname LIKE '#{current_database}' <del> end_sql <del> end <del> <del> # Returns the current database ctype. <del> def ctype <del> query(<<-end_sql, 'SCHEMA')[0][0] <del> SELECT pg_database.datctype FROM pg_database WHERE pg_database.datname LIKE '#{current_database}' <del> end_sql <del> end <del> <del> # Returns an array of schema names. <del> def schema_names <del> query(<<-SQL, 'SCHEMA').flatten <del> SELECT nspname <del> FROM pg_namespace <del> WHERE nspname !~ '^pg_.*' <del> AND nspname NOT IN ('information_schema') <del> ORDER by nspname; <del> SQL <del> end <del> <del> # Creates a schema for the given schema name. <del> def create_schema schema_name <del> execute "CREATE SCHEMA #{schema_name}" <del> end <del> <del> # Drops the schema for the given schema name. <del> def drop_schema schema_name <del> execute "DROP SCHEMA #{schema_name} CASCADE" <del> end <del> <del> # Sets the schema search path to a string of comma-separated schema names. <del> # Names beginning with $ have to be quoted (e.g. $user => '$user'). <del> # See: http://www.postgresql.org/docs/current/static/ddl-schemas.html <del> # <del> # This should be not be called manually but set in database.yml. <del> def schema_search_path=(schema_csv) <del> if schema_csv <del> execute("SET search_path TO #{schema_csv}", 'SCHEMA') <del> @schema_search_path = schema_csv <del> end <del> end <del> <del> # Returns the active schema search path. <del> def schema_search_path <del> @schema_search_path ||= query('SHOW search_path', 'SCHEMA')[0][0] <del> end <del> <del> # Returns the current client message level. <del> def client_min_messages <del> query('SHOW client_min_messages', 'SCHEMA')[0][0] <del> end <del> <del> # Set the client message level. <del> def client_min_messages=(level) <del> execute("SET client_min_messages TO '#{level}'", 'SCHEMA') <del> end <del> <del> # Returns the sequence name for a table's primary key or some other specified key. <del> def default_sequence_name(table_name, pk = nil) #:nodoc: <del> result = serial_sequence(table_name, pk || 'id') <del> return nil unless result <del> result.split('.').last <del> rescue ActiveRecord::StatementInvalid <del> "#{table_name}_#{pk || 'id'}_seq" <del> end <del> <del> def serial_sequence(table, column) <del> result = exec_query(<<-eosql, 'SCHEMA') <del> SELECT pg_get_serial_sequence('#{table}', '#{column}') <del> eosql <del> result.rows.first.first <del> end <del> <del> # Resets the sequence of a table's primary key to the maximum value. <del> def reset_pk_sequence!(table, pk = nil, sequence = nil) #:nodoc: <del> unless pk and sequence <del> default_pk, default_sequence = pk_and_sequence_for(table) <del> <del> pk ||= default_pk <del> sequence ||= default_sequence <del> end <del> <del> if @logger && pk && !sequence <del> @logger.warn "#{table} has primary key #{pk} with no default sequence" <del> end <del> <del> if pk && sequence <del> quoted_sequence = quote_table_name(sequence) <del> <del> select_value <<-end_sql, 'Reset sequence' <del> SELECT setval('#{quoted_sequence}', (SELECT COALESCE(MAX(#{quote_column_name pk})+(SELECT increment_by FROM #{quoted_sequence}), (SELECT min_value FROM #{quoted_sequence})) FROM #{quote_table_name(table)}), false) <del> end_sql <del> end <del> end <del> <del> # Returns a table's primary key and belonging sequence. <del> def pk_and_sequence_for(table) #:nodoc: <del> # First try looking for a sequence with a dependency on the <del> # given table's primary key. <del> result = query(<<-end_sql, 'PK and serial sequence')[0] <del> SELECT attr.attname, seq.relname <del> FROM pg_class seq, <del> pg_attribute attr, <del> pg_depend dep, <del> pg_namespace name, <del> pg_constraint cons <del> WHERE seq.oid = dep.objid <del> AND seq.relkind = 'S' <del> AND attr.attrelid = dep.refobjid <del> AND attr.attnum = dep.refobjsubid <del> AND attr.attrelid = cons.conrelid <del> AND attr.attnum = cons.conkey[1] <del> AND cons.contype = 'p' <del> AND dep.refobjid = '#{quote_table_name(table)}'::regclass <del> end_sql <del> <del> if result.nil? or result.empty? <del> # If that fails, try parsing the primary key's default value. <del> # Support the 7.x and 8.0 nextval('foo'::text) as well as <del> # the 8.1+ nextval('foo'::regclass). <del> result = query(<<-end_sql, 'PK and custom sequence')[0] <del> SELECT attr.attname, <del> CASE <del> WHEN split_part(def.adsrc, '''', 2) ~ '.' THEN <del> substr(split_part(def.adsrc, '''', 2), <del> strpos(split_part(def.adsrc, '''', 2), '.')+1) <del> ELSE split_part(def.adsrc, '''', 2) <del> END <del> FROM pg_class t <del> JOIN pg_attribute attr ON (t.oid = attrelid) <del> JOIN pg_attrdef def ON (adrelid = attrelid AND adnum = attnum) <del> JOIN pg_constraint cons ON (conrelid = adrelid AND adnum = conkey[1]) <del> WHERE t.oid = '#{quote_table_name(table)}'::regclass <del> AND cons.contype = 'p' <del> AND def.adsrc ~* 'nextval' <del> end_sql <del> end <del> <del> [result.first, result.last] <del> rescue <del> nil <del> end <del> <del> # Returns just a table's primary key <del> def primary_key(table) <del> row = exec_query(<<-end_sql, 'SCHEMA').rows.first <del> SELECT DISTINCT(attr.attname) <del> FROM pg_attribute attr <del> INNER JOIN pg_depend dep ON attr.attrelid = dep.refobjid AND attr.attnum = dep.refobjsubid <del> INNER JOIN pg_constraint cons ON attr.attrelid = cons.conrelid AND attr.attnum = cons.conkey[1] <del> WHERE cons.contype = 'p' <del> AND dep.refobjid = '#{table}'::regclass <del> end_sql <del> <del> row && row.first <del> end <del> <del> # Renames a table. <del> # Also renames a table's primary key sequence if the sequence name matches the <del> # Active Record default. <del> # <del> # Example: <del> # rename_table('octopuses', 'octopi') <del> def rename_table(name, new_name) <del> clear_cache! <del> execute "ALTER TABLE #{quote_table_name(name)} RENAME TO #{quote_table_name(new_name)}" <del> pk, seq = pk_and_sequence_for(new_name) <del> if seq == "#{name}_#{pk}_seq" <del> new_seq = "#{new_name}_#{pk}_seq" <del> execute "ALTER TABLE #{quote_table_name(seq)} RENAME TO #{quote_table_name(new_seq)}" <del> end <del> end <del> <del> # Adds a new column to the named table. <del> # See TableDefinition#column for details of the options you can use. <del> def add_column(table_name, column_name, type, options = {}) <del> clear_cache! <del> add_column_sql = "ALTER TABLE #{quote_table_name(table_name)} ADD COLUMN #{quote_column_name(column_name)} #{type_to_sql(type, options[:limit], options[:precision], options[:scale])}" <del> add_column_options!(add_column_sql, options) <del> <del> execute add_column_sql <del> end <del> <del> # Changes the column of a table. <del> def change_column(table_name, column_name, type, options = {}) <del> clear_cache! <del> quoted_table_name = quote_table_name(table_name) <del> <del> execute "ALTER TABLE #{quoted_table_name} ALTER COLUMN #{quote_column_name(column_name)} TYPE #{type_to_sql(type, options[:limit], options[:precision], options[:scale])}" <del> <del> change_column_default(table_name, column_name, options[:default]) if options_include_default?(options) <del> change_column_null(table_name, column_name, options[:null], options[:default]) if options.key?(:null) <del> end <del> <del> # Changes the default value of a table column. <del> def change_column_default(table_name, column_name, default) <del> clear_cache! <del> execute "ALTER TABLE #{quote_table_name(table_name)} ALTER COLUMN #{quote_column_name(column_name)} SET DEFAULT #{quote(default)}" <del> end <del> <del> def change_column_null(table_name, column_name, null, default = nil) <del> clear_cache! <del> unless null || default.nil? <del> execute("UPDATE #{quote_table_name(table_name)} SET #{quote_column_name(column_name)}=#{quote(default)} WHERE #{quote_column_name(column_name)} IS NULL") <del> end <del> execute("ALTER TABLE #{quote_table_name(table_name)} ALTER #{quote_column_name(column_name)} #{null ? 'DROP' : 'SET'} NOT NULL") <del> end <del> <del> # Renames a column in a table. <del> def rename_column(table_name, column_name, new_column_name) <del> clear_cache! <del> execute "ALTER TABLE #{quote_table_name(table_name)} RENAME COLUMN #{quote_column_name(column_name)} TO #{quote_column_name(new_column_name)}" <del> end <del> <del> def remove_index!(table_name, index_name) #:nodoc: <del> execute "DROP INDEX #{quote_table_name(index_name)}" <del> end <del> <del> def rename_index(table_name, old_name, new_name) <del> execute "ALTER INDEX #{quote_column_name(old_name)} RENAME TO #{quote_table_name(new_name)}" <del> end <del> <del> def index_name_length <del> 63 <del> end <del> <del> # Maps logical Rails types to PostgreSQL-specific data types. <del> def type_to_sql(type, limit = nil, precision = nil, scale = nil) <del> case type.to_s <del> when 'binary' <del> # PostgreSQL doesn't support limits on binary (bytea) columns. <del> # The hard limit is 1Gb, because of a 32-bit size field, and TOAST. <del> case limit <del> when nil, 0..0x3fffffff; super(type) <del> else raise(ActiveRecordError, "No binary type has byte size #{limit}.") <del> end <del> when 'integer' <del> return 'integer' unless limit <del> <del> case limit <del> when 1, 2; 'smallint' <del> when 3, 4; 'integer' <del> when 5..8; 'bigint' <del> else raise(ActiveRecordError, "No integer type has byte size #{limit}. Use a numeric with precision 0 instead.") <del> end <del> when 'datetime' <del> return super unless precision <del> <del> case precision <del> when 0..6; "timestamp(#{precision})" <del> else raise(ActiveRecordError, "No timestamp type has precision of #{precision}. The allowed range of precision is from 0 to 6") <del> end <del> else <del> super <del> end <del> end <del> <del> # Returns a SELECT DISTINCT clause for a given set of columns and a given ORDER BY clause. <del> # <del> # PostgreSQL requires the ORDER BY columns in the select list for distinct queries, and <del> # requires that the ORDER BY include the distinct column. <del> # <del> # distinct("posts.id", "posts.created_at desc") <del> def distinct(columns, orders) #:nodoc: <del> return "DISTINCT #{columns}" if orders.empty? <del> <del> # Construct a clean list of column names from the ORDER BY clause, removing <del> # any ASC/DESC modifiers <del> order_columns = orders.collect do |s| <del> s = s.to_sql unless s.is_a?(String) <del> s.gsub(/\s+(ASC|DESC)\s*(NULLS\s+(FIRST|LAST)\s*)?/i, '') <del> end <del> order_columns.delete_if { |c| c.blank? } <del> order_columns = order_columns.zip((0...order_columns.size).to_a).map { |s,i| "#{s} AS alias_#{i}" } <del> <del> "DISTINCT #{columns}, #{order_columns * ', '}" <del> end <del> <ide> module Utils <ide> extend self <ide> <ide> def use_insert_returning? <ide> end <ide> <ide> protected <add> <ide> # Returns the version of the connected PostgreSQL server. <ide> def postgresql_version <ide> @connection.server_version <ide> def translate_exception(exception, message) <ide> end <ide> <ide> private <del> def initialize_type_map <del> result = execute('SELECT oid, typname, typelem, typdelim FROM pg_type', 'SCHEMA') <del> leaves, nodes = result.partition { |row| row['typelem'] == '0' } <ide> <del> # populate the leaf nodes <del> leaves.find_all { |row| OID.registered_type? row['typname'] }.each do |row| <del> OID::TYPE_MAP[row['oid'].to_i] = OID::NAMES[row['typname']] <del> end <add> def initialize_type_map <add> result = execute('SELECT oid, typname, typelem, typdelim FROM pg_type', 'SCHEMA') <add> leaves, nodes = result.partition { |row| row['typelem'] == '0' } <ide> <del> # populate composite types <del> nodes.find_all { |row| OID::TYPE_MAP.key? row['typelem'].to_i }.each do |row| <del> vector = OID::Vector.new row['typdelim'], OID::TYPE_MAP[row['typelem'].to_i] <del> OID::TYPE_MAP[row['oid'].to_i] = vector <add> # populate the leaf nodes <add> leaves.find_all { |row| OID.registered_type? row['typname'] }.each do |row| <add> OID::TYPE_MAP[row['oid'].to_i] = OID::NAMES[row['typname']] <add> end <add> <add> # populate composite types <add> nodes.find_all { |row| OID::TYPE_MAP.key? row['typelem'].to_i }.each do |row| <add> vector = OID::Vector.new row['typdelim'], OID::TYPE_MAP[row['typelem'].to_i] <add> OID::TYPE_MAP[row['oid'].to_i] = vector <add> end <ide> end <del> end <ide> <ide> FEATURE_NOT_SUPPORTED = "0A000" # :nodoc: <ide> <ide><path>activerecord/test/cases/adapters/postgresql/active_schema_test.rb <ide> class PostgresqlActiveSchemaTest < ActiveRecord::TestCase <ide> def setup <ide> ActiveRecord::ConnectionAdapters::PostgreSQLAdapter.class_eval do <del> alias_method :real_execute, :execute <del> remove_method :execute <ide> def execute(sql, name = nil) sql end <ide> end <ide> end <ide> <ide> def teardown <ide> ActiveRecord::ConnectionAdapters::PostgreSQLAdapter.class_eval do <ide> remove_method :execute <del> alias_method :execute, :real_execute <ide> end <ide> end <ide>
7
Javascript
Javascript
remove common.fixturesdir from tests
f9660b71668c2edb20d13760a9a5bcbb76a20fbd
<ide><path>test/parallel/test-tls-interleave.js <ide> if (!common.hasCrypto) <ide> common.skip('missing crypto'); <ide> <ide> const assert = require('assert'); <del> <ide> const tls = require('tls'); <ide> <del>const fs = require('fs'); <add>const fixtures = require('../common/fixtures'); <ide> <del>const dir = common.fixturesDir; <del>const options = { key: fs.readFileSync(`${dir}/test_key.pem`), <del> cert: fs.readFileSync(`${dir}/test_cert.pem`), <del> ca: [ fs.readFileSync(`${dir}/test_ca.pem`) ] }; <add>const options = { key: fixtures.readSync('test_key.pem'), <add> cert: fixtures.readSync('test_cert.pem'), <add> ca: [ fixtures.readSync('test_ca.pem') ] }; <ide> <ide> const writes = [ <ide> 'some server data', <ide><path>test/parallel/test-tls-invoke-queued.js <ide> if (!common.hasCrypto) <ide> common.skip('missing crypto'); <ide> <ide> const assert = require('assert'); <del>const fs = require('fs'); <ide> const tls = require('tls'); <ide> <add>const fixtures = require('../common/fixtures'); <add> <ide> let received = ''; <ide> <ide> const server = tls.createServer({ <del> key: fs.readFileSync(`${common.fixturesDir}/keys/agent1-key.pem`), <del> cert: fs.readFileSync(`${common.fixturesDir}/keys/agent1-cert.pem`) <add> key: fixtures.readKey('agent1-key.pem'), <add> cert: fixtures.readKey('agent1-cert.pem') <ide> }, common.mustCall(function(c) { <ide> c._write('hello ', null, common.mustCall(function() { <ide> c._write('world!', null, common.mustCall(function() {
2
Text
Text
fix two typos
eda0220e5f807482e4feb327e34375de308ea0fc
<ide><path>docs/Homebrew-linuxbrew-core-Maintainer-Guide.md <ide> brew merge-homebrew --core <ide> ``` <ide> <ide> Merging all the changes from upstream in one go is usually <del>undesireable since our build servers will time out. Instead, attempt <add>undesirable since our build servers will time out. Instead, attempt <ide> to only merge 8-10 modified formulae. <ide> <ide> `git log --oneline master..homebrew/master` will show a list of all <ide><path>docs/Prose-Style-Guidelines.md <ide> Homebrew's audience includes users with a wide range of education and experience <ide> <ide> We strive for "correct" but not "fancy" usage. Think newspaper article, not academic paper. <ide> <del>This is a set of guidelines to be applied using human judgment, not a set of hard and fast rules. It is like [The Economist's Style Guide](https://web.archive.org/web/20170830001125/https://www.economist.com/styleguide/introduction) or [Garner's Modern American Usage](https://en.wikipedia.org/wiki/Garner's_Modern_American_Usage). It is less like the [Ruby Style Guide](https://github.com/rubocop-hq/ruby-style-guide#the-ruby-style-guide). All guidelines here are open to interpretation and discussion. 100% conformance to these guidelines is *not* a goal. <add>This is a set of guidelines to be applied using human judgement, not a set of hard and fast rules. It is like [The Economist's Style Guide](https://web.archive.org/web/20170830001125/https://www.economist.com/styleguide/introduction) or [Garner's Modern American Usage](https://en.wikipedia.org/wiki/Garner's_Modern_American_Usage). It is less like the [Ruby Style Guide](https://github.com/rubocop-hq/ruby-style-guide#the-ruby-style-guide). All guidelines here are open to interpretation and discussion. 100% conformance to these guidelines is *not* a goal. <ide> <ide> The intent of this document is to help authors make decisions about clarity, style, and consistency. It is not to help settle arguments about who knows English better. Don't use this document to be a jerk. <ide>
2
Javascript
Javascript
add typeerror for vm/compilefunction params
3212f77ac6d674a7d43c3303dcca22508c8be468
<ide><path>test/parallel/test-vm-basic.js <ide> const vm = require('vm'); <ide> } <ide> ); <ide> <add> // Testing for non Array type-based failures <add> [Boolean(), Number(), null, Object(), Symbol(), {}].forEach( <add> (value) => { <add> common.expectsError(() => { <add> vm.compileFunction('', value); <add> }, { <add> type: TypeError, <add> code: 'ERR_INVALID_ARG_TYPE', <add> message: 'The "params" argument must be of type Array. ' + <add> `Received type ${typeof value}` <add> }); <add> } <add> ); <add> <ide> assert.strictEqual( <ide> vm.compileFunction( <ide> 'return a;',
1
PHP
PHP
add regression test
c946d18b4528d0e8e1e44b503f308f936d584e48
<ide><path>tests/TestCase/View/Helper/FormHelperTest.php <ide> public function testInputContainerTemplates() <ide> $this->assertContains('<div class="dt">', $result); <ide> } <ide> <add> /** <add> * Test that *Container templates are used by input. <add> * <add> * @return void <add> */ <add> public function testFormGroupTemplates() <add> { <add> $this->Form->templates([ <add> 'radioFormGroup' => '<div class="radio">{{label}}{{input}}</div>', <add> ]); <add> <add> $this->Form->create($this->article); <add> <add> $result = $this->Form->input('accept', [ <add> 'type' => 'radio', <add> 'options' => ['Y', 'N'] <add> ]); <add> $this->assertContains('<div class="radio">', $result); <add> } <add> <ide> /** <ide> * Test resetting templates. <ide> *
1
Javascript
Javascript
add release time to header on uncompressed file
8ee67bde11ef496dcde4ee026e905c52eb7d4782
<ide><path>Gruntfile.js <ide> module.exports = function( grunt ) { <ide> // Embed Version <ide> // Embed Date <ide> compiled = compiled.replace( /@VERSION/g, version ) <del> .replace( "@DATE", function () { <del> // YYYY-MM-DD <del> return ( new Date() ).toISOString().replace( /T.*/, "" ); <del> }); <add> // yyyy-mm-ddThh:mmZ <add> .replace( /@DATE/g, ( new Date() ).toISOString().replace( /:\d+\.\d+Z$/, "Z" ) ); <ide> <ide> // Write concatenated source to file <ide> grunt.file.write( name, compiled );
1
Mixed
Ruby
update changelog.md for [ci skip]
b76f82d714e590c20370e72fa36fa574c4f17650
<ide><path>activesupport/CHANGELOG.md <add>* Remove unused parameter `options = nil` for `#clear` of <add> `ActiveSupport::Cache::Strategy::LocalCache::LocalStore` and <add> `ActiveSupport::Cache::Strategy::LocalCache`. <add> <add> *Yosuke Kabuto* <add> <ide> * Support parsing JSON time in ISO8601 local time strings in <ide> `ActiveSupport::JSON.decode` when `parse_json_times` is enabled. <ide> Strings in the format of `YYYY-MM-DD hh:mm:ss` (without a `Z` at <ide><path>activesupport/lib/active_support/cache.rb <ide> def cleanup(options = nil) <ide> # The options hash is passed to the underlying cache implementation. <ide> # <ide> # All implementations may not support this method. <del> def clear(options = nil) <add> def clear <ide> raise NotImplementedError.new("#{self.class.name} does not support clear") <ide> end <ide> <ide><path>activesupport/lib/active_support/cache/file_store.rb <ide> def initialize(cache_path, options = nil) <ide> # Deletes all items from the cache. In this case it deletes all the entries in the specified <ide> # file store directory except for .keep or .gitkeep. Be careful which directory is specified in your <ide> # config file when using +FileStore+ because everything in that directory will be deleted. <del> def clear(options = nil) <add> def clear <ide> root_dirs = exclude_from(cache_path, EXCLUDED_DIRS + GITKEEP_FILES) <ide> FileUtils.rm_r(root_dirs.collect{|f| File.join(cache_path, f)}) <ide> rescue Errno::ENOENT <ide><path>activesupport/lib/active_support/cache/strategy/local_cache.rb <ide> def synchronize # :nodoc: <ide> yield <ide> end <ide> <del> def clear(options = nil) <add> def clear <ide> @data.clear <ide> end <ide> <ide> def middleware <ide> local_cache_key) <ide> end <ide> <del> def clear(options = nil) # :nodoc: <add> def clear # :nodoc: <ide> return super unless cache = local_cache <del> cache.clear(options) <add> cache.clear <ide> super <ide> end <ide>
4
Javascript
Javascript
use correct function arity
eebf0866a996fa7d1ace4b888cd1a0fce8a032f3
<ide><path>lib/FunctionModulePlugin.js <ide> const FunctionModuleTemplatePlugin = require("./FunctionModuleTemplatePlugin"); <ide> <ide> class FunctionModulePlugin { <del> constructor(options) { <del> this.options = options; <del> } <del> <ide> apply(compiler) { <ide> compiler.hooks.compilation.tap("FunctionModulePlugin", compilation => { <ide> new FunctionModuleTemplatePlugin().apply( <ide><path>lib/WebpackOptionsApply.js <ide> class WebpackOptionsApply extends OptionsApply { <ide> JsonpTemplatePlugin = require("./web/JsonpTemplatePlugin"); <ide> FetchCompileWasmTemplatePlugin = require("./web/FetchCompileWasmTemplatePlugin"); <ide> NodeSourcePlugin = require("./node/NodeSourcePlugin"); <del> new JsonpTemplatePlugin(options.output).apply(compiler); <del> new FetchCompileWasmTemplatePlugin(options.output).apply(compiler); <del> new FunctionModulePlugin(options.output).apply(compiler); <add> new JsonpTemplatePlugin().apply(compiler); <add> new FetchCompileWasmTemplatePlugin().apply(compiler); <add> new FunctionModulePlugin().apply(compiler); <ide> new NodeSourcePlugin(options.node).apply(compiler); <ide> new LoaderTargetPlugin(options.target).apply(compiler); <ide> break; <ide> class WebpackOptionsApply extends OptionsApply { <ide> FetchCompileWasmTemplatePlugin = require("./web/FetchCompileWasmTemplatePlugin"); <ide> NodeSourcePlugin = require("./node/NodeSourcePlugin"); <ide> new WebWorkerTemplatePlugin().apply(compiler); <del> new FetchCompileWasmTemplatePlugin(options.output).apply(compiler); <del> new FunctionModulePlugin(options.output).apply(compiler); <add> new FetchCompileWasmTemplatePlugin().apply(compiler); <add> new FunctionModulePlugin().apply(compiler); <ide> new NodeSourcePlugin(options.node).apply(compiler); <ide> new LoaderTargetPlugin(options.target).apply(compiler); <ide> break; <ide> class WebpackOptionsApply extends OptionsApply { <ide> new NodeTemplatePlugin({ <ide> asyncChunkLoading: options.target === "async-node" <ide> }).apply(compiler); <del> new ReadFileCompileWasmTemplatePlugin(options.output).apply(compiler); <del> new FunctionModulePlugin(options.output).apply(compiler); <add> new ReadFileCompileWasmTemplatePlugin().apply(compiler); <add> new FunctionModulePlugin().apply(compiler); <ide> new NodeTargetPlugin().apply(compiler); <ide> new LoaderTargetPlugin("node").apply(compiler); <ide> break; <ide> case "node-webkit": <ide> JsonpTemplatePlugin = require("./web/JsonpTemplatePlugin"); <ide> NodeTargetPlugin = require("./node/NodeTargetPlugin"); <ide> ExternalsPlugin = require("./ExternalsPlugin"); <del> new JsonpTemplatePlugin(options.output).apply(compiler); <del> new FunctionModulePlugin(options.output).apply(compiler); <add> new JsonpTemplatePlugin().apply(compiler); <add> new FunctionModulePlugin().apply(compiler); <ide> new NodeTargetPlugin().apply(compiler); <ide> new ExternalsPlugin("commonjs", "nw.gui").apply(compiler); <ide> new LoaderTargetPlugin(options.target).apply(compiler); <ide> class WebpackOptionsApply extends OptionsApply { <ide> new NodeTemplatePlugin({ <ide> asyncChunkLoading: true <ide> }).apply(compiler); <del> new FunctionModulePlugin(options.output).apply(compiler); <add> new FunctionModulePlugin().apply(compiler); <ide> new NodeTargetPlugin().apply(compiler); <ide> new ExternalsPlugin("commonjs", [ <ide> "app", <ide> class WebpackOptionsApply extends OptionsApply { <ide> JsonpTemplatePlugin = require("./web/JsonpTemplatePlugin"); <ide> NodeTargetPlugin = require("./node/NodeTargetPlugin"); <ide> ExternalsPlugin = require("./ExternalsPlugin"); <del> new JsonpTemplatePlugin(options.output).apply(compiler); <del> new FunctionModulePlugin(options.output).apply(compiler); <add> new JsonpTemplatePlugin().apply(compiler); <add> new FunctionModulePlugin().apply(compiler); <ide> new NodeTargetPlugin().apply(compiler); <ide> new ExternalsPlugin("commonjs", [ <ide> "clipboard", <ide><path>lib/dependencies/HarmonyImportDependency.js <ide> HarmonyImportDependency.Template = class HarmonyImportDependencyTemplate { <ide> return key && sourceInfo.emittedImports.get(key); <ide> } <ide> <del> harmonyInit(dep, source, runtime) { <add> harmonyInit(dep, source, runtime, dependencyTemplates) { <ide> let sourceInfo = importEmittedMap.get(source); <ide> if (!sourceInfo) { <ide> importEmittedMap.set( <ide><path>lib/dependencies/HarmonyImportSpecifierDependency.js <ide> class HarmonyImportSpecifierDependency extends HarmonyImportDependency { <ide> <ide> HarmonyImportSpecifierDependency.Template = class HarmonyImportSpecifierDependencyTemplate extends HarmonyImportDependency.Template { <ide> apply(dep, source, runtime) { <del> super.apply(dep, source, runtime); <ide> const content = this.getContent(dep, runtime); <ide> source.replace(dep.range[0], dep.range[1] - 1, content); <ide> } <ide><path>lib/dependencies/RequireEnsureDependenciesBlockParserPlugin.js <ide> module.exports = class RequireEnsureDependenciesBlockParserPlugin { <ide> parser.inScope([], () => { <ide> for (const ee of dependenciesItems) { <ide> if (ee.isString()) { <del> const edep = new RequireEnsureItemDependency( <del> ee.string, <del> ee.range <del> ); <add> const edep = new RequireEnsureItemDependency(ee.string); <ide> edep.loc = dep.loc; <ide> dep.addDependency(edep); <ide> } else {
5
Javascript
Javascript
remove onscroll bubbling flag
e9721e14e4b8776c107afa3cdd7c6d664fe20c24
<ide><path>packages/react-dom/src/__tests__/ReactDOMEventListener-test.js <ide> describe('ReactDOMEventListener', () => { <ide> bubbles: false, <ide> }), <ide> ); <del> if (gate(flags => flags.disableOnScrollBubbling)) { <del> expect(log).toEqual([ <del> ['capture', 'grand'], <del> ['capture', 'parent'], <del> ['capture', 'child'], <del> ['bubble', 'child'], <del> ]); <del> } else { <del> expect(log).toEqual([ <del> ['capture', 'grand'], <del> ['capture', 'parent'], <del> ['capture', 'child'], <del> ['bubble', 'child'], <del> ['bubble', 'parent'], <del> ['bubble', 'grand'], <del> ]); <del> } <add> expect(log).toEqual([ <add> ['capture', 'grand'], <add> ['capture', 'parent'], <add> ['capture', 'child'], <add> ['bubble', 'child'], <add> ]); <ide> } finally { <ide> document.body.removeChild(container); <ide> } <ide><path>packages/react-dom/src/__tests__/ReactDOMEventPropagation-test.js <ide> describe('ReactDOMEventListener', () => { <ide> }); <ide> <ide> describe('non-bubbling events that do not bubble in React', () => { <del> // This test will fail outside of the no-bubbling flag <del> // because its bubbling emulation is currently broken. <del> // In particular, if the target itself doesn't have <del> // a handler, it will not emulate bubbling correctly. <del> // Instead of fixing this, we'll just turn this flag on. <del> // @gate disableOnScrollBubbling <ide> it('onScroll', () => { <ide> testNonBubblingEvent({ <ide> type: 'div', <ide><path>packages/react-dom/src/events/plugins/SimpleEventPlugin.js <ide> import {IS_EVENT_HANDLE_NON_MANAGED_NODE} from '../EventSystemFlags'; <ide> import getEventCharCode from '../getEventCharCode'; <ide> import {IS_CAPTURE_PHASE} from '../EventSystemFlags'; <ide> <del>import { <del> enableCreateEventHandleAPI, <del> disableOnScrollBubbling, <del>} from 'shared/ReactFeatureFlags'; <add>import {enableCreateEventHandleAPI} from 'shared/ReactFeatureFlags'; <ide> <ide> function extractEvents( <ide> dispatchQueue: DispatchQueue, <ide> function extractEvents( <ide> // In the past, React has always bubbled them, but this can be surprising. <ide> // We're going to try aligning closer to the browser behavior by not bubbling <ide> // them in React either. We'll start by not bubbling onScroll, and then expand. <del> let accumulateTargetOnly = false; <del> if (disableOnScrollBubbling) { <del> accumulateTargetOnly = <del> !inCapturePhase && <del> // TODO: ideally, we'd eventually add all events from <del> // nonDelegatedEvents list in DOMPluginEventSystem. <del> // Then we can remove this special list. <del> domEventName === 'scroll'; <del> } <add> const accumulateTargetOnly = <add> !inCapturePhase && <add> // TODO: ideally, we'd eventually add all events from <add> // nonDelegatedEvents list in DOMPluginEventSystem. <add> // Then we can remove this special list. <add> // This is a breaking change that can wait until React 18. <add> domEventName === 'scroll'; <ide> <ide> accumulateSinglePhaseListeners( <ide> targetInst, <ide><path>packages/shared/ReactFeatureFlags.js <ide> export const deferRenderPhaseUpdateToNextBatch = true; <ide> <ide> // Replacement for runWithPriority in React internals. <ide> export const decoupleUpdatePriorityFromScheduler = false; <del> <del>export const disableOnScrollBubbling = true; <ide><path>packages/shared/forks/ReactFeatureFlags.native-fb.js <ide> export const warnAboutSpreadingKeyToJSX = false; <ide> export const enableComponentStackLocations = false; <ide> export const enableLegacyFBSupport = false; <ide> export const enableFilterEmptyStringAttributesDOM = false; <del>export const disableOnScrollBubbling = true; <ide> <ide> export const enableNewReconciler = false; <ide> export const deferRenderPhaseUpdateToNextBatch = true; <ide><path>packages/shared/forks/ReactFeatureFlags.native-oss.js <ide> export const warnAboutSpreadingKeyToJSX = false; <ide> export const enableComponentStackLocations = false; <ide> export const enableLegacyFBSupport = false; <ide> export const enableFilterEmptyStringAttributesDOM = false; <del>export const disableOnScrollBubbling = true; <ide> <ide> export const enableNewReconciler = false; <ide> export const deferRenderPhaseUpdateToNextBatch = true; <ide><path>packages/shared/forks/ReactFeatureFlags.test-renderer.js <ide> export const warnAboutSpreadingKeyToJSX = false; <ide> export const enableComponentStackLocations = true; <ide> export const enableLegacyFBSupport = false; <ide> export const enableFilterEmptyStringAttributesDOM = false; <del>export const disableOnScrollBubbling = true; <ide> <ide> export const enableNewReconciler = false; <ide> export const deferRenderPhaseUpdateToNextBatch = true; <ide><path>packages/shared/forks/ReactFeatureFlags.test-renderer.www.js <ide> export const warnAboutSpreadingKeyToJSX = false; <ide> export const enableComponentStackLocations = true; <ide> export const enableLegacyFBSupport = false; <ide> export const enableFilterEmptyStringAttributesDOM = false; <del>export const disableOnScrollBubbling = true; <ide> <ide> export const enableNewReconciler = false; <ide> export const deferRenderPhaseUpdateToNextBatch = true; <ide><path>packages/shared/forks/ReactFeatureFlags.testing.js <ide> export const warnAboutSpreadingKeyToJSX = false; <ide> export const enableComponentStackLocations = true; <ide> export const enableLegacyFBSupport = false; <ide> export const enableFilterEmptyStringAttributesDOM = false; <del>export const disableOnScrollBubbling = true; <ide> <ide> export const enableNewReconciler = false; <ide> export const deferRenderPhaseUpdateToNextBatch = true; <ide><path>packages/shared/forks/ReactFeatureFlags.testing.www.js <ide> export const warnAboutSpreadingKeyToJSX = false; <ide> export const enableComponentStackLocations = true; <ide> export const enableLegacyFBSupport = !__EXPERIMENTAL__; <ide> export const enableFilterEmptyStringAttributesDOM = false; <del>export const disableOnScrollBubbling = true; <ide> <ide> export const enableNewReconciler = false; <ide> export const deferRenderPhaseUpdateToNextBatch = true; <ide><path>packages/shared/forks/ReactFeatureFlags.www-dynamic.js <ide> export const disableInputAttributeSyncing = __VARIANT__; <ide> export const enableFilterEmptyStringAttributesDOM = __VARIANT__; <ide> export const enableLegacyFBSupport = __VARIANT__; <ide> export const decoupleUpdatePriorityFromScheduler = __VARIANT__; <del>export const disableOnScrollBubbling = __VARIANT__; <ide> <ide> // Enable this flag to help with concurrent mode debugging. <ide> // It logs information to the console about React scheduling, rendering, and commit phases. <ide><path>packages/shared/forks/ReactFeatureFlags.www.js <ide> export const { <ide> decoupleUpdatePriorityFromScheduler, <ide> enableDebugTracing, <ide> enableSchedulingProfilerComponentStacks, <del> disableOnScrollBubbling, <ide> } = dynamicFeatureFlags; <ide> <ide> // On WWW, __EXPERIMENTAL__ is used for a new modern build.
12
Ruby
Ruby
stop printing warning on test-bot
a675aae553949706c54c8868a941373d73909260
<ide><path>Library/Homebrew/cmd/pull.rb <ide> def pull <ide> branch = `git symbolic-ref --short HEAD`.strip <ide> <ide> unless branch == "master" <del> opoo "Current branch is #{branch}: do you need to pull inside master?" <add> opoo "Current branch is #{branch}: do you need to pull inside master?" unless ARGV.include? "--clean" <ide> end <ide> <ide> pull_url url <ide> def pull <ide> "-u#{bintray_user}:#{bintray_key}", "-X", "POST", <ide> "-d", '{"publish_wait_for_secs": -1}', <ide> "https://api.bintray.com/content/homebrew/#{repo}/#{package}/#{version}/publish" <add> sleep 5 <ide> success = system "brew", "fetch", "--retry", "--force-bottle", f.full_name <ide> unless success <del> ohai "That didn't work; waiting for 15 seconds and trying again..." <del> sleep 15 <add> ohai "That didn't work; sleeping another 10 and trying again..." <add> sleep 10 <ide> system "brew", "fetch", "--retry", "--force-bottle", f.full_name <ide> end <ide> end
1
Go
Go
add missed defer to unlock
56175d6f97e06202d17f1809e2c5a3ab16f33a0f
<ide><path>libnetwork/sandbox.go <ide> func (sb *sandbox) Key() string { <ide> <ide> func (sb *sandbox) Labels() map[string]interface{} { <ide> sb.Lock() <del> sb.Unlock() <add> defer sb.Unlock() <ide> opts := make(map[string]interface{}, len(sb.config.generic)) <ide> for k, v := range sb.config.generic { <ide> opts[k] = v
1
PHP
PHP
fix client\response `throw` method
b5f74acc37c9b0372c094afa28b39cb4d64ea0d9
<ide><path>src/Illuminate/Http/Client/Response.php <ide> public function toPsrResponse() <ide> */ <ide> public function throw() <ide> { <del> $callback = func_get_arg(0); <add> $callback = func_get_args()[0] ?? null; <ide> <ide> if ($this->serverError() || $this->clientError()) { <del> if ($callback && is_callable($callback)) { <del> $callback($this, $exception = new RequestException($this)); <del> } <del> <del> throw $exception; <add> throw tap(new RequestException($this), function ($exception) use ($callback) { <add> if ($callback && is_callable($callback)) { <add> $callback($this, $exception); <add> } <add> }); <ide> } <ide> <ide> return $this;
1
Ruby
Ruby
remove duplicated test
b63c2d6bfb9f1e813dda1b339a895b5967eb4ea2
<ide><path>activerecord/test/cases/tasks/mysql_rake_test.rb <ide> def setup <ide> } <ide> end <ide> <del> def test_structure_load <del> filename = "awesome-file.sql" <del> Kernel.expects(:system).with("mysql", "--execute", %{SET FOREIGN_KEY_CHECKS = 0; SOURCE #{filename}; SET FOREIGN_KEY_CHECKS = 1}, "--database", "test-db") <del> .returns(true) <del> <del> ActiveRecord::Tasks::DatabaseTasks.structure_load(@configuration, filename) <del> end <del> <ide> def test_structure_load <ide> filename = "awesome-file.sql" <ide> expected_command = ["mysql", "--execute", %{SET FOREIGN_KEY_CHECKS = 0; SOURCE #{filename}; SET FOREIGN_KEY_CHECKS = 1}, "--database", "test-db", "--noop"]
1
Javascript
Javascript
remove adapter frame from onparserexecute
31addac8bbcd3e0a8cefba8327cfcc7fd9bdeb68
<ide><path>lib/_http_server.js <ide> function socketOnData(server, socket, parser, state, d) { <ide> onParserExecuteCommon(server, socket, parser, state, ret, d); <ide> } <ide> <del>function onParserExecute(server, socket, parser, state, ret, d) { <add>function onParserExecute(server, socket, parser, state, ret) { <ide> socket._unrefTimer(); <ide> debug('SERVER socketOnParserExecute %d', ret); <ide> onParserExecuteCommon(server, socket, parser, state, ret, undefined);
1
Ruby
Ruby
fix typos in im documentation
a4765f74cd12ad708056805b7fe46b14be885454
<ide><path>activerecord/lib/active_record/identity_map.rb <ide> module ActiveRecord <ide> # the comment object intact. However, once we enable Identity Map, the post loaded <ide> # by Post.destroy is exactly the same object as the object @post. As the object @post <ide> # still has the comment object in @post.comments, once Identity Map is enabled, the <del> # comment object will be acciddently removed. <add> # comment object will be accidently removed. <ide> # <del> # This incosistency is meant to be fixed in future Rails releases. <add> # This inconsistency is meant to be fixed in future Rails releases. <ide> # <ide> module IdentityMap <ide>
1
Ruby
Ruby
set autocrlf to false
63c0a9fa92c100e505cc2a53e752b5a448c61473
<ide><path>Library/Homebrew/tap.rb <ide> def install(options = {}) <ide> Utils.ensure_git_installed! <ide> ohai "Tapping #{name}" unless quiet <ide> remote = options[:clone_target] || "https://github.com/#{user}/homebrew-#{repo}" <del> args = %W[clone #{remote} #{path}] <add> args = %W[clone #{remote} #{path} --config core.autocrlf=false] <ide> args << "--depth=1" unless options.fetch(:full_clone, false) <ide> args << "-q" if quiet <ide>
1
Mixed
Ruby
add error logging to active job
452f9ee0bcca071cb520d3d640acebdc91f5e3ef
<ide><path>activejob/CHANGELOG.md <add>* Change logging instrumentation to log errors when a job raises an exception. <add> <add> Fixes #26848. <add> <add> *Steven Bull* <add> <ide> Please check [5-1-stable](https://github.com/rails/rails/blob/5-1-stable/activejob/CHANGELOG.md) for previous changes. <ide><path>activejob/lib/active_job/logging.rb <ide> def perform_start(event) <ide> end <ide> <ide> def perform(event) <del> info do <del> job = event.payload[:job] <del> "Performed #{job.class.name} (Job ID: #{job.job_id}) from #{queue_name(event)} in #{event.duration.round(2)}ms" <add> job = event.payload[:job] <add> ex = event.payload[:exception_object] <add> if ex <add> error do <add> "Error performing #{job.class.name} (Job ID: #{job.job_id}) from #{queue_name(event)} in #{event.duration.round(2)}ms: #{ex.class} (#{ex.message}):\n" + Array(ex.backtrace).join("\n") <add> end <add> else <add> info do <add> "Performed #{job.class.name} (Job ID: #{job.job_id}) from #{queue_name(event)} in #{event.duration.round(2)}ms" <add> end <ide> end <ide> end <ide> <ide><path>activejob/test/cases/logging_test.rb <ide> def test_for_tagged_logger_support_is_consistent <ide> set_logger ::Logger.new(nil) <ide> OverriddenLoggingJob.perform_later "Dummy" <ide> end <add> <add> def test_job_error_logging <add> RescueJob.perform_later "other" <add> rescue RescueJob::OtherError <add> assert_match(/Performing RescueJob \(Job ID: .*?\) from .*? with arguments:.*other/, @logger.messages) <add> assert_match(/Error performing RescueJob \(Job ID: .*?\) from .*? in .*ms: RescueJob::OtherError \(Bad hair\):\n.*\brescue_job\.rb:\d+:in `perform'/, @logger.messages) <add> end <ide> end <ide><path>activejob/test/jobs/rescue_job.rb <ide> def perform(person = "david") <ide> when "david" <ide> raise ArgumentError, "Hair too good" <ide> when "other" <del> raise OtherError <add> raise OtherError, "Bad hair" <ide> else <ide> JobBuffer.add("performed beautifully") <ide> end <ide><path>activesupport/lib/active_support/notifications.rb <ide> module ActiveSupport <ide> # If an exception happens during that particular instrumentation the payload will <ide> # have a key <tt>:exception</tt> with an array of two elements as value: a string with <ide> # the name of the exception class, and the exception message. <add> # The <tt>:exception_object</tt> key of the payload will have the exception <add> # itself as the value. <ide> # <ide> # As the previous example depicts, the class <tt>ActiveSupport::Notifications::Event</tt> <ide> # is able to take the arguments as they come and provide an object-oriented
5
PHP
PHP
model()
e1800bd62de541df76945c59ad3454009a170394
<ide><path>src/Illuminate/Html/FormBuilder.php <ide> public function open(array $options = array()) <ide> * @param array $options <ide> * @return string <ide> */ <del> public function model($model, array $options) <add> public function model($model, array $options = array()) <ide> { <ide> $this->model = $model; <ide>
1
Javascript
Javascript
show hidden item count
755520c4c3f9e1f85268d65ca647dec076e9a17a
<ide><path>lib/buffer.js <ide> Buffer.prototype[customInspectSymbol] = function inspect() { <ide> var str = ''; <ide> var max = exports.INSPECT_MAX_BYTES; <ide> str = this.toString('hex', 0, max).replace(/(.{2})/g, '$1 ').trim(); <del> if (this.length > max) <del> str += ' ... '; <add> const remaining = this.length - max; <add> if (remaining > 0) <add> str += ` ... ${remaining} more byte${remaining > 1 ? 's' : ''}`; <ide> return `<${this.constructor.name} ${str}>`; <ide> }; <ide> Buffer.prototype.inspect = Buffer.prototype[customInspectSymbol]; <ide><path>test/parallel/test-buffer-inspect.js <ide> b.fill('1234'); <ide> let s = buffer.SlowBuffer(4); <ide> s.fill('1234'); <ide> <del>let expected = '<Buffer 31 32 ... >'; <add>let expected = '<Buffer 31 32 ... 2 more bytes>'; <ide> <ide> assert.strictEqual(util.inspect(b), expected); <ide> assert.strictEqual(util.inspect(s), expected); <ide><path>test/parallel/test-buffer-prototype-inspect.js <ide> const util = require('util'); <ide> <ide> { <ide> const buf = Buffer.from('x'.repeat(51)); <del> assert.ok(/^<Buffer (?:78 ){50}\.\.\. >$/.test(util.inspect(buf))); <add> assert.ok(/^<Buffer (?:78 ){50}\.\.\. 1 more byte>$/.test(util.inspect(buf))); <ide> }
3
Java
Java
enhance test for groupby with evicting map factory
5f452559382bab37efd181071c047f260fd26fd1
<ide><path>src/test/java/io/reactivex/internal/operators/flowable/FlowableGroupByTest.java <ide> public V put(K key, V value) { <ide> //remove first <ide> K k = list.get(0); <ide> list.remove(0); <del> v = map.get(k); <add> v = map.remove(k); <ide> } else { <ide> v = null; <ide> } <ide> public V put(K key, V value) { <ide> <ide> @Override <ide> public V remove(Object key) { <add> list.remove(key); <ide> return map.remove(key); <ide> } <ide> <ide> @Override <ide> public void putAll(Map<? extends K, ? extends V> m) { <del> map.putAll(m); <add> for (Entry<? extends K, ? extends V> entry: m.entrySet()) { <add> put(entry.getKey(), entry.getValue()); <add> } <ide> } <ide> <ide> @Override <ide> public void clear() { <add> list.clear(); <ide> map.clear(); <ide> } <ide>
1
PHP
PHP
declare $selector property
7dc8d71494f186478fce8d65b725b5b7f5104a08
<ide><path>src/Illuminate/Translation/Translator.php <ide> class Translator extends NamespacedItemResolver implements TranslatorInterface <ide> */ <ide> protected $loaded = []; <ide> <add> /** <add> * The message selector. <add> * <add> * @var \Symfony\Component\Translation\MessageSelector <add> */ <add> protected $selector; <add> <ide> /** <ide> * Create a new translator instance. <ide> *
1
Javascript
Javascript
fix fillratehelper accessing -1 frame
052617611d68042b0c228955ed5de10a07da203a
<ide><path>Libraries/Lists/FillRateHelper.js <ide> class FillRateHelper { <ide> initialNumToRender?: ?number, <ide> ... <ide> }, <del> state: { <add> cellsAroundViewport: { <ide> first: number, <ide> last: number, <ide> ... <ide> class FillRateHelper { <ide> if ( <ide> !this._enabled || <ide> props.getItemCount(props.data) === 0 || <add> cellsAroundViewport.last < cellsAroundViewport.first || <ide> this._samplesStartTime == null <ide> ) { <ide> return 0; <ide> class FillRateHelper { <ide> this._mostlyBlankStartTime = null; <ide> <ide> let blankTop = 0; <del> let first = state.first; <add> let first = cellsAroundViewport.first; <ide> let firstFrame = this._getFrameMetrics(first, props); <del> while (first <= state.last && (!firstFrame || !firstFrame.inLayout)) { <add> while ( <add> first <= cellsAroundViewport.last && <add> (!firstFrame || !firstFrame.inLayout) <add> ) { <ide> firstFrame = this._getFrameMetrics(first, props); <ide> first++; <ide> } <ide> class FillRateHelper { <ide> ); <ide> } <ide> let blankBottom = 0; <del> let last = state.last; <add> let last = cellsAroundViewport.last; <ide> let lastFrame = this._getFrameMetrics(last, props); <del> while (last >= state.first && (!lastFrame || !lastFrame.inLayout)) { <add> while ( <add> last >= cellsAroundViewport.first && <add> (!lastFrame || !lastFrame.inLayout) <add> ) { <ide> lastFrame = this._getFrameMetrics(last, props); <ide> last--; <ide> }
1
Go
Go
fix typos in comment
8df0b2de5427f535c8d85157196388d8eef61ff6
<ide><path>daemon/cluster/executor/container/controller.go <ide> func (r *controller) Logs(ctx context.Context, publisher exec.LogPublisher, opti <ide> } <ide> <ide> if msg.Err != nil { <del> // the defered cancel closes the adapter's log stream <add> // the deferred cancel closes the adapter's log stream <ide> return msg.Err <ide> } <ide> <ide><path>daemon/graphdriver/lcow/lcow.go <ide> func (d *Driver) Get(id, mountLabel string) (containerfs.ContainerFS, error) { <ide> title := fmt.Sprintf("lcowdriver: get: %s", id) <ide> logrus.Debugf(title) <ide> <del> // Generate the mounts needed for the defered operation. <add> // Generate the mounts needed for the deferred operation. <ide> disks, err := d.getAllMounts(id) <ide> if err != nil { <ide> logrus.Debugf("%s failed to get all layer details for %s: %s", title, d.dir(id), err) <ide><path>daemon/oci_linux_test.go <ide> func TestTmpfsDevShmNoDupMount(t *testing.T) { <ide> }, <ide> } <ide> <del> // Mimick the code flow of daemon.createSpec(), enough to reproduce the issue <add> // Mimic the code flow of daemon.createSpec(), enough to reproduce the issue <ide> ms, err := d.setupMounts(c) <ide> assert.Check(t, err) <ide>
3
Python
Python
simplify tests and avoid tokenizing
6bbf4ea309263913229686b42017cde83440e105
<ide><path>spacy/tests/doc/test_array.py <ide> # coding: utf-8 <ide> from __future__ import unicode_literals <ide> <add>from spacy.tokens import Doc <ide> from spacy.attrs import ORTH, SHAPE, POS, DEP <ide> <ide> from ..util import get_doc <ide> <ide> <del>def test_doc_array_attr_of_token(en_tokenizer, en_vocab): <del> text = "An example sentence" <del> tokens = en_tokenizer(text) <del> example = tokens.vocab["example"] <add>def test_doc_array_attr_of_token(en_vocab): <add> doc = Doc(en_vocab, words=["An", "example", "sentence"]) <add> example = doc.vocab["example"] <ide> assert example.orth != example.shape <del> feats_array = tokens.to_array((ORTH, SHAPE)) <add> feats_array = doc.to_array((ORTH, SHAPE)) <ide> assert feats_array[0][0] != feats_array[0][1] <ide> assert feats_array[0][0] != feats_array[0][1] <ide> <ide> <del>def test_doc_stringy_array_attr_of_token(en_tokenizer, en_vocab): <del> text = "An example sentence" <del> tokens = en_tokenizer(text) <del> example = tokens.vocab["example"] <add>def test_doc_stringy_array_attr_of_token(en_vocab): <add> doc = Doc(en_vocab, words=["An", "example", "sentence"]) <add> example = doc.vocab["example"] <ide> assert example.orth != example.shape <del> feats_array = tokens.to_array((ORTH, SHAPE)) <del> feats_array_stringy = tokens.to_array(("ORTH", "SHAPE")) <add> feats_array = doc.to_array((ORTH, SHAPE)) <add> feats_array_stringy = doc.to_array(("ORTH", "SHAPE")) <ide> assert feats_array_stringy[0][0] == feats_array[0][0] <ide> assert feats_array_stringy[0][1] == feats_array[0][1] <ide> <ide> <del>def test_doc_scalar_attr_of_token(en_tokenizer, en_vocab): <del> text = "An example sentence" <del> tokens = en_tokenizer(text) <del> example = tokens.vocab["example"] <add>def test_doc_scalar_attr_of_token(en_vocab): <add> doc = Doc(en_vocab, words=["An", "example", "sentence"]) <add> example = doc.vocab["example"] <ide> assert example.orth != example.shape <del> feats_array = tokens.to_array(ORTH) <add> feats_array = doc.to_array(ORTH) <ide> assert feats_array.shape == (3,) <ide> <ide> <del>def test_doc_array_tag(en_tokenizer): <del> text = "A nice sentence." <add>def test_doc_array_tag(en_vocab): <add> words = ["A", "nice", "sentence", "."] <ide> pos = ["DET", "ADJ", "NOUN", "PUNCT"] <del> tokens = en_tokenizer(text) <del> doc = get_doc(tokens.vocab, words=[t.text for t in tokens], pos=pos) <add> doc = get_doc(en_vocab, words=words, pos=pos) <ide> assert doc[0].pos != doc[1].pos != doc[2].pos != doc[3].pos <ide> feats_array = doc.to_array((ORTH, POS)) <ide> assert feats_array[0][1] == doc[0].pos <ide> def test_doc_array_tag(en_tokenizer): <ide> assert feats_array[3][1] == doc[3].pos <ide> <ide> <del>def test_doc_array_dep(en_tokenizer): <del> text = "A nice sentence." <add>def test_doc_array_dep(en_vocab): <add> words = ["A", "nice", "sentence", "."] <ide> deps = ["det", "amod", "ROOT", "punct"] <del> tokens = en_tokenizer(text) <del> doc = get_doc(tokens.vocab, words=[t.text for t in tokens], deps=deps) <add> doc = get_doc(en_vocab, words=words, deps=deps) <ide> feats_array = doc.to_array((ORTH, DEP)) <ide> assert feats_array[0][1] == doc[0].dep <ide> assert feats_array[1][1] == doc[1].dep
1
Java
Java
remove unused declarations
9a585a7d69cd29e340d8dea42a37ba88bb1c1d68
<ide><path>src/main/java/io/reactivex/Scheduler.java <ide> public long now(TimeUnit unit) { <ide> * of this task has to happen (accounting for clock drifts). <ide> */ <ide> final class PeriodicTask implements Runnable { <del> final long firstStartInNanoseconds; <ide> final Runnable decoratedRun; <del> final long firstNowNanoseconds; <ide> final SequentialDisposable sd; <ide> final long periodInNanoseconds; <ide> long count; <ide> final class PeriodicTask implements Runnable { <ide> <ide> PeriodicTask(long firstStartInNanoseconds, Runnable decoratedRun, <ide> long firstNowNanoseconds, SequentialDisposable sd, long periodInNanoseconds) { <del> this.firstStartInNanoseconds = firstStartInNanoseconds; <ide> this.decoratedRun = decoratedRun; <del> this.firstNowNanoseconds = firstNowNanoseconds; <ide> this.sd = sd; <ide> this.periodInNanoseconds = periodInNanoseconds; <ide> lastNowNanoseconds = firstNowNanoseconds; <ide><path>src/main/java/io/reactivex/internal/operators/completable/CompletableConcatIterable.java <ide> static final class ConcatInnerObserver extends AtomicInteger implements Completa <ide> final CompletableObserver actual; <ide> final Iterator<? extends CompletableSource> sources; <ide> <del> int index; <del> <ide> final SequentialDisposable sd; <ide> <ide> public ConcatInnerObserver(CompletableObserver actual, Iterator<? extends CompletableSource> sources) { <ide><path>src/main/java/io/reactivex/internal/operators/flowable/FlowableDebounce.java <ide> protected void subscribeActual(Subscriber<? super T> s) { <ide> final Subscriber<? super T> actual; <ide> final Function<? super T, ? extends Publisher<U>> debounceSelector; <ide> <del> volatile boolean gate; <del> <ide> Subscription s; <ide> <ide> final AtomicReference<Disposable> debouncer = new AtomicReference<Disposable>(); <ide><path>src/main/java/io/reactivex/internal/operators/flowable/FlowableFromArray.java <ide> public FlowableFromArray(T[] array) { <ide> this.array = array; <ide> } <del> public T[] array() { <del> return array; // NOPMD <del> } <ide> @Override <ide> public void subscribeActual(Subscriber<? super T> s) { <ide> if (s instanceof ConditionalSubscriber) { <ide><path>src/main/java/io/reactivex/internal/operators/flowable/FlowablePublishMulticast.java <ide> public void cancel() { <ide> <ide> final int prefetch; <ide> <del> final int limit; <del> <ide> final boolean delayError; <ide> <ide> final AtomicReference<Subscription> s; <ide> public void cancel() { <ide> public MulticastProcessor(int prefetch, boolean delayError) { <ide> this.prefetch = prefetch; <ide> this.delayError = delayError; <del> this.limit = prefetch - (prefetch >> 2); <ide> this.wip = new AtomicInteger(); <ide> this.s = new AtomicReference<Subscription>(); <ide> this.subscribers = new AtomicReference<MulticastSubscription<T>[]>(EMPTY); <ide><path>src/main/java/io/reactivex/internal/operators/maybe/MaybeFlatMapCompletable.java <ide> protected void subscribeActual(CompletableObserver s) { <ide> <ide> final Function<? super T, ? extends CompletableSource> mapper; <ide> <del> Disposable d; <del> <ide> public FlatMapCompletableObserver(CompletableObserver actual, <ide> Function<? super T, ? extends CompletableSource> mapper) { <ide> this.actual = actual; <ide><path>src/main/java/io/reactivex/internal/operators/observable/ObservableCombineLatest.java <ide> public void subscribeActual(Observer<? super R> s) { <ide> private static final long serialVersionUID = 8567835998786448817L; <ide> final Observer<? super R> actual; <ide> final Function<? super Object[], ? extends R> combiner; <del> final int count; <ide> final CombinerSubscriber<T, R>[] subscribers; <del> final int bufferSize; <ide> final T[] latest; <ide> final SpscLinkedArrayQueue<Object> queue; <ide> final boolean delayError; <ide> public LatestCoordinator(Observer<? super R> actual, <ide> int count, int bufferSize, boolean delayError) { <ide> this.actual = actual; <ide> this.combiner = combiner; <del> this.count = count; <del> this.bufferSize = bufferSize; <ide> this.delayError = delayError; <ide> this.latest = (T[])new Object[count]; <ide> this.subscribers = new CombinerSubscriber[count]; <ide><path>src/main/java/io/reactivex/internal/operators/observable/ObservableDebounce.java <ide> public void subscribeActual(Observer<? super T> t) { <ide> final Observer<? super T> actual; <ide> final Function<? super T, ? extends ObservableSource<U>> debounceSelector; <ide> <del> volatile boolean gate; <del> <ide> Disposable s; <ide> <ide> final AtomicReference<Disposable> debouncer = new AtomicReference<Disposable>(); <ide><path>src/main/java/io/reactivex/internal/operators/observable/ObservableFromArray.java <ide> public ObservableFromArray(T[] array) { <ide> this.array = array; <ide> } <del> public T[] array() { <del> return array; // NOPMD <del> } <ide> @Override <ide> public void subscribeActual(Observer<? super T> s) { <ide> FromArrayDisposable<T> d = new FromArrayDisposable<T>(s, array); <ide><path>src/main/java/io/reactivex/internal/operators/observable/ObservableMapNotification.java <ide> public void subscribeActual(Observer<? super ObservableSource<? extends R>> t) { <ide> <ide> Disposable s; <ide> <del> Observable<? extends R> value; <del> <del> volatile boolean done; <del> <ide> public MapNotificationSubscriber(Observer<? super ObservableSource<? extends R>> actual, <ide> Function<? super T, ? extends ObservableSource<? extends R>> onNextMapper, <ide> Function<? super Throwable, ? extends ObservableSource<? extends R>> onErrorMapper, <ide><path>src/main/java/io/reactivex/internal/operators/observable/ObservableMaterialize.java <ide> public void subscribeActual(Observer<? super Notification<T>> t) { <ide> <ide> Disposable s; <ide> <del> volatile boolean done; <del> <ide> public MaterializeSubscriber(Observer<? super Notification<T>> actual) { <ide> this.actual = actual; <ide> } <ide><path>src/main/java/io/reactivex/internal/operators/observable/ObservableObserveOn.java <ide> static class Padding0 extends AtomicInteger { <ide> final Observer<? super T> actual; <ide> final Scheduler.Worker worker; <ide> final boolean delayError; <del> final int bufferSize; <ide> final SpscLinkedArrayQueue<T> queue; <ide> <ide> Disposable s; <ide> public ObserveOnSubscriber(Observer<? super T> actual, Scheduler.Worker worker, <ide> this.actual = actual; <ide> this.worker = worker; <ide> this.delayError = delayError; <del> this.bufferSize = bufferSize; <ide> this.queue = new SpscLinkedArrayQueue<T>(bufferSize); <ide> } <ide> <ide><path>src/main/java/io/reactivex/internal/operators/observable/ObservableOnErrorReturn.java <ide> public void subscribeActual(Observer<? super T> t) { <ide> <ide> Disposable s; <ide> <del> volatile boolean done; <del> <ide> public OnErrorReturnSubscriber(Observer<? super T> actual, Function<? super Throwable, ? extends T> valueSupplier) { <ide> this.actual = actual; <ide> this.valueSupplier = valueSupplier; <ide> public void onNext(T t) { <ide> <ide> @Override <ide> public void onError(Throwable t) { <del> done = true; <ide> T v; <ide> try { <ide> v = valueSupplier.apply(t); <ide><path>src/main/java/io/reactivex/internal/operators/observable/ObservablePublish.java <ide> public void connect(Consumer<? super Disposable> connection) { <ide> final SpscLinkedArrayQueue<Object> queue; <ide> /** Holds onto the current connected PublishSubscriber. */ <ide> final AtomicReference<PublishSubscriber<T>> current; <del> /** The prefetch buffer size. */ <del> final int bufferSize; <ide> /** Contains either an onCompleted or an onError token from upstream. */ <ide> volatile Object terminalEvent; <ide> <ide> public PublishSubscriber(AtomicReference<PublishSubscriber<T>> current, int buff <ide> this.producers = new AtomicReference<InnerProducer[]>(EMPTY); <ide> this.current = current; <ide> this.shouldConnect = new AtomicBoolean(); <del> this.bufferSize = bufferSize; <ide> } <ide> <ide> @Override <ide><path>src/main/java/io/reactivex/internal/operators/observable/ObservableReplay.java <ide> public void connect(Consumer<? super Disposable> connection) { <ide> */ <ide> final AtomicBoolean shouldConnect; <ide> <del> /** Guarded by this. */ <del> boolean emitting; <del> /** Guarded by this. */ <del> boolean missed; <del> <del> <ide> /** The upstream producer. */ <ide> volatile Disposable subscription; <ide> <ide><path>src/main/java/io/reactivex/internal/operators/observable/ObservableSequenceEqual.java <ide> void drain() { <ide> volatile boolean done; <ide> Throwable error; <ide> <del> Disposable s; <del> <ide> public EqualSubscriber(EqualCoordinator<T> parent, int index, int bufferSize) { <ide> this.parent = parent; <ide> this.index = index; <ide> public EqualSubscriber(EqualCoordinator<T> parent, int index, int bufferSize) { <ide> <ide> @Override <ide> public void onSubscribe(Disposable s) { <del> if (parent.setSubscription(s, index)) { <del> this.s = s; <del> } <add> parent.setSubscription(s, index); <ide> } <ide> <ide> @Override <ide><path>src/main/java/io/reactivex/internal/operators/observable/ObservableSwitchMap.java <ide> void innerError(SwitchMapInnerSubscriber<T, R> inner, Throwable ex) { <ide> private static final long serialVersionUID = 3837284832786408377L; <ide> final SwitchMapSubscriber<T, R> parent; <ide> final long index; <del> final int bufferSize; <ide> final SpscArrayQueue<R> queue; <ide> <ide> volatile boolean done; <ide> <ide> public SwitchMapInnerSubscriber(SwitchMapSubscriber<T, R> parent, long index, int bufferSize) { <ide> this.parent = parent; <ide> this.index = index; <del> this.bufferSize = bufferSize; <ide> this.queue = new SpscArrayQueue<R>(bufferSize); <ide> } <ide> <ide><path>src/main/java/io/reactivex/internal/operators/observable/ObservableTakeLast.java <ide> public void subscribeActual(Observer<? super T> t) { <ide> <ide> Disposable s; <ide> <del> volatile boolean done; <ide> volatile boolean cancelled; <ide> <ide> public TakeLastSubscriber(Observer<? super T> actual, int count) { <ide> public void onError(Throwable t) { <ide> <ide> @Override <ide> public void onComplete() { <del> done = true; <ide> if (cancelled) { <ide> return; <ide> } <ide><path>src/main/java/io/reactivex/internal/operators/single/SingleFlatMapCompletable.java <ide> protected void subscribeActual(CompletableObserver s) { <ide> <ide> final Function<? super T, ? extends CompletableSource> mapper; <ide> <del> Disposable d; <del> <ide> public FlatMapCompletableObserver(CompletableObserver actual, <ide> Function<? super T, ? extends CompletableSource> mapper) { <ide> this.actual = actual;
19
Python
Python
provide default output for evaluate in cli
ec819fc311f3795b10a6a42193acf1b6e3e0d787
<ide><path>spacy/cli/evaluate.py <ide> def evaluate_cli( <ide> def evaluate( <ide> model: str, <ide> data_path: Path, <del> output: Optional[Path], <add> output: Optional[Path] = None, <ide> gpu_id: int = -1, <ide> gold_preproc: bool = False, <ide> displacy_path: Optional[Path] = None,
1
Ruby
Ruby
use new requirement syntax
a03bbf5797143a5acff5e2e21969d16c6afe81b8
<ide><path>Library/Homebrew/requirements.rb <ide> def initialize language, module_name, import_name=nil <ide> @import_name = import_name || module_name <ide> end <ide> <del> def satisfied? <del> quiet_system(*the_test) <del> end <add> satisfy { quiet_system(*the_test) } <ide> <ide> def message; <<-EOS.undent <ide> Unsatisfied dependency: #{@module_name} <ide> def initialize(*tags) <ide> super <ide> end <ide> <del> def satisfied? <del> MacOS::XQuartz.installed? and (@min_version.nil? or @min_version <= MacOS::XQuartz.version) <add> satisfy :build_env => false do <add> MacOS::XQuartz.installed? && (@min_version.nil? || @min_version <= MacOS::XQuartz.version) <ide> end <ide> <ide> def message; <<-EOS.undent <ide> def mpi_wrapper_works? compiler <ide> quiet_system compiler, '--version' <ide> end <ide> <del> def satisfied? <del> # we have to assure the ENV is (almost) as during the build <del> require 'superenv' <del> ENV.with_build_environment do <del> ENV.userpaths! <del> <del> @lang_list.each do |lang| <del> case lang <del> when :cc, :cxx, :f90, :f77 <del> compiler = 'mpi' + lang.to_s <del> @non_functional << compiler unless mpi_wrapper_works? compiler <del> else <del> @unknown_langs << lang.to_s <del> end <add> satisfy do <add> @lang_list.each do |lang| <add> case lang <add> when :cc, :cxx, :f90, :f77 <add> compiler = 'mpi' + lang.to_s <add> @non_functional << compiler unless mpi_wrapper_works? compiler <add> else <add> @unknown_langs << lang.to_s <ide> end <ide> end <ide> @unknown_langs.empty? and @non_functional.empty? <ide> def message <ide> message <ide> end <ide> <del> def satisfied? <add> satisfy :build_env => false do <ide> keg = Formula.factory(@formula).prefix <ide> not keg.exist? && Keg.new(keg).linked? <ide> end <ide> def satisfied? <ide> class XcodeDependency < Requirement <ide> fatal true <ide> <del> def satisfied? <del> MacOS::Xcode.installed? <del> end <add> satisfy(:build_env => false) { MacOS::Xcode.installed? } <ide> <ide> def message; <<-EOS.undent <ide> A full installation of Xcode.app is required to compile this software. <ide> def message; <<-EOS.undent <ide> <ide> class MysqlInstalled < Requirement <ide> fatal true <add> env :userpaths <ide> <del> def satisfied? <del> which 'mysql_config' <del> end <add> satisfy { which 'mysql_config' } <ide> <ide> def message; <<-EOS.undent <ide> MySQL is required to install. <ide> def message; <<-EOS.undent <ide> <ide> class PostgresqlInstalled < Requirement <ide> fatal true <add> env :userpaths <ide> <del> def satisfied? <del> which 'pg_config' <del> end <add> satisfy { which 'pg_config' } <ide> <ide> def message <ide> <<-EOS.undent <ide> class TeXInstalled < Requirement <ide> fatal true <ide> env :userpaths <ide> <del> def satisfied? <del> tex = which 'tex' <del> latex = which 'latex' <del> not tex.nil? and not latex.nil? <del> end <add> satisfy { which('tex') || which('latex') } <ide> <ide> def message; <<-EOS.undent <ide> A LaTeX distribution is required to install.
1
Ruby
Ruby
add existing prerelease formulae to allowlist
0bf7773a0baef2c925b88445f84867e1ef3bc382
<ide><path>Library/Homebrew/dev-cmd/audit.rb <ide> def get_repo_data(regex) <ide> }.freeze <ide> <ide> GITHUB_PRERELEASE_ALLOWLIST = { <add> "cbmc" => "5.12.6", <add> "elm-format" => "0.8.3", <ide> "gitless" => "0.8.8", <add> "infrakit" => "0.5", <add> "riff" => "0.5.0", <ide> "telegram-cli" => "1.3.1", <add> "volta" => "0.8.6", <ide> }.freeze <ide> <ide> # version_prefix = stable_version_string.sub(/\d+$/, "")
1
Javascript
Javascript
remove intermediate interpolators
49648f31e09e38ae4eb0d8ad5f6e2be84340c74c
<ide><path>examples/js/loaders/GLTFLoader.js <ide> THREE.GLTFLoader = ( function () { <ide> <ide> }; <ide> <del> function createAnimation( name, interps ) { <del> <del> var tracks = []; <del> <del> for ( var i = 0, len = interps.length; i < len; i ++ ) { <del> <del> var interp = interps[ i ]; <del> <del> // KeyframeTrack.optimize() will modify given 'times' and 'values' <del> // buffers before creating a truncated copy to keep. Because buffers may <del> // be reused by other tracks, make copies here. <del> interp.times = THREE.AnimationUtils.arraySlice( interp.times, 0 ); <del> interp.values = THREE.AnimationUtils.arraySlice( interp.values, 0 ); <del> <del> interp.target.updateMatrix(); <del> interp.target.matrixAutoUpdate = true; <del> <del> tracks.push( new THREE.KeyframeTrack( <del> interp.name, <del> interp.times, <del> interp.values, <del> interp.type <del> ) ); <del> <del> } <del> <del> return new THREE.AnimationClip( name, undefined, tracks ); <del> <del> } <del> <ide> /*********************************/ <ide> /********** INTERNALS ************/ <ide> /*********************************/ <ide> THREE.GLTFLoader = ( function () { <ide> <ide> return _each( json.animations, function ( animation, animationId ) { <ide> <del> var interps = []; <add> var tracks = []; <ide> <ide> for ( var channelId in animation.channels ) { <ide> <ide> THREE.GLTFLoader = ( function () { <ide> <ide> if ( node ) { <ide> <del> var interp = { <del> times: inputAccessor.array, <del> values: outputAccessor.array, <del> target: node, <del> type: INTERPOLATION[ sampler.interpolation ], <del> name: node.name + '.' + PATH_PROPERTIES[ target.path ] <del> }; <add> node.updateMatrix(); <add> node.matrixAutoUpdate = true; <add> <add> var TypedKeyframeTrack = PATH_PROPERTIES[ target.path ] === PATH_PROPERTIES.rotation <add> ? THREE.QuaternionKeyframeTrack <add> : THREE.VectorKeyframeTrack; <ide> <del> interps.push( interp ); <add> // KeyframeTrack.optimize() will modify given 'times' and 'values' <add> // buffers before creating a truncated copy to keep. Because buffers may <add> // be reused by other tracks, make copies here. <add> tracks.push( new TypedKeyframeTrack( <add> node.name + '.' + PATH_PROPERTIES[ target.path ], <add> THREE.AnimationUtils.arraySlice( inputAccessor.array, 0 ), <add> THREE.AnimationUtils.arraySlice( outputAccessor.array, 0 ), <add> INTERPOLATION[ sampler.interpolation ] <add> ) ); <ide> <ide> } <ide> <ide> } <ide> <ide> } <ide> <del> return createAnimation( "animation_" + animationId, interps ); <add> return new THREE.AnimationClip( "animation_" + animationId, undefined, tracks ); <ide> <ide> } ); <ide>
1
Java
Java
use correct file options for transferto
ec9193473052de39006f32279d46210899621062
<ide><path>spring-web/src/main/java/org/springframework/http/codec/multipart/DefaultMultipartMessageReader.java <ide> import java.nio.channels.Channel; <ide> import java.nio.charset.Charset; <ide> import java.nio.charset.StandardCharsets; <add>import java.nio.file.OpenOption; <ide> import java.nio.file.Path; <ide> import java.nio.file.StandardOpenOption; <ide> import java.util.Collections; <ide> public String value() { <ide> <ide> private static class DefaultFilePart extends DefaultPart implements FilePart { <ide> <add> private static final OpenOption[] FILE_CHANNEL_OPTIONS = <add> {StandardOpenOption.CREATE, StandardOpenOption.TRUNCATE_EXISTING, StandardOpenOption.WRITE}; <add> <add> <ide> public DefaultFilePart(HttpHeaders headers, DataBuffer body) { <ide> super(headers, body); <ide> } <ide> public String filename() { <ide> <ide> @Override <ide> public Mono<Void> transferTo(Path dest) { <del> return Mono.using(() -> AsynchronousFileChannel.open(dest, StandardOpenOption.WRITE), <add> return Mono.using(() -> AsynchronousFileChannel.open(dest, FILE_CHANNEL_OPTIONS), <ide> this::writeBody, this::close); <ide> } <ide>
1
PHP
PHP
remove trailing space
e222b3b78e01b99e5c9281be33f28da66e1c1be1
<ide><path>lib/Cake/View/View.php <ide> public function renderCache($filename, $timeStart) { <ide> unset($out); <ide> return false; <ide> } else { <del> if ($this->layout === 'xml') { <add> if ($this->layout === 'xml') { <ide> $response->type('xml'); <ide> } <ide> return substr($out, strlen($match[0]));
1
Javascript
Javascript
improve url.parse() compliance with whatwg url
a8225dd9baaf80a813fd951bfe38860f5f95414e
<ide><path>lib/url.js <ide> const { <ide> CHAR_LEFT_CURLY_BRACKET, <ide> CHAR_RIGHT_CURLY_BRACKET, <ide> CHAR_QUESTION_MARK, <del> CHAR_LOWERCASE_A, <del> CHAR_LOWERCASE_Z, <del> CHAR_UPPERCASE_A, <del> CHAR_UPPERCASE_Z, <del> CHAR_DOT, <del> CHAR_0, <del> CHAR_9, <del> CHAR_HYPHEN_MINUS, <del> CHAR_PLUS, <del> CHAR_UNDERSCORE, <ide> CHAR_DOUBLE_QUOTE, <ide> CHAR_SINGLE_QUOTE, <ide> CHAR_PERCENT, <ide> const { <ide> CHAR_GRAVE_ACCENT, <ide> CHAR_VERTICAL_LINE, <ide> CHAR_AT, <add> CHAR_COLON, <ide> } = require('internal/constants'); <ide> <ide> function urlParse(url, parseQueryString, slashesDenoteHost) { <ide> Url.prototype.parse = function parse(url, parseQueryString, slashesDenoteHost) { <ide> function getHostname(self, rest, hostname) { <ide> for (let i = 0; i < hostname.length; ++i) { <ide> const code = hostname.charCodeAt(i); <del> const isValid = (code >= CHAR_LOWERCASE_A && code <= CHAR_LOWERCASE_Z) || <del> code === CHAR_DOT || <del> (code >= CHAR_UPPERCASE_A && code <= CHAR_UPPERCASE_Z) || <del> (code >= CHAR_0 && code <= CHAR_9) || <del> code === CHAR_HYPHEN_MINUS || <del> code === CHAR_PLUS || <del> code === CHAR_UNDERSCORE || <del> code > 127; <del> <del> // Invalid host character <add> const isValid = (code !== CHAR_FORWARD_SLASH && <add> code !== CHAR_BACKWARD_SLASH && <add> code !== CHAR_HASH && <add> code !== CHAR_QUESTION_MARK && <add> code !== CHAR_COLON); <add> <ide> if (!isValid) { <ide> self.hostname = hostname.slice(0, i); <ide> return `/${hostname.slice(i)}${rest}`; <ide><path>test/parallel/test-url-parse-format.js <ide> const parseTests = { <ide> protocol: 'https:', <ide> slashes: true, <ide> auth: null, <del> host: '', <add> host: '*', <ide> port: null, <del> hostname: '', <add> hostname: '*', <ide> hash: null, <ide> search: null, <ide> query: null, <del> pathname: '/*', <del> path: '/*', <del> href: 'https:///*' <add> pathname: '/', <add> path: '/', <add> href: 'https://*/' <ide> }, <ide> <ide> // The following two URLs are the same, but they differ for a capital A. <ide> const parseTests = { <ide> pathname: '/', <ide> path: '/', <ide> href: 'http://example.com/' <del> } <add> }, <add> <add> 'https://evil.com$.example.com': { <add> protocol: 'https:', <add> slashes: true, <add> auth: null, <add> host: 'evil.com$.example.com', <add> port: null, <add> hostname: 'evil.com$.example.com', <add> hash: null, <add> search: null, <add> query: null, <add> pathname: '/', <add> path: '/', <add> href: 'https://evil.com$.example.com/' <add> }, <ide> }; <ide> <ide> for (const u in parseTests) {
2
Ruby
Ruby
fix annotated typo
12701d5a46e378f216398d72c91c40f5da1bccd7
<ide><path>actionpack/lib/action_controller/metal/live.rb <ide> def log_error(exception) <ide> <ide> logger.fatal do <ide> message = +"\n#{exception.class} (#{exception.message}):\n" <del> message << exception.annoted_source_code.to_s if exception.respond_to?(:annoted_source_code) <add> message << exception.annotated_source_code.to_s if exception.respond_to?(:annotated_source_code) <ide> message << " " << exception.backtrace.join("\n ") <ide> "#{message}\n\n" <ide> end <ide><path>actionpack/lib/action_dispatch/middleware/debug_exceptions.rb <ide> def log_error(request, wrapper) <ide> message = [] <ide> message << " " <ide> message << "#{exception.class} (#{exception.message}):" <del> message.concat(exception.annoted_source_code) if exception.respond_to?(:annoted_source_code) <add> message.concat(exception.annotated_source_code) if exception.respond_to?(:annotated_source_code) <ide> message << " " <ide> message.concat(trace) <ide> <ide><path>actionview/lib/action_view/renderer/streaming_template_renderer.rb <ide> def log_error(exception) <ide> return unless logger <ide> <ide> message = +"\n#{exception.class} (#{exception.message}):\n" <del> message << exception.annoted_source_code.to_s if exception.respond_to?(:annoted_source_code) <add> message << exception.annotated_source_code.to_s if exception.respond_to?(:annotated_source_code) <ide> message << " " << exception.backtrace.join("\n ") <ide> logger.fatal("#{message}\n\n") <ide> end <ide><path>actionview/lib/action_view/template/error.rb <ide> def line_number <ide> end <ide> end <ide> <del> def annoted_source_code <add> def annotated_source_code <ide> source_extract(4) <ide> end <ide> <ide> def message <ide> MESSAGE <ide> end <ide> <del> def annoted_source_code <add> def annotated_source_code <ide> @offending_code_string.split("\n").map.with_index(1) { |line, index| <ide> indentation = " " * 4 <ide> "#{index}:#{indentation}#{line}" <ide><path>actionview/test/template/render_test.rb <ide> def test_render_partial_with_hyphen_and_invalid_option_as <ide> def test_render_template_with_syntax_error <ide> e = assert_raises(ActionView::Template::Error) { @view.render(template: "test/syntax_error") } <ide> assert_match %r!syntax!, e.message <del> assert_equal "1: <%= foo(", e.annoted_source_code[0].strip <add> assert_equal "1: <%= foo(", e.annotated_source_code[0].strip <ide> end <ide> <ide> def test_render_partial_with_errors <ide> e = assert_raises(ActionView::Template::Error) { @view.render(partial: "test/raise") } <ide> assert_match %r!method.*doesnt_exist!, e.message <ide> assert_equal "", e.sub_template_message <ide> assert_equal "1", e.line_number <del> assert_equal "1: <%= doesnt_exist %>", e.annoted_source_code[0].strip <add> assert_equal "1: <%= doesnt_exist %>", e.annotated_source_code[0].strip <ide> assert_equal File.expand_path("#{FIXTURE_LOAD_PATH}/test/_raise.html.erb"), e.file_name <ide> end <ide> <ide> def test_render_error_indentation <ide> e = assert_raises(ActionView::Template::Error) { @view.render(partial: "test/raise_indentation") } <del> error_lines = e.annoted_source_code <add> error_lines = e.annotated_source_code <ide> assert_match %r!error\shere!, e.message <ide> assert_equal "11", e.line_number <ide> assert_equal " 9: <p>Ninth paragraph</p>", error_lines.second <ide> def test_render_file_with_errors <ide> assert_match %r!method.*doesnt_exist!, e.message <ide> assert_equal "", e.sub_template_message <ide> assert_equal "1", e.line_number <del> assert_equal "1: <%= doesnt_exist %>", e.annoted_source_code[0].strip <add> assert_equal "1: <%= doesnt_exist %>", e.annotated_source_code[0].strip <ide> assert_equal File.expand_path("#{FIXTURE_LOAD_PATH}/test/_raise.html.erb"), e.file_name <ide> end <ide>
5
Go
Go
fix arg scoping for dockerfiles with multiple from
09f308ce211cd00f24d4e0f8cc797816b4fff1b6
<ide><path>builder/dockerfile/builder.go <ide> type Builder struct { <ide> cmdSet bool <ide> disableCommit bool <ide> cacheBusted bool <del> allowedBuildArgs map[string]bool // list of build-time args that are allowed for expansion/substitution and passing to commands in 'run'. <add> allowedBuildArgs map[string]*string // list of build-time args that are allowed for expansion/substitution and passing to commands in 'run'. <add> allBuildArgs map[string]struct{} // list of all build-time args found during parsing of the Dockerfile <ide> directive parser.Directive <ide> <ide> // TODO: remove once docker.Commit can receive a tag <ide> func NewBuilder(clientCtx context.Context, config *types.ImageBuildOptions, back <ide> if config == nil { <ide> config = new(types.ImageBuildOptions) <ide> } <del> if config.BuildArgs == nil { <del> config.BuildArgs = make(map[string]*string) <del> } <ide> ctx, cancel := context.WithCancel(clientCtx) <ide> b = &Builder{ <ide> clientCtx: ctx, <ide> func NewBuilder(clientCtx context.Context, config *types.ImageBuildOptions, back <ide> runConfig: new(container.Config), <ide> tmpContainers: map[string]struct{}{}, <ide> id: stringid.GenerateNonCryptoID(), <del> allowedBuildArgs: make(map[string]bool), <add> allowedBuildArgs: make(map[string]*string), <add> allBuildArgs: make(map[string]struct{}), <ide> directive: parser.Directive{ <ide> EscapeSeen: false, <ide> LookingForDirectives: true, <ide> func (b *Builder) build(stdout io.Writer, stderr io.Writer, out io.Writer) (stri <ide> func (b *Builder) warnOnUnusedBuildArgs() { <ide> leftoverArgs := []string{} <ide> for arg := range b.options.BuildArgs { <del> if !b.isBuildArgAllowed(arg) { <add> if _, ok := b.allBuildArgs[arg]; !ok { <ide> leftoverArgs = append(leftoverArgs, arg) <ide> } <ide> } <ide><path>builder/dockerfile/dispatchers.go <ide> func from(b *Builder, args []string, attributes map[string]bool, original string <ide> <ide> var image builder.Image <ide> <add> b.noBaseImage = false <add> <ide> // Windows cannot support a container with no base image. <ide> if name == api.NoBaseImageSpecifier { <ide> if runtime.GOOS == "windows" { <ide> func from(b *Builder, args []string, attributes map[string]bool, original string <ide> } <ide> b.from = image <ide> <add> b.allowedBuildArgs = make(map[string]*string) <add> <ide> return b.processImageFrom(image) <ide> } <ide> <ide> func arg(b *Builder, args []string, attributes map[string]bool, original string) <ide> hasDefault = false <ide> } <ide> // add the arg to allowed list of build-time args from this step on. <del> b.allowedBuildArgs[name] = true <add> b.allBuildArgs[name] = struct{}{} <ide> <del> // If there is a default value associated with this arg then add it to the <del> // b.buildArgs if one is not already passed to the builder. The args passed <del> // to builder override the default value of 'arg'. Note that a 'nil' for <del> // a value means that the user specified "--build-arg FOO" and "FOO" wasn't <del> // defined as an env var - and in that case we DO want to use the default <del> // value specified in the ARG cmd. <del> if baValue, ok := b.options.BuildArgs[name]; (!ok || baValue == nil) && hasDefault { <del> b.options.BuildArgs[name] = &newValue <add> var value *string <add> if hasDefault { <add> value = &newValue <ide> } <add> b.allowedBuildArgs[name] = value <ide> <ide> return b.commit("", b.runConfig.Cmd, fmt.Sprintf("ARG %s", arg)) <ide> } <ide><path>builder/dockerfile/dispatchers_test.go <ide> func TestStopSignal(t *testing.T) { <ide> } <ide> <ide> func TestArg(t *testing.T) { <add> // This is a bad test that tests implementation details and not at <add> // any features of the builder. Replace or remove. <ide> buildOptions := &types.ImageBuildOptions{BuildArgs: make(map[string]*string)} <ide> <del> b := &Builder{flags: &BFlags{}, runConfig: &container.Config{}, disableCommit: true, allowedBuildArgs: make(map[string]bool), options: buildOptions} <add> b := &Builder{flags: &BFlags{}, runConfig: &container.Config{}, disableCommit: true, allowedBuildArgs: make(map[string]*string), allBuildArgs: make(map[string]struct{}), options: buildOptions} <ide> <ide> argName := "foo" <ide> argVal := "bar" <ide> func TestArg(t *testing.T) { <ide> t.Fatalf("Error should be empty, got: %s", err.Error()) <ide> } <ide> <del> allowed, ok := b.allowedBuildArgs[argName] <del> <del> if !ok { <del> t.Fatalf("%s argument should be allowed as a build arg", argName) <del> } <del> <del> if !allowed { <del> t.Fatalf("%s argument was present in map but disallowed as a build arg", argName) <del> } <del> <del> val, ok := b.options.BuildArgs[argName] <add> value, ok := b.getBuildArg(argName) <ide> <ide> if !ok { <ide> t.Fatalf("%s argument should be a build arg", argName) <ide> } <ide> <del> if *val != "bar" { <del> t.Fatalf("%s argument should have default value 'bar', got %s", argName, *val) <add> if value != "bar" { <add> t.Fatalf("%s argument should have default value 'bar', got %s", argName, value) <ide> } <ide> } <ide> <ide><path>builder/dockerfile/evaluator.go <ide> func (b *Builder) buildArgsWithoutConfigEnv() []string { <ide> envs := []string{} <ide> configEnv := runconfigopts.ConvertKVStringsToMap(b.runConfig.Env) <ide> <del> for key, val := range b.options.BuildArgs { <del> if !b.isBuildArgAllowed(key) { <del> // skip build-args that are not in allowed list, meaning they have <del> // not been defined by an "ARG" Dockerfile command yet. <del> // This is an error condition but only if there is no "ARG" in the entire <del> // Dockerfile, so we'll generate any necessary errors after we parsed <del> // the entire file (see 'leftoverArgs' processing in evaluator.go ) <del> continue <del> } <del> if _, ok := configEnv[key]; !ok && val != nil { <del> envs = append(envs, fmt.Sprintf("%s=%s", key, *val)) <add> for key, val := range b.getBuildArgs() { <add> if _, ok := configEnv[key]; !ok { <add> envs = append(envs, fmt.Sprintf("%s=%s", key, val)) <ide> } <ide> } <ide> return envs <ide><path>builder/dockerfile/internals.go <ide> func (b *Builder) parseDockerfile() error { <ide> return nil <ide> } <ide> <del>// determine if build arg is part of built-in args or user <del>// defined args in Dockerfile at any point in time. <del>func (b *Builder) isBuildArgAllowed(arg string) bool { <del> if _, ok := BuiltinAllowedBuildArgs[arg]; ok { <del> return true <add>func (b *Builder) getBuildArg(arg string) (string, bool) { <add> defaultValue, defined := b.allowedBuildArgs[arg] <add> _, builtin := BuiltinAllowedBuildArgs[arg] <add> if defined || builtin { <add> if v, ok := b.options.BuildArgs[arg]; ok && v != nil { <add> return *v, ok <add> } <add> } <add> if defaultValue == nil { <add> return "", false <add> } <add> return *defaultValue, defined <add>} <add> <add>func (b *Builder) getBuildArgs() map[string]string { <add> m := make(map[string]string) <add> for arg := range b.options.BuildArgs { <add> v, ok := b.getBuildArg(arg) <add> if ok { <add> m[arg] = v <add> } <ide> } <del> if _, ok := b.allowedBuildArgs[arg]; ok { <del> return true <add> for arg := range b.allowedBuildArgs { <add> if _, ok := m[arg]; !ok { <add> v, ok := b.getBuildArg(arg) <add> if ok { <add> m[arg] = v <add> } <add> } <ide> } <del> return false <add> return m <ide> } <ide><path>integration-cli/docker_cli_build_test.go <ide> func (s *DockerSuite) TestBuildBuildTimeArgDefintionWithNoEnvInjection(c *check. <ide> } <ide> } <ide> <add>func (s *DockerSuite) TestBuildBuildTimeArgMultipleFrom(c *check.C) { <add> imgName := "multifrombldargtest" <add> dockerfile := `FROM busybox <add> ARG foo=abc <add> LABEL multifromtest=1 <add> RUN env > /out <add> FROM busybox <add> ARG bar=def <add> RUN env > /out` <add> <add> result := buildImage(imgName, withDockerfile(dockerfile)) <add> result.Assert(c, icmd.Success) <add> <add> result = icmd.RunCmd(icmd.Cmd{ <add> Command: []string{dockerBinary, "images", "-q", "-f", "label=multifromtest=1"}, <add> }) <add> result.Assert(c, icmd.Success) <add> parentID := strings.TrimSpace(result.Stdout()) <add> <add> result = icmd.RunCmd(icmd.Cmd{ <add> Command: []string{dockerBinary, "run", "--rm", parentID, "cat", "/out"}, <add> }) <add> result.Assert(c, icmd.Success) <add> c.Assert(result.Stdout(), checker.Contains, "foo=abc") <add> <add> result = icmd.RunCmd(icmd.Cmd{ <add> Command: []string{dockerBinary, "run", "--rm", imgName, "cat", "/out"}, <add> }) <add> result.Assert(c, icmd.Success) <add> c.Assert(result.Stdout(), checker.Not(checker.Contains), "foo") <add> c.Assert(result.Stdout(), checker.Contains, "bar=def") <add>} <add> <add>func (s *DockerSuite) TestBuildBuildTimeUnusedArgMultipleFrom(c *check.C) { <add> imgName := "multifromunusedarg" <add> dockerfile := `FROM busybox <add> ARG foo <add> FROM busybox <add> ARG bar <add> RUN env > /out` <add> <add> result := buildImage(imgName, withDockerfile(dockerfile), withBuildFlags( <add> "--build-arg", fmt.Sprintf("baz=abc"))) <add> result.Assert(c, icmd.Success) <add> c.Assert(result.Combined(), checker.Contains, "[Warning]") <add> c.Assert(result.Combined(), checker.Contains, "[baz] were not consumed") <add> <add> result = icmd.RunCmd(icmd.Cmd{ <add> Command: []string{dockerBinary, "run", "--rm", imgName, "cat", "/out"}, <add> }) <add> result.Assert(c, icmd.Success) <add> c.Assert(result.Stdout(), checker.Not(checker.Contains), "bar") <add> c.Assert(result.Stdout(), checker.Not(checker.Contains), "baz") <add>} <add> <ide> func (s *DockerSuite) TestBuildNoNamedVolume(c *check.C) { <ide> volName := "testname:/foo" <ide>
6
PHP
PHP
add tests showing multicheckbox nesting
f81fbccec3ebc7aaff2549b4577e39b114116956
<ide><path>tests/TestCase/View/Helper/FormHelperTest.php <ide> public function testInputsNotNested() { <ide> '/div', <ide> ]; <ide> $this->assertHtml($expected, $result); <add> <add> $result = $this->Form->select('category', ['1', '2'], [ <add> 'multiple' => 'checkbox', <add> 'name' => 'fish', <add> ]); <add> $expected = [ <add> 'input' => ['type' => 'hidden', 'name' => 'fish', 'value' => ''], <add> ['div' => ['class' => 'checkbox']], <add> ['input' => ['type' => 'checkbox', 'name' => 'fish[]', 'value' => '0', 'id' => 'fish-0']], <add> ['label' => ['for' => 'fish-0']], <add> '1', <add> '/label', <add> '/div', <add> ['div' => ['class' => 'checkbox']], <add> ['input' => ['type' => 'checkbox', 'name' => 'fish[]', 'value' => '1', 'id' => 'fish-1']], <add> ['label' => ['for' => 'fish-1']], <add> '2', <add> '/label', <add> '/div' <add> ]; <add> $this->assertHtml($expected, $result); <ide> } <ide> <ide> /**
1
Javascript
Javascript
remove multiview attribute from renderer
c0090c138f5f712dfa9a59e9e50931e52e504e93
<ide><path>src/renderers/WebGLRenderer.js <ide> function WebGLRenderer( parameters ) { <ide> <ide> var multiview = new WebGLMultiview( _this, _gl ); <ide> <del> this.multiview = multiview; <del> <ide> // shadow map <ide> <ide> var shadowMap = new WebGLShadowMap( _this, objects, capabilities.maxTextureSize ); <ide><path>src/renderers/webgl/WebGLMultiview.js <ide> function WebGLMultiview( renderer, gl ) { <ide> <ide> } <ide> <del> function getNumViews() { <del> <del> if ( renderTarget && renderer.getRenderTarget() === renderTarget ) { <del> <del> return renderTarget.numViews; <del> <del> } <del> <del> return 0; <del> <del> } <del> <ide> function getCameraArray( camera ) { <ide> <ide> if ( camera.isArrayCamera ) return camera.cameras; <ide> function WebGLMultiview( renderer, gl ) { <ide> <ide> this.attachRenderTarget = attachRenderTarget; <ide> this.detachRenderTarget = detachRenderTarget; <del> this.getNumViews = getNumViews; <ide> this.updateCameraProjectionMatricesUniform = updateCameraProjectionMatricesUniform; <ide> this.updateCameraViewMatricesUniform = updateCameraViewMatricesUniform; <ide> this.updateObjectMatricesUniforms = updateObjectMatricesUniforms; <ide><path>src/renderers/webgl/WebGLProgram.js <ide> import { WebGLUniforms } from './WebGLUniforms.js'; <ide> import { WebGLShader } from './WebGLShader.js'; <ide> import { ShaderChunk } from '../shaders/ShaderChunk.js'; <ide> import { NoToneMapping, AddOperation, MixOperation, MultiplyOperation, EquirectangularRefractionMapping, CubeRefractionMapping, SphericalReflectionMapping, EquirectangularReflectionMapping, CubeUVRefractionMapping, CubeUVReflectionMapping, CubeReflectionMapping, PCFSoftShadowMap, PCFShadowMap, VSMShadowMap, ACESFilmicToneMapping, CineonToneMapping, Uncharted2ToneMapping, ReinhardToneMapping, LinearToneMapping, GammaEncoding, RGBDEncoding, RGBM16Encoding, RGBM7Encoding, RGBEEncoding, sRGBEncoding, LinearEncoding, LogLuvEncoding } from '../../constants.js'; <add>import { WebGLMultiviewRenderTarget } from '../WebGLMultiviewRenderTarget.js'; <ide> <ide> var programIdCount = 0; <ide> <ide> function WebGLProgram( renderer, extensions, code, material, shader, parameters, <ide> <ide> var prefixVertex, prefixFragment; <ide> <del> var numMultiviewViews = renderer.multiview.getNumViews(); <add> var renderTarget = renderer.getRenderTarget(); <add> var numMultiviewViews = renderTarget instanceof WebGLMultiviewRenderTarget ? renderTarget.numViews : 0; <ide> <ide> if ( material.isRawShaderMaterial ) { <ide>
3
Java
Java
use new spel parser
d372a9ac5d6ed6dc2be64fb184ee4b0b33edaed3
<ide><path>org.springframework.context/src/main/java/org/springframework/context/expression/StandardBeanExpressionResolver.java <ide> import org.springframework.expression.Expression; <ide> import org.springframework.expression.ExpressionParser; <ide> import org.springframework.expression.ParserContext; <del>import org.springframework.expression.spel.antlr.SpelAntlrExpressionParser; <add>import org.springframework.expression.spel.standard.SpelExpressionParser; <ide> import org.springframework.expression.spel.support.StandardEvaluationContext; <ide> import org.springframework.util.Assert; <ide> <ide> /** <ide> * Standard implementation of the <ide> * {@link org.springframework.beans.factory.config.BeanExpressionResolver} <ide> * interface, parsing and evaluating Spring EL using Spring's expression module. <del> * <add> * <ide> * @author Juergen Hoeller <ide> * @since 3.0 <ide> * @see org.springframework.expression.ExpressionParser <del> * @see org.springframework.expression.spel.antlr.SpelAntlrExpressionParser <add> * @see org.springframework.expression.spel.standard.SpelExpressionParser <ide> * @see org.springframework.expression.spel.support.StandardEvaluationContext <ide> */ <ide> public class StandardBeanExpressionResolver implements BeanExpressionResolver { <ide> public class StandardBeanExpressionResolver implements BeanExpressionResolver { <ide> <ide> private String expressionSuffix = DEFAULT_EXPRESSION_SUFFIX; <ide> <del> private ExpressionParser expressionParser = new SpelAntlrExpressionParser(); <add> private ExpressionParser expressionParser = new SpelExpressionParser(); <ide> <ide> private final Map<String, Expression> expressionCache = new ConcurrentHashMap<String, Expression>(); <ide>
1
Javascript
Javascript
highlight elements on press + hove
94429fb037322652b6796ac2c40cef451795205e
<ide><path>Libraries/Inspector/DevtoolsOverlay.js <ide> export default function DevtoolsOverlay({ <ide> inspectedView: ?HostRef, <ide> }): React.Node { <ide> const [inspected, setInspected] = useState<null | { <del> frame: {height: any, left: any, top: any, width: any}, <add> frame: {+height: any, +left: any, +top: any, +width: any}, <ide> }>(null); <ide> const [isInspecting, setIsInspecting] = useState(false); <ide> const devToolsAgentRef = useRef(null); <ide> export default function DevtoolsOverlay({ <ide> locationX, <ide> locationY, <ide> viewData => { <del> const {touchedViewTag, closestInstance} = viewData; <add> const {touchedViewTag, closestInstance, frame} = viewData; <ide> if (closestInstance != null || touchedViewTag != null) { <ide> if (closestInstance != null) { <ide> // Fabric <ide> agent.selectNode(closestInstance); <ide> } else { <ide> agent.selectNode(findNodeHandle(touchedViewTag)); <ide> } <del> agent.stopInspectingNative(true); <del> setIsInspecting(false); <add> setInspected({ <add> frame, <add> }); <ide> return true; <ide> } <ide> return false; <ide> export default function DevtoolsOverlay({ <ide> [inspectedView], <ide> ); <ide> <add> const onResponderRelease = useCallback(() => { <add> const agent = devToolsAgentRef.current; <add> if (agent == null) { <add> return; <add> } <add> agent.stopInspectingNative(true); <add> setIsInspecting(false); <add> setInspected(null); <add> }, []); <add> <ide> const shouldSetResponser = useCallback( <ide> (e: PressEvent): boolean => { <ide> findViewForTouchEvent(e); <ide> export default function DevtoolsOverlay({ <ide> <View <ide> onStartShouldSetResponder={shouldSetResponser} <ide> onResponderMove={findViewForTouchEvent} <add> onResponderRelease={onResponderRelease} <ide> nativeID="devToolsInspectorOverlay" <ide> style={[styles.inspector, {height: Dimensions.get('window').height}]}> <ide> {highlight}
1
PHP
PHP
add support for parsing sqlite column types
424e14742f41a3a7ed9c148734a8538493552a87
<ide><path>lib/Cake/Model/Datasource/Database/Dialect/SqliteDialectTrait.php <ide> protected function _transformFunctionExpression(FunctionExpression $expression) <ide> } <ide> } <ide> <add>/** <add> * Convert a column definition to the abstract types. <add> * <add> * The returned type will be a type that <add> * Cake\Model\Datasource\Database\Type can handle. <add> * <add> * @param string $column The column type + length <add> * @return array List of (type, length) <add> */ <add> public function convertColumn($column) { <add> preg_match('/([a-z]+)(?:\(([0-9,]+)\))?/i', $column, $matches); <add> if (empty($matches)) { <add> throw new Error\Exception(__d('cake_dev', 'Unable to parse column type from "%s"', $column)); <add> } <add> $col = strtolower($matches[1]); <add> $length = null; <add> if (isset($matches[2])) { <add> $length = (int)$matches[2]; <add> } <add> <add> if ($col === 'bigint') { <add> return ['biginteger', $length]; <add> } <add> if (in_array($col, ['blob', 'clob'])) { <add> return ['binary', null]; <add> } <add> if (in_array($col, ['date', 'time', 'timestamp', 'datetime'])) { <add> return [$col, null]; <add> } <add> if (strpos($col, 'decimal') !== false) { <add> return ['decimal', null]; <add> } <add> <add> if (strpos($col, 'boolean') !== false) { <add> return ['boolean', null]; <add> } <add> if (strpos($col, 'int') !== false) { <add> return ['integer', $length]; <add> } <add> if (strpos($col, 'char') !== false) { <add> return ['string', $length]; <add> } <add> if (in_array($col, ['float', 'real', 'double'])) { <add> return ['float', null]; <add> } <add> return ['text', null]; <add> } <add> <add>/** <add> * Additional metadata columns in table descriptions. <add> * <add> * @return array <add> */ <add> public function extraSchemaColumns() { <add> return []; <add> } <add> <ide> } <ide><path>lib/Cake/Test/TestCase/Model/Datasource/Database/Driver/SqliteTest.php <ide> */ <ide> namespace Cake\Test\TestCase\Model\Datasource\Database\Driver; <ide> <add>use Cake\Core\Configure; <add>use Cake\Model\Datasource\Database\Driver\Sqlite; <add>use Cake\Testsuite\TestCase; <ide> use \PDO; <ide> <ide> /** <ide> * Tests Sqlite driver <add> */ <add>class SqliteTest extends TestCase { <add> <add>/** <add> * setup method <ide> * <add> * @return void <ide> */ <del>class SqliteTest extends \Cake\TestSuite\TestCase { <add> public function setUp() { <add> parent::setUp(); <add> $config = Configure::read('Datasource.test'); <add> $this->skipIf(strpos($config['datasource'], 'Sqlite') === false, 'Not using Sqlite for test config'); <add> } <ide> <ide> /** <ide> * Test connecting to Sqlite with default configuration <ide> public function testConnectionConfigCustom() { <ide> $driver->connect($config); <ide> } <ide> <add>/** <add> * Dataprovider for column testing <add> * <add> * @return array <add> */ <add> public static function columnProvider() { <add> return [ <add> [ <add> 'DATETIME', <add> ['datetime', null] <add> ], <add> [ <add> 'DATE', <add> ['date', null] <add> ], <add> [ <add> 'TIME', <add> ['time', null] <add> ], <add> [ <add> 'BOOLEAN', <add> ['boolean', null] <add> ], <add> [ <add> 'BIGINT', <add> ['biginteger', null] <add> ], <add> [ <add> 'VARCHAR(255)', <add> ['string', 255] <add> ], <add> [ <add> 'CHAR(25)', <add> ['string', 25] <add> ], <add> [ <add> 'BLOB', <add> ['binary', null] <add> ], <add> [ <add> 'INTEGER(11)', <add> ['integer', 11] <add> ], <add> [ <add> 'TINYINT(5)', <add> ['integer', 5] <add> ], <add> [ <add> 'MEDIUMINT(10)', <add> ['integer', 10] <add> ], <add> [ <add> 'FLOAT', <add> ['float', null] <add> ], <add> [ <add> 'DOUBLE', <add> ['float', null] <add> ], <add> [ <add> 'REAL', <add> ['float', null] <add> ], <add> [ <add> 'DECIMAL(11,2)', <add> ['decimal', null] <add> ], <add> ]; <add> } <add> <add>/** <add> * Test parsing SQLite column types. <add> * <add> * @dataProvider columnProvider <add> * @return void <add> */ <add> public function testConvertColumnType($input, $expected) { <add> $driver = new Sqlite(); <add> $this->assertEquals($driver->convertColumn($input), $expected); <add> } <add> <ide> }
2
Javascript
Javascript
flowify a bunch of libraries
9eec8aa9d5eb088943caad40d2482b15dc912801
<ide><path>Libraries/RKBackendNode/queryLayoutByID.js <ide> * of patent rights can be found in the PATENTS file in the same directory. <ide> * <ide> * @providesModule queryLayoutByID <add> * @flow <ide> */ <ide> 'use strict'; <ide> <ide> var ReactIOSTagHandles = require('ReactIOSTagHandles'); <ide> var RCTUIManager = require('NativeModules').UIManager; <ide> <add>type OnSuccessCallback = ( <add> left: number, <add> top: number, <add> width: number, <add> height: number, <add> pageX: number, <add> pageY: number <add>) => void <add> <add>// I don't know what type error is... <add>type OnErrorCallback = (error: any) => void <add> <ide> /** <ide> * Queries the layout of a view. The layout does not reflect the element as <ide> * seen by the user, rather it reflects the position within the layout system, <ide> var RCTUIManager = require('NativeModules').UIManager; <ide> * @param {function} onError `func(error)` <ide> * @param {function} onSuccess `func(left, top, width, height, pageX, pageY)` <ide> */ <del>var queryLayoutByID = function(rootNodeID, onError, onSuccess) { <add>var queryLayoutByID = function( <add> rootNodeID: string, <add> onError: OnErrorCallback, <add> onSuccess: OnSuccessCallback <add>): void { <ide> // Native bridge doesn't *yet* surface errors. <ide> RCTUIManager.measure( <ide> ReactIOSTagHandles.rootNodeIDToTag[rootNodeID], <ide><path>Libraries/ReactIOS/ReactIOSGlobalInteractionHandler.js <ide> * of patent rights can be found in the PATENTS file in the same directory. <ide> * <ide> * @providesModule ReactIOSGlobalInteractionHandler <add> * @flow <ide> */ <ide> 'use strict'; <ide> <ide> var InteractionManager = require('InteractionManager'); <ide> var interactionHandle = null; <ide> <ide> var ReactIOSGlobalInteractionHandler = { <del> onChange: function(numberActiveTouches) { <add> onChange: function(numberActiveTouches: number) { <ide> if (numberActiveTouches === 0) { <ide> if (interactionHandle) { <ide> InteractionManager.clearInteractionHandle(interactionHandle); <ide><path>Libraries/ReactIOS/ReactIOSGlobalResponderHandler.js <ide> * of patent rights can be found in the PATENTS file in the same directory. <ide> * <ide> * @providesModule ReactIOSGlobalResponderHandler <add> * @flow <ide> */ <ide> 'use strict'; <ide> <ide> var RCTUIManager = require('NativeModules').UIManager; <ide> var ReactIOSTagHandles = require('ReactIOSTagHandles'); <ide> <ide> var ReactIOSGlobalResponderHandler = { <del> onChange: function(from, to) { <add> onChange: function(from: string, to: string) { <ide> if (to !== null) { <ide> RCTUIManager.setJSResponder( <ide> ReactIOSTagHandles.mostRecentMountedNodeHandleForRootNodeID(to) <ide><path>Libraries/ReactIOS/ReactIOSMount.js <ide> * of patent rights can be found in the PATENTS file in the same directory. <ide> * <ide> * @providesModule ReactIOSMount <add> * @flow <ide> */ <ide> 'use strict'; <ide> <ide> var ReactIOSMount = { <ide> * @param {ReactComponent} instance Instance to render. <ide> * @param {containerTag} containerView Handle to native view tag <ide> */ <del> renderComponent: function(descriptor, containerTag) { <add> renderComponent: function( <add> descriptor: ReactComponent, <add> containerTag: number <add> ) { <ide> var instance = instantiateReactComponent(descriptor); <ide> <ide> if (!ReactIOSTagHandles.reactTagIsNativeTopRootID(containerTag)) { <ide> var ReactIOSMount = { <ide> * asynchronously, it's easier to just have this method be the one that calls <ide> * for removal of the view. <ide> */ <del> unmountComponentAtNodeAndRemoveContainer: function(containerTag) { <add> unmountComponentAtNodeAndRemoveContainer: function( <add> containerTag: number <add> ) { <ide> ReactIOSMount.unmountComponentAtNode(containerTag); <ide> // call back into native to remove all of the subviews from this container <ide> RCTUIManager.removeRootView(containerTag); <ide> var ReactIOSMount = { <ide> * that has been rendered and unmounting it. There should just be one child <ide> * component at this time. <ide> */ <del> unmountComponentAtNode: function(containerTag) { <add> unmountComponentAtNode: function(containerTag: number): bool { <ide> var containerID = ReactIOSTagHandles.tagToRootNodeID[containerTag]; <ide> <ide> invariant( <ide> var ReactIOSMount = { <ide> * Unmounts a component and sends messages back to iOS to remove its subviews. <ide> * <ide> * @param {ReactComponent} instance React component instance. <del> * @param {int} containerID ID of container we're removing from. <add> * @param {string} containerID ID of container we're removing from. <ide> * @final <ide> * @internal <ide> * @see {ReactIOSMount.unmountComponentAtNode} <ide> */ <del> unmountComponentFromNode: function(instance, containerID) { <add> unmountComponentFromNode: function( <add> instance: ReactComponent, <add> containerID: string <add> ) { <ide> // call back into native to remove all of the subviews from this container <del> instance.unmountComponent(); <add> // TODO: ReactComponent.prototype.unmountComponent is missing from Flow's <add> // react lib. <add> (instance: any).unmountComponent(); <ide> var containerTag = <ide> ReactIOSTagHandles.mostRecentMountedNodeHandleForRootNodeID(containerID); <ide> RCTUIManager.removeSubviewsFromContainerWithID(containerTag); <ide> }, <ide> <del> getNode: function(id) { <add> getNode: function<T>(id: T): T { <ide> return id; <ide> } <ide> }; <ide><path>Libraries/ReactIOS/ReactIOSNativeComponent.js <ide> * of patent rights can be found in the PATENTS file in the same directory. <ide> * <ide> * @providesModule ReactIOSNativeComponent <add> * @flow <ide> */ <ide> 'use strict'; <ide> <ide> var registrationNames = ReactIOSEventEmitter.registrationNames; <ide> var putListener = ReactIOSEventEmitter.putListener; <ide> var deleteAllListeners = ReactIOSEventEmitter.deleteAllListeners; <ide> <add>type ReactIOSNativeComponentViewConfig = { <add> validAttributes: Object; <add> uiViewClassName: string; <add>} <add> <ide> /** <ide> * @constructor ReactIOSNativeComponent <ide> * @extends ReactComponent <ide> * @extends ReactMultiChild <ide> * @param {!object} UIKit View Configuration. <ide> */ <del>var ReactIOSNativeComponent = function(viewConfig) { <add>var ReactIOSNativeComponent = function( <add> viewConfig: ReactIOSNativeComponentViewConfig <add>) { <ide> this.viewConfig = viewConfig; <ide> }; <ide> <ide><path>Libraries/ReactIOS/ReactIOSReconcileTransaction.js <ide> * of patent rights can be found in the PATENTS file in the same directory. <ide> * <ide> * @providesModule ReactIOSReconcileTransaction <del> * @typechecks static-only <add> * @flow <ide> */ <ide> <ide> "use strict"; <ide><path>Libraries/ReactIOS/ReactIOSStyleAttributes.js <ide> * of patent rights can be found in the PATENTS file in the same directory. <ide> * <ide> * @providesModule ReactIOSStyleAttributes <add> * @flow <ide> */ <ide> <ide> "use strict"; <ide><path>Libraries/ReactIOS/ReactIOSTagHandles.js <ide> * of patent rights can be found in the PATENTS file in the same directory. <ide> * <ide> * @providesModule ReactIOSTagHandles <add> * @flow <ide> */ <ide> 'use strict'; <ide> <ide> var ReactIOSTagHandles = { <ide> tagsStartAt: INITIAL_TAG_COUNT, <ide> tagCount: INITIAL_TAG_COUNT, <ide> <del> allocateTag: function() { <add> allocateTag: function(): number { <ide> // Skip over root IDs as those are reserved for native <ide> while (this.reactTagIsNativeTopRootID(ReactIOSTagHandles.tagCount)) { <ide> ReactIOSTagHandles.tagCount++; <ide> var ReactIOSTagHandles = { <ide> * `unmountComponent` isn't the correct time because that doesn't imply that <ide> * the native node has been natively unmounted. <ide> */ <del> associateRootNodeIDWithMountedNodeHandle: function(rootNodeID, tag) { <add> associateRootNodeIDWithMountedNodeHandle: function( <add> rootNodeID: ?string, <add> tag: ?number <add> ) { <ide> warning(rootNodeID && tag, 'Root node or tag is null when associating'); <del> ReactIOSTagHandles.tagToRootNodeID[tag] = rootNodeID; <del> ReactIOSTagHandles.rootNodeIDToTag[rootNodeID] = tag; <add> if (rootNodeID && tag) { <add> ReactIOSTagHandles.tagToRootNodeID[tag] = rootNodeID; <add> ReactIOSTagHandles.rootNodeIDToTag[rootNodeID] = tag; <add> } <ide> }, <ide> <del> allocateRootNodeIDForTag: function(tag) { <add> allocateRootNodeIDForTag: function(tag: number): string { <ide> invariant( <ide> this.reactTagIsNativeTopRootID(tag), <ide> 'Expect a native root tag, instead got ', tag <ide> ); <ide> return '.r[' + tag + ']{TOP_LEVEL}'; <ide> }, <ide> <del> reactTagIsNativeTopRootID: function(reactTag) { <add> reactTagIsNativeTopRootID: function(reactTag: number): bool { <ide> // We reserve all tags that are 1 mod 10 for native root views <ide> return reactTag % 10 === 1; <ide> }, <ide> var ReactIOSTagHandles = { <ide> * @return {number} Tag ID of native view for most recent mounting of <ide> * `rootNodeID`. <ide> */ <del> mostRecentMountedNodeHandleForRootNodeID: function(rootNodeID) { <add> mostRecentMountedNodeHandleForRootNodeID: function( <add> rootNodeID: string <add> ): number { <ide> return ReactIOSTagHandles.rootNodeIDToTag[rootNodeID]; <ide> }, <ide> <del> tagToRootNodeID: [], <add> tagToRootNodeID: ([] : Array<string>), <ide> <del> rootNodeIDToTag: {} <add> rootNodeIDToTag: ({} : {[key: string]: number}) <ide> }; <ide> <ide> module.exports = ReactIOSTagHandles; <ide><path>Libraries/ReactIOS/ReactIOSViewAttributes.js <ide> * of patent rights can be found in the PATENTS file in the same directory. <ide> * <ide> * @providesModule ReactIOSViewAttributes <add> * @flow <ide> */ <ide> <ide> "use strict";
9
Text
Text
augment the rails4 guide with links to prs
4fe70ee4720d99a2a13f54a6d0bbca28409d1867
<ide><path>guides/source/4_0_release_notes.md <ide> Highlights in Rails 4.0: (WIP) <ide> * Strong Parameters <ide> * Queue API <ide> * Caching Improvements <add>* ActionController::Live <ide> <ide> These release notes cover the major changes, but do not include each bug-fix and changes. If you want to see everything, check out the [list of commits](https://github.com/rails/rails/commits/master) in the main Rails repository on GitHub. <ide> <ide> Railties <ide> <ide> * Add `.rake` to list of file extensions included by `rake notes` and `rake notes:custom`. <ide> <del>* New test locations `test/models`, `test/helpers`, `test/controllers`, and `test/mailers`. Corresponding rake tasks added as well. <add>* New test locations `test/models`, `test/helpers`, `test/controllers`, and `test/mailers`. Corresponding rake tasks added as well. ([Pull Request](https://github.com/rails/rails/pull/7878)) <ide> <ide> * Set a different cache per environment for assets pipeline through `config.assets.cache`. <ide> <ide> Action Mailer <ide> <ide> * Raise an `ActionView::MissingTemplate` exception when no implicit template could be found. <ide> <del>* Asynchronously send messages via the Rails Queue. <add>* Asynchronously send messages via the Rails Queue. ([Pull Request](https://github.com/rails/rails/pull/6839)) <ide> <ide> * Delivery Options (such as SMTP Settings) can now be set dynamically per mailer action. <ide> <ide> Action Pack <ide> <ide> If you add the above code, you can use `<%= error %>` in an erb, and `redirect_to /foo, :error => 'message'` in a controller. <ide> <add>* Encrypted Cookies + Sign using Derived Keys. ([Pull Request](https://github.com/rails/rails/pull/8112)) <add> <ide> * Remove Active Model dependency from Action Pack. <ide> <ide> * Support unicode characters in routes. Route will be automatically escaped, so instead of manually escaping: <ide> Action Pack <ide> <ide> * Show routes in exception page while debugging a `RoutingError` in development. <ide> <add>* Helper methods for HTML5 inputs. ([Pull Request](https://github.com/rails/rails/pull/6359)) <add> <ide> * Include `mounted_helpers` (helpers for accessing mounted engines) in `ActionDispatch::IntegrationTest` by default. <ide> <ide> * Added `ActionDispatch::SSL` middleware that when included force all the requests to be under HTTPS protocol. <ide> Active Record <ide> store :settings, accessors: [ :color, :homepage ], coder: JSON <ide> ``` <ide> <del>* `mysql` and `mysql2` connections will set `SQL_MODE=STRICT_ALL_TABLES` by default to avoid silent data loss. This can be disabled by specifying `strict: false` in `config/database.yml`. <add>* `mysql` and `mysql2` connections will set `SQL_MODE=STRICT_ALL_TABLES` by default to avoid silent data loss. This can be disabled by specifying `strict: false` in `config/database.yml`. ([Pull Request](https://github.com/rails/rails/pull/6069)) <ide> <ide> * Added default order to `ActiveRecord::Base#first` to assure consistent results among different database engines. Introduced `ActiveRecord::Base#take` as a replacement to the old behavior. <ide> <ide> Active Record <ide> <ide> * Remove IdentityMap - IdentityMap has never graduated to be an "enabled-by-default" feature, due to some inconsistencies with associations, as described in this [commit](https://github.com/rails/rails/commit/302c912bf6bcd0fa200d964ec2dc4a44abe328a6). Hence the removal from the codebase, until such issues are fixed. <ide> <del>* Added a feature to dump/load internal state of `SchemaCache` instance because we want to boot more quickly when we have many models. <add>* Added a feature to dump/load internal state of `SchemaCache` instance because we want to boot more quickly when we have many models. ([Pull Request](https://github.com/rails/rails/pull/5162)) <ide> <ide> ```ruby <ide> # execute rake task. <ide> Active Record <ide> <ide> * PostgreSQL hstore types are automatically deserialized from the database. <ide> <add>* Support for array datatype in PostgreSQL. ([Pull Request](https://github.com/rails/rails/pull/7547)) <add> <ide> * Added `#update_columns` method which updates the attributes from the passed-in hash without calling save, hence skipping validations and callbacks. `ActiveRecordError` will be raised when called on new objects or when at least one of the attributes is marked as read only. <ide> <ide> ```ruby <ide> Active Model <ide> <ide> * `ConfirmationValidator` error messages will attach to `:#{attribute}_confirmation` instead of `attribute`. <ide> <del>* Added `ActiveModel::Model`, a mixin to make Ruby objects work with Action Pack out of the box. <add>* Added `ActiveModel::Model`, a mixin to make Ruby objects work with Action Pack out of the box. ([Pull Request](https://github.com/rails/rails/pull/5253)) <ide> <ide> * `ActiveModel::Errors#to_json` supports a new parameter `:full_messages`. <ide>
1
Javascript
Javascript
add many pointers example
68f3fb275fb87864a83ffca650048628a0aa3aef
<ide><path>packages/rn-tester/js/examples/Experimental/Compatibility/ManyPointersPropertiesExample.js <add>/** <add> * Copyright (c) Meta Platforms, Inc. and affiliates. <add> * <add> * This source code is licensed under the MIT license found in the <add> * LICENSE file in the root directory of this source tree. <add> * <add> * @format <add> * @flow <add> */ <add> <add>import * as React from 'react'; <add>import {View, Text, StyleSheet} from 'react-native'; <add>import type {RNTesterModuleExample} from '../../../types/RNTesterTypes'; <add>import type {PointerEvent} from 'react-native/Libraries/Types/CoreEventTypes'; <add> <add>const styles = StyleSheet.create({ <add> container: {height: '30%', width: '100%', backgroundColor: 'black'}, <add> properties: {}, <add> property: {borderWidth: 1, margin: 10}, <add>}); <add> <add>function ManyPointersPropertiesExample(): React.Node { <add> const [data, setData] = React.useState({}); <add> const onPointerMove = (event: PointerEvent) => { <add> const pointerId = event.nativeEvent.pointerId; <add> setData({...data, [pointerId]: event.nativeEvent}); <add> }; <add> <add> return ( <add> <> <add> <View style={styles.container} onPointerMove={onPointerMove} /> <add> <View style={styles.properties}> <add> {Object.entries(data).map( <add> //$FlowFixMe can't supply generic for Object.entries <add> ([key, evt]: [string, PointerEvent['nativeEvent']]) => ( <add> <View style={styles.property} key={key}> <add> <Text>PointerID: {evt.pointerId}</Text> <add> <Text> <add> Offset: [{evt.offsetX.toPrecision(3)},{' '} <add> {evt.offsetY.toPrecision(3)}] <add> </Text> <add> <Text> <add> Coordinates: [{evt.clientX.toPrecision(3)},{' '} <add> {evt.clientY.toPrecision(3)}] <add> </Text> <add> <Text>Button: {evt.button}</Text> <add> <Text>Pressure: {evt.pressure}</Text> <add> </View> <add> ), <add> )} <add> </View> <add> </> <add> ); <add>} <add> <add>export default ({ <add> name: 'many_pointers_properties_example', <add> description: 'Display of properties for multiple pointers', <add> title: 'Display Properties of many pointers', <add> render(): React.Node { <add> return <ManyPointersPropertiesExample />; <add> }, <add>}: RNTesterModuleExample); <ide><path>packages/rn-tester/js/examples/Experimental/W3CPointerEventsExample.js <ide> import PointerEventPointerMoveAcross from './W3CPointerEventPlatformTests/Pointe <ide> import PointerEventPointerMoveEventOrder from './W3CPointerEventPlatformTests/PointerEventPointerMoveEventOrder'; <ide> import PointerEventPointerMoveBetween from './W3CPointerEventPlatformTests/PointerEventPointerMoveBetween'; <ide> import EventfulView from './W3CPointerEventsEventfulView'; <add>import ManyPointersPropertiesExample from './Compatibility/ManyPointersPropertiesExample'; <ide> <ide> function AbsoluteChildExample({log}: {log: string => void}) { <ide> return ( <ide> export default { <ide> }, <ide> CompatibilityAnimatedPointerMove, <ide> CompatibilityNativeGestureHandling, <add> ManyPointersPropertiesExample, <ide> ], <ide> };
2
Java
Java
fix typo in eventsourcetransporthandler
8bb165e55c68a50997bb1d5edc5822e82de5c94f
<ide><path>spring-websocket/src/main/java/org/springframework/web/socket/sockjs/transport/handler/EventSourceTransportHandler.java <ide> import org.springframework.web.socket.sockjs.transport.session.StreamingSockJsSession; <ide> <ide> /** <del> * A TransportHandler for sending messages via Server-Sent events: <add> * A TransportHandler for sending messages via Server-Sent Events: <ide> * <a href="https://dev.w3.org/html5/eventsource/">https://dev.w3.org/html5/eventsource/</a>. <ide> * <ide> * @author Rossen Stoyanchev
1
Java
Java
start core marker earlier
f1b4daf51f837ed55b6778d0265f36eaff4c49df
<ide><path>ReactAndroid/src/main/java/com/facebook/react/bridge/ReactMarkerConstants.java <ide> public enum ReactMarkerConstants { <ide> REGISTER_JS_SEGMENT_START, <ide> REGISTER_JS_SEGMENT_STOP, <ide> VM_INIT, <add> ON_FRAGMENT_CREATE, <ide> }
1
Go
Go
fix version detection for docker-init
69f0402585579ced62bca22551a6ef45672bb4fd
<ide><path>daemon/info.go <ide> func (daemon *Daemon) SystemInfo() (*types.Info, error) { <ide> v.RuncCommit.ID = strings.TrimSpace(parts[1]) <ide> } <ide> } <add> <add> if v.RuncCommit.ID == "" { <add> logrus.Warnf("failed to retrieve %s version: unknown output format: %s", DefaultRuntimeBinary, string(rv)) <add> v.RuncCommit.ID = "N/A" <add> } <ide> } else { <ide> logrus.Warnf("failed to retrieve %s version: %v", DefaultRuntimeBinary, err) <ide> v.RuncCommit.ID = "N/A" <ide> } <del> if v.RuncCommit.ID == "" { <del> logrus.Warnf("failed to retrieve %s version: unknown output format", DefaultRuntimeBinary) <del> v.RuncCommit.ID = "N/A" <del> } <ide> <ide> v.InitCommit.Expected = dockerversion.InitCommitID <ide> if rv, err := exec.Command(DefaultInitBinary, "--version").Output(); err == nil { <del> parts := strings.Split(string(rv), " ") <del> if len(parts) == 3 { <del> v.InitCommit.ID = strings.TrimSpace(parts[2]) <del> } else { <del> logrus.Warnf("failed to retrieve %s version: unknown output format", DefaultInitBinary) <add> parts := strings.Split(strings.TrimSpace(string(rv)), " - ") <add> if len(parts) == 2 { <add> if dockerversion.InitCommitID[0] == 'v' { <add> vs := strings.TrimPrefix(parts[0], "tini version ") <add> v.InitCommit.ID = "v" + vs <add> } else { <add> // Get the sha1 <add> gitParts := strings.Split(parts[1], ".") <add> if len(gitParts) == 2 && gitParts[0] == "git" { <add> v.InitCommit.ID = gitParts[1] <add> v.InitCommit.Expected = dockerversion.InitCommitID[0:len(gitParts[1])] <add> } <add> } <add> } <add> <add> if v.InitCommit.ID == "" { <add> logrus.Warnf("failed to retrieve %s version: unknown output format: %s", DefaultInitBinary, string(rv)) <ide> v.InitCommit.ID = "N/A" <ide> } <ide> } else {
1
Python
Python
add view (mvc speeking) for the plugins. cpu ok
0035336389e510a3fcf8685c03732d6c117226a1
<ide><path>glances/plugins/glances_cpu.py <ide> import psutil <ide> <ide> from glances.plugins.glances_plugin import GlancesPlugin <add>from glances.core.glances_logging import logger <ide> <ide> # SNMP OID <ide> # percentage of user CPU time: .1.3.6.1.4.1.2021.11.9.0 <ide> def update_views(self): <ide> if key in self.stats: <ide> self.views[key]['optional'] = True <ide> <add> logger.info(self.views) <add> <ide> def msg_curse(self, args=None): <ide> """Return the list to display in the UI""" <ide> # Init the return message
1
Text
Text
fix a couple of grammatical errors in security.md
6cadc4d96a9ffa1c4fbf2c88c238b24b16a94556
<ide><path>guides/source/security.md <ide> Refer to the Injection section for countermeasures against XSS. It is _recommend <ide> <ide> **CSRF** Cross-Site Request Forgery (CSRF), also known as Cross-Site Reference Forgery (XSRF), is a gigantic attack method, it allows the attacker to do everything the administrator or Intranet user may do. As you have already seen above how CSRF works, here are a few examples of what attackers can do in the Intranet or admin interface. <ide> <del>A real-world example is a [router reconfiguration by CSRF](http://www.h-online.com/security/news/item/Symantec-reports-first-active-attack-on-a-DSL-router-735883.html). The attackers sent a malicious e-mail, with CSRF in it, to Mexican users. The e-mail claimed there was an e-card waiting for them, but it also contained an image tag that resulted in a HTTP-GET request to reconfigure the user's router (which is a popular model in Mexico). The request changed the DNS-settings so that requests to a Mexico-based banking site would be mapped to the attacker's site. Everyone who accessed the banking site through that router saw the attacker's fake web site and had their credentials stolen. <add>A real-world example is a [router reconfiguration by CSRF](http://www.h-online.com/security/news/item/Symantec-reports-first-active-attack-on-a-DSL-router-735883.html). The attackers sent a malicious e-mail, with CSRF in it, to Mexican users. The e-mail claimed there was an e-card waiting for the user, but it also contained an image tag that resulted in a HTTP-GET request to reconfigure the user's router (which is a popular model in Mexico). The request changed the DNS-settings so that requests to a Mexico-based banking site would be mapped to the attacker's site. Everyone who accessed the banking site through that router saw the attacker's fake web site and had their credentials stolen. <ide> <del>Another example changed Google Adsense's e-mail address and password by. If the victim was logged into Google Adsense, the administration interface for Google advertisements campaigns, an attacker could change their credentials. <add>Another example changed Google Adsense's e-mail address and password. If the victim was logged into Google Adsense, the administration interface for Google advertisement campaigns, an attacker could change the credentials of the victim. <ide> <ide> Another popular attack is to spam your web application, your blog or forum to propagate malicious XSS. Of course, the attacker has to know the URL structure, but most Rails URLs are quite straightforward or they will be easy to find out, if it is an open-source application's admin interface. The attacker may even do 1,000 lucky guesses by just including malicious IMG-tags which try every possible combination. <ide>
1
Javascript
Javascript
add check for missing image
37c98a95ed4caec070781babd022071840a53faf
<ide><path>controllers/resources.js <ide> module.exports = { <ide> }, <ide> <ide> about: function(req, res) { <add> if (req.user) { <add> if (!req.user.picture) { <add> req.user.picture = "https://s3.amazonaws.com/freecodecamp/favicons/apple-touch-icon-180x180.png" <add> req.user.save(); <add> } <add> } <add> <ide> var date1 = new Date("10/15/2014"); <ide> var date2 = new Date(); <ide> var timeDiff = Math.abs(date2.getTime() - date1.getTime());
1
PHP
PHP
fix incorrect return value
08ee66ade116f6ba1cc743dd36210bfdfbd196ea
<ide><path>src/Illuminate/Validation/Rule.php <ide> public static function in(array $values) <ide> * Get a not_in constraint builder instance. <ide> * <ide> * @param array $values <del> * @return \Illuminate\Validation\Rules\In <add> * @return \Illuminate\Validation\Rules\NotIn <ide> */ <ide> public static function notIn(array $values) <ide> {
1
Java
Java
simplify testruntimehintsregistrar api
935265048a9d18843c0606c2e065116594fa4d6d
<ide><path>spring-test/src/main/java/org/springframework/test/context/aot/MergedContextConfigurationRuntimeHints.java <add>/* <add> * Copyright 2002-2022 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> * https://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.test.context.aot; <add> <add>import java.lang.reflect.Method; <add>import java.util.Arrays; <add> <add>import org.springframework.aot.hint.RuntimeHints; <add>import org.springframework.core.io.DefaultResourceLoader; <add>import org.springframework.test.context.ContextLoader; <add>import org.springframework.test.context.MergedContextConfiguration; <add>import org.springframework.util.ClassUtils; <add> <add>import static org.springframework.aot.hint.MemberCategory.INVOKE_DECLARED_CONSTRUCTORS; <add>import static org.springframework.util.ResourceUtils.CLASSPATH_URL_PREFIX; <add> <add>/** <add> * {@code MergedContextConfigurationRuntimeHints} registers run-time hints for <add> * standard functionality in the <em>Spring TestContext Framework</em> based on <add> * {@link MergedContextConfiguration}. <add> * <add> * <p>This class interacts with {@code org.springframework.test.context.web.WebMergedContextConfiguration} <add> * via reflection to avoid a package cycle. <add> * <add> * @author Sam Brannen <add> * @since 6.0 <add> */ <add>class MergedContextConfigurationRuntimeHints { <add> <add> private static final String SLASH = "/"; <add> <add> private static final String WEB_MERGED_CONTEXT_CONFIGURATION_CLASS_NAME = <add> "org.springframework.test.context.web.WebMergedContextConfiguration"; <add> <add> private static final String GET_RESOURCE_BASE_PATH_METHOD_NAME = "getResourceBasePath"; <add> <add> private static final Class<?> webMergedContextConfigurationClass = loadWebMergedContextConfigurationClass(); <add> <add> private static final Method getResourceBasePathMethod = loadGetResourceBasePathMethod(); <add> <add> <add> public void registerHints(RuntimeHints runtimeHints, MergedContextConfiguration mergedConfig, ClassLoader classLoader) { <add> // @ContextConfiguration(loader = ...) <add> ContextLoader contextLoader = mergedConfig.getContextLoader(); <add> if (contextLoader != null) { <add> registerDeclaredConstructors(contextLoader.getClass(), runtimeHints); <add> } <add> <add> // @ContextConfiguration(initializers = ...) <add> mergedConfig.getContextInitializerClasses() <add> .forEach(clazz -> registerDeclaredConstructors(clazz, runtimeHints)); <add> <add> // @ContextConfiguration(locations = ...) <add> registerClasspathResources(mergedConfig.getLocations(), runtimeHints, classLoader); <add> <add> // @TestPropertySource(locations = ... ) <add> registerClasspathResources(mergedConfig.getPropertySourceLocations(), runtimeHints, classLoader); <add> <add> // @WebAppConfiguration(value = ...) <add> if (webMergedContextConfigurationClass.isInstance(mergedConfig)) { <add> String resourceBasePath = null; <add> try { <add> resourceBasePath = (String) getResourceBasePathMethod.invoke(mergedConfig); <add> } <add> catch (Exception ex) { <add> throw new IllegalStateException( <add> "Failed to invoke WebMergedContextConfiguration#getResourceBasePath()", ex); <add> } <add> registerClasspathResourceDirectoryStructure(resourceBasePath, runtimeHints); <add> } <add> } <add> <add> private void registerDeclaredConstructors(Class<?> type, RuntimeHints runtimeHints) { <add> runtimeHints.reflection().registerType(type, INVOKE_DECLARED_CONSTRUCTORS); <add> } <add> <add> private void registerClasspathResources(String[] paths, RuntimeHints runtimeHints, ClassLoader classLoader) { <add> DefaultResourceLoader resourceLoader = new DefaultResourceLoader(classLoader); <add> Arrays.stream(paths) <add> .filter(path -> path.startsWith(CLASSPATH_URL_PREFIX)) <add> .map(resourceLoader::getResource) <add> .forEach(runtimeHints.resources()::registerResource); <add> } <add> <add> private void registerClasspathResourceDirectoryStructure(String directory, RuntimeHints runtimeHints) { <add> if (directory.startsWith(CLASSPATH_URL_PREFIX)) { <add> String pattern = directory.substring(CLASSPATH_URL_PREFIX.length()); <add> if (pattern.startsWith(SLASH)) { <add> pattern = pattern.substring(1); <add> } <add> if (!pattern.endsWith(SLASH)) { <add> pattern += SLASH; <add> } <add> pattern += "*"; <add> runtimeHints.resources().registerPattern(pattern); <add> } <add> } <add> <add> @SuppressWarnings("unchecked") <add> private static Class<?> loadWebMergedContextConfigurationClass() { <add> try { <add> return ClassUtils.forName(WEB_MERGED_CONTEXT_CONFIGURATION_CLASS_NAME, <add> MergedContextConfigurationRuntimeHints.class.getClassLoader()); <add> } <add> catch (ClassNotFoundException | LinkageError ex) { <add> throw new IllegalStateException( <add> "Failed to load class " + WEB_MERGED_CONTEXT_CONFIGURATION_CLASS_NAME, ex); <add> } <add> } <add> <add> private static Method loadGetResourceBasePathMethod() { <add> try { <add> return webMergedContextConfigurationClass.getMethod(GET_RESOURCE_BASE_PATH_METHOD_NAME); <add> } <add> catch (Exception ex) { <add> throw new IllegalStateException( <add> "Failed to load method WebMergedContextConfiguration#getResourceBasePath()", ex); <add> } <add> } <add> <add>} <ide><path>spring-test/src/main/java/org/springframework/test/context/aot/TestContextAotGenerator.java <ide> <ide> package org.springframework.test.context.aot; <ide> <del>import java.util.Collections; <ide> import java.util.Map; <ide> import java.util.concurrent.atomic.AtomicInteger; <ide> import java.util.stream.Stream; <ide> public class TestContextAotGenerator { <ide> <ide> private final AotServices<TestRuntimeHintsRegistrar> testRuntimeHintsRegistrars; <ide> <add> private final MergedContextConfigurationRuntimeHints mergedConfigRuntimeHints = <add> new MergedContextConfigurationRuntimeHints(); <add> <ide> private final AtomicInteger sequence = new AtomicInteger(); <ide> <ide> private final GeneratedFiles generatedFiles; <ide> public void processAheadOfTime(Stream<Class<?>> testClasses) throws TestContextA <ide> resetAotFactories(); <ide> <ide> MultiValueMap<MergedContextConfiguration, Class<?>> mergedConfigMappings = new LinkedMultiValueMap<>(); <del> testClasses.forEach(testClass -> mergedConfigMappings.add(buildMergedContextConfiguration(testClass), testClass)); <add> ClassLoader classLoader = getClass().getClassLoader(); <add> testClasses.forEach(testClass -> { <add> MergedContextConfiguration mergedConfig = buildMergedContextConfiguration(testClass); <add> mergedConfigMappings.add(mergedConfig, testClass); <add> this.testRuntimeHintsRegistrars.forEach(registrar -> <add> registrar.registerHints(this.runtimeHints, testClass, classLoader)); <add> this.mergedConfigRuntimeHints.registerHints(this.runtimeHints, mergedConfig, classLoader); <add> }); <ide> MultiValueMap<ClassName, Class<?>> initializerClassMappings = processAheadOfTime(mergedConfigMappings); <ide> <ide> generateTestAotMappings(initializerClassMappings); <ide> private MultiValueMap<ClassName, Class<?>> processAheadOfTime(MultiValueMap<Merg <ide> logger.debug(LogMessage.format("Generating AOT artifacts for test classes %s", <ide> testClasses.stream().map(Class::getName).toList())); <ide> try { <del> this.testRuntimeHintsRegistrars.forEach(registrar -> registrar.registerHints(mergedConfig, <del> Collections.unmodifiableList(testClasses), this.runtimeHints, getClass().getClassLoader())); <del> <ide> // Use first test class discovered for a given unique MergedContextConfiguration. <ide> Class<?> testClass = testClasses.get(0); <ide> DefaultGenerationContext generationContext = createGenerationContext(testClass); <ide><path>spring-test/src/main/java/org/springframework/test/context/aot/TestRuntimeHintsRegistrar.java <ide> <ide> package org.springframework.test.context.aot; <ide> <del>import java.util.List; <del> <ide> import org.springframework.aot.hint.RuntimeHints; <del>import org.springframework.test.context.MergedContextConfiguration; <ide> <ide> /** <ide> * Contract for registering {@link RuntimeHints} for integration tests run with <ide> * <p>This API serves as a companion to the core <ide> * {@link org.springframework.aot.hint.RuntimeHintsRegistrar RuntimeHintsRegistrar} <ide> * API. If you need to register global hints for testing support that are not <del> * specific to a particular test class or {@link MergedContextConfiguration}, favor <del> * implementing {@code RuntimeHintsRegistrar} over this API. <add> * specific to particular test classes, favor implementing {@code RuntimeHintsRegistrar} <add> * over this API. <ide> * <ide> * @author Sam Brannen <ide> * @since 6.0 <ide> public interface TestRuntimeHintsRegistrar { <ide> <ide> /** <ide> * Contribute hints to the given {@link RuntimeHints} instance. <del> * @param mergedConfig the merged context configuration to process <del> * @param testClasses the test classes that share the supplied merged context <del> * configuration <ide> * @param runtimeHints the {@code RuntimeHints} to use <add> * @param testClass the test class to process <ide> * @param classLoader the classloader to use <ide> */ <del> void registerHints(MergedContextConfiguration mergedConfig, List<Class<?>> testClasses, <del> RuntimeHints runtimeHints, ClassLoader classLoader); <add> void registerHints(RuntimeHints runtimeHints, Class<?> testClass, ClassLoader classLoader); <ide> <ide> } <ide><path>spring-test/src/main/java/org/springframework/test/context/aot/hint/StandardTestRuntimeHints.java <ide> <ide> package org.springframework.test.context.aot.hint; <ide> <del>import java.util.Arrays; <del>import java.util.List; <del> <ide> import org.springframework.aot.hint.RuntimeHints; <ide> import org.springframework.core.annotation.MergedAnnotations; <del>import org.springframework.core.io.DefaultResourceLoader; <ide> import org.springframework.test.context.ActiveProfiles; <ide> import org.springframework.test.context.ActiveProfilesResolver; <del>import org.springframework.test.context.ContextLoader; <del>import org.springframework.test.context.MergedContextConfiguration; <ide> import org.springframework.test.context.TestContextAnnotationUtils; <ide> import org.springframework.test.context.aot.TestRuntimeHintsRegistrar; <del>import org.springframework.test.context.web.WebMergedContextConfiguration; <ide> <ide> import static org.springframework.aot.hint.MemberCategory.INVOKE_DECLARED_CONSTRUCTORS; <ide> import static org.springframework.core.annotation.MergedAnnotations.SearchStrategy.TYPE_HIERARCHY; <del>import static org.springframework.util.ResourceUtils.CLASSPATH_URL_PREFIX; <ide> <ide> /** <ide> * {@link TestRuntimeHintsRegistrar} implementation that registers run-time hints <ide> */ <ide> class StandardTestRuntimeHints implements TestRuntimeHintsRegistrar { <ide> <del> private static final String SLASH = "/"; <del> <del> <ide> @Override <del> public void registerHints(MergedContextConfiguration mergedConfig, List<Class<?>> testClasses, <del> RuntimeHints runtimeHints, ClassLoader classLoader) { <del> <del> registerHintsForMergedContextConfiguration(mergedConfig, runtimeHints, classLoader); <del> testClasses.forEach(testClass -> registerHintsForActiveProfilesResolvers(testClass, runtimeHints)); <del> } <del> <del> private void registerHintsForMergedContextConfiguration( <del> MergedContextConfiguration mergedConfig, RuntimeHints runtimeHints, ClassLoader classLoader) { <del> <del> // @ContextConfiguration(loader = ...) <del> ContextLoader contextLoader = mergedConfig.getContextLoader(); <del> if (contextLoader != null) { <del> registerDeclaredConstructors(contextLoader.getClass(), runtimeHints); <del> } <del> <del> // @ContextConfiguration(initializers = ...) <del> mergedConfig.getContextInitializerClasses() <del> .forEach(clazz -> registerDeclaredConstructors(clazz, runtimeHints)); <del> <del> // @ContextConfiguration(locations = ...) <del> registerClasspathResources(mergedConfig.getLocations(), runtimeHints, classLoader); <del> <del> // @TestPropertySource(locations = ... ) <del> registerClasspathResources(mergedConfig.getPropertySourceLocations(), runtimeHints, classLoader); <del> <del> // @WebAppConfiguration(value = ...) <del> if (mergedConfig instanceof WebMergedContextConfiguration webConfig) { <del> registerClasspathResourceDirectoryStructure(webConfig.getResourceBasePath(), runtimeHints); <del> } <del> } <del> <del> private void registerHintsForActiveProfilesResolvers(Class<?> testClass, RuntimeHints runtimeHints) { <add> public void registerHints(RuntimeHints runtimeHints, Class<?> testClass, ClassLoader classLoader) { <ide> // @ActiveProfiles(resolver = ...) <ide> MergedAnnotations.search(TYPE_HIERARCHY) <ide> .withEnclosingClasses(TestContextAnnotationUtils::searchEnclosingClass) <ide> private void registerDeclaredConstructors(Class<?> type, RuntimeHints runtimeHin <ide> runtimeHints.reflection().registerType(type, INVOKE_DECLARED_CONSTRUCTORS); <ide> } <ide> <del> private void registerClasspathResources(String[] paths, RuntimeHints runtimeHints, ClassLoader classLoader) { <del> DefaultResourceLoader resourceLoader = new DefaultResourceLoader(classLoader); <del> Arrays.stream(paths) <del> .filter(path -> path.startsWith(CLASSPATH_URL_PREFIX)) <del> .map(resourceLoader::getResource) <del> .forEach(runtimeHints.resources()::registerResource); <del> } <del> <del> private void registerClasspathResourceDirectoryStructure(String directory, RuntimeHints runtimeHints) { <del> if (directory.startsWith(CLASSPATH_URL_PREFIX)) { <del> String pattern = directory.substring(CLASSPATH_URL_PREFIX.length()); <del> if (pattern.startsWith(SLASH)) { <del> pattern = pattern.substring(1); <del> } <del> if (!pattern.endsWith(SLASH)) { <del> pattern += SLASH; <del> } <del> pattern += "*"; <del> runtimeHints.resources().registerPattern(pattern); <del> } <del> } <del> <ide> }
4
Ruby
Ruby
simplify compatibility logic
5b38e891073fa324a09d31178c789b2453da54bf
<ide><path>Library/Homebrew/cxxstdlib.rb <ide> def compatible_with?(other) <ide> <ide> return false unless type == other.type <ide> <del> if apple_compiler? <del> return false unless other.apple_compiler? <del> else <del> return false if other.apple_compiler? <del> return false unless compiler.to_s[4..6] == other.compiler.to_s[4..6] <del> end <del> <del> true <add> apple_compiler? && other.apple_compiler? || <add> !other.apple_compiler? && compiler.to_s[4..6] == other.compiler.to_s[4..6] <ide> end <ide> <ide> def check_dependencies(formula, deps)
1
Text
Text
add documentation for creatediffiehellmangroup
11c52d9e9f4afa6659fd93021a8401c360e8870d
<ide><path>doc/api/crypto.md <ide> module): <ide> * `DH_UNABLE_TO_CHECK_GENERATOR` <ide> * `DH_NOT_SUITABLE_GENERATOR` <ide> <add>## Class: DiffieHellmanGroup <add><!-- YAML <add>added: v0.7.5 <add>--> <add> <add>The `DiffieHellmanGroup` class takes a well-known modp group as its argument but <add>otherwise works the same as `DiffieHellman`. <add> <add>```js <add>const name = 'modp1'; <add>const dh = crypto.createDiffieHellmanGroup(name); <add>``` <add> <add>`name` is taken from [RFC 2412][] (modp1 and 2) and [RFC 3526][]: <add>```console <add>$ perl -ne 'print "$1\n" if /"(modp\d+)"/' src/node_crypto_groups.h <add>modp1 # 768 bits <add>modp2 # 1024 bits <add>modp5 # 1536 bits <add>modp14 # 2048 bits <add>modp15 # etc. <add>modp16 <add>modp17 <add>modp18 <add>``` <add> <ide> ## Class: ECDH <ide> <!-- YAML <ide> added: v0.11.14 <ide> Creates a `DiffieHellman` key exchange object and generates a prime of <ide> `primeLength` bits using an optional specific numeric `generator`. <ide> If `generator` is not specified, the value `2` is used. <ide> <add>### crypto.createDiffieHellmanGroup(name) <add><!-- YAML <add>added: v0.9.3 <add>--> <add> <add>* `name` {string} <add>* Returns: {DiffieHellman} <add> <add>An alias for [`crypto.getDiffieHellman()`][] <add> <ide> ### crypto.createECDH(curveName) <ide> <!-- YAML <ide> added: v0.11.14 <ide> the `crypto`, `tls`, and `https` modules and are generally specific to OpenSSL. <ide> [`crypto.createSign()`]: #crypto_crypto_createsign_algorithm_options <ide> [`crypto.createVerify()`]: #crypto_crypto_createverify_algorithm_options <ide> [`crypto.getCurves()`]: #crypto_crypto_getcurves <add>[`crypto.getDiffieHellman()`]: #crypto_crypto_getdiffiehellman_groupname <ide> [`crypto.getHashes()`]: #crypto_crypto_gethashes <ide> [`crypto.privateDecrypt()`]: #crypto_crypto_privatedecrypt_privatekey_buffer <ide> [`crypto.privateEncrypt()`]: #crypto_crypto_privateencrypt_privatekey_buffer
1
Javascript
Javascript
update documentation on router logging
e142d7f522d4cfbf443102d0147da5cd41d4e957
<ide><path>packages/ember-application/lib/system/application.js <ide> var get = Ember.get, set = Ember.set, <ide> ### Routing <ide> <ide> In addition to creating your application's router, `Ember.Application` is <del> also responsible for telling the router when to start routing. <add> also responsible for telling the router when to start routing. Transitions <add> between routes can be logged with the LOG_TRANSITIONS flag: <add> <add> ```javascript <add> window.App = Ember.Application.create({ <add> LOG_TRANSITIONS: true <add> }); <add> ``` <ide> <ide> By default, the router will begin trying to translate the current URL into <ide> application state once the browser emits the `DOMContentReady` event. If you <ide> var get = Ember.get, set = Ember.set, <ide> <ide> If there is any setup required before routing begins, you can implement a <ide> `ready()` method on your app that will be invoked immediately before routing <del> begins: <del> <del> ```javascript <del> window.App = Ember.Application.create({ <del> ready: function() { <del> this.set('router.enableLogging', true); <del> } <del> }); <add> begins. <ide> <ide> To begin routing, you must have at a minimum a top-level controller and view. <ide> You define these as `App.ApplicationController` and `App.ApplicationView`,
1
PHP
PHP
fix collection json serializing logic
79f64b8929cf2d3d71eefddc6e284a1aea1d772f
<ide><path>src/Illuminate/Support/Collection.php <ide> public function toArray() <ide> */ <ide> public function jsonSerialize() <ide> { <del> return $this->toArray(); <add> return array_map(function ($value) { <add> if ($value instanceof JsonSerializable) { <add> return $value->jsonSerialize(); <add> } elseif ($value instanceof Arrayable) { <add> return $value->toArray(); <add> } else { <add> return $value; <add> } <add> }, $this->items); <ide> } <ide> <ide> /** <ide> public function jsonSerialize() <ide> */ <ide> public function toJson($options = 0) <ide> { <del> return json_encode($this->toArray(), $options); <add> return json_encode($this->jsonSerialize(), $options); <ide> } <ide> <ide> /** <ide><path>tests/Support/SupportCollectionTest.php <ide> public function testToArrayCallsToArrayOnEachItemInCollection() <ide> $this->assertEquals(['foo.array', 'bar.array'], $results); <ide> } <ide> <del> public function testToJsonEncodesTheToArrayResult() <add> public function testJsonSerializeCallsToArrayOrJsonSerializeOnEachItemInCollection() <ide> { <del> $c = $this->getMock('Illuminate\Support\Collection', ['toArray']); <del> $c->expects($this->once())->method('toArray')->will($this->returnValue('foo')); <add> $item1 = m::mock('JsonSerializable'); <add> $item1->shouldReceive('jsonSerialize')->once()->andReturn('foo.json'); <add> $item2 = m::mock('Illuminate\Contracts\Support\Arrayable'); <add> $item2->shouldReceive('toArray')->once()->andReturn('bar.array'); <add> $c = new Collection([$item1, $item2]); <add> $results = $c->jsonSerialize(); <add> <add> $this->assertEquals(['foo.json', 'bar.array'], $results); <add> } <add> <add> public function testToJsonEncodesTheJsonSerializeResult() <add> { <add> $c = $this->getMock('Illuminate\Support\Collection', ['jsonSerialize']); <add> $c->expects($this->once())->method('jsonSerialize')->will($this->returnValue('foo')); <ide> $results = $c->toJson(); <ide> <ide> $this->assertJsonStringEqualsJsonString(json_encode('foo'), $results); <ide> } <ide> <ide> public function testCastingToStringJsonEncodesTheToArrayResult() <ide> { <del> $c = $this->getMock('Illuminate\Database\Eloquent\Collection', ['toArray']); <del> $c->expects($this->once())->method('toArray')->will($this->returnValue('foo')); <add> $c = $this->getMock('Illuminate\Database\Eloquent\Collection', ['jsonSerialize']); <add> $c->expects($this->once())->method('jsonSerialize')->will($this->returnValue('foo')); <ide> <ide> $this->assertJsonStringEqualsJsonString(json_encode('foo'), (string) $c); <ide> }
2
PHP
PHP
add support for parsing multi-extensions
5d6a7c409f4ea8f1cf63a916b643d346adb106f1
<ide><path>src/Routing/Route/Route.php <ide> protected function _parseExtension($url) <ide> if (empty($this->_extensions)) { <ide> return [$url, null]; <ide> } <del> preg_match('/\.([0-9a-z]*)$/', $url, $match); <add> preg_match('/\.([0-9a-z\.]*)$/', $url, $match); <ide> if (empty($match[1])) { <ide> return [$url, null]; <ide> } <ide><path>tests/TestCase/Routing/Route/RouteTest.php <ide> public function testRouteParsingWithExtensions() <ide> $result = $route->parse('/posts/index.pdf', 'GET'); <ide> $this->assertFalse(isset($result['_ext'])); <ide> <del> $route->extensions(['pdf', 'json', 'xml']); <add> $route->extensions(['pdf', 'json', 'xml', 'xml.gz']); <ide> $result = $route->parse('/posts/index.pdf', 'GET'); <ide> $this->assertEquals('pdf', $result['_ext']); <ide> <ide> public function testRouteParsingWithExtensions() <ide> <ide> $result = $route->parse('/posts/index.xml', 'GET'); <ide> $this->assertEquals('xml', $result['_ext']); <add> <add> $result = $route->parse('/posts/index.xml.gz', 'GET'); <add> $this->assertEquals('xml.gz', $result['_ext']); <ide> } <ide> <ide> /** <ide> public function testMatchWithExtension() <ide> 'c' => 'd' <ide> ]); <ide> $this->assertEquals('/posts/view/1.json?id=b&c=d', $result); <add> <add> $result = $route->match([ <add> 'controller' => 'posts', <add> 'action' => 'index', <add> '_ext' => 'json.gz', <add> ]); <add> $this->assertEquals('/posts/index.json.gz', $result); <ide> } <ide> <ide> /**
2
Java
Java
fix timer issues
9204fdc371df0f4efc2e3bd17a5fc2839cc845e9
<ide><path>spring-web-reactive/src/main/java/org/springframework/http/server/reactive/UndertowHttpHandlerAdapter.java <ide> public RequestBodyPublisher(HttpServerExchange exchange, <ide> @Override <ide> public void subscribe(Subscriber<? super DataBuffer> subscriber) { <ide> if (subscriber == null) { <del> throw Exceptions.spec_2_13_exception(); <add> throw Exceptions.argumentIsNullException(); <ide> } <ide> if (this.subscriber != null) { <ide> subscriber.onError(new IllegalStateException("Only one subscriber allowed")); <ide><path>spring-web-reactive/src/test/java/org/springframework/http/server/reactive/AsyncIntegrationTests.java <ide> import reactor.core.publisher.Mono; <ide> import reactor.core.publisher.ProcessorGroup; <ide> import reactor.core.publisher.Processors; <add>import reactor.core.timer.Timer; <ide> import reactor.rx.Stream; <ide> <ide> import org.springframework.core.io.buffer.DataBufferAllocator;
2
Text
Text
update documentation for expose
8432224f0ef628b3da42def046e48f9635aa4b23
<ide><path>docs/sources/reference/builder.md <ide> default specified in `CMD`. <ide> The `EXPOSE` instructions informs Docker that the container will listen on the <ide> specified network ports at runtime. Docker uses this information to interconnect <ide> containers using links (see the [Docker User <del>Guide](/userguide/dockerlinks)). Note that `EXPOSE` only works for <del>inter-container links. It doesn't make ports accessible from the host. To <del>expose ports to the host, at runtime, <del>[use the `-p` flag](/userguide/dockerlinks). <add>Guide](/userguide/dockerlinks)) and to determine which ports to expose to the <add>host when [using the -P flag](/reference/run/#expose-incoming-ports). <add>**Note:** <add>`EXPOSE` doesn't define which ports can be exposed to the host or make ports <add>accessible from the host by default. To expose ports to the host, at runtime, <add>[use the `-p` flag](/userguide/dockerlinks) or <add>[the -P flag](/reference/run/#expose-incoming-ports). <ide> <ide> ## ENV <ide>
1
PHP
PHP
improve method mapping in behaviorregistry
193f89415657b9bdbbdec9bb5532d1f733768618
<ide><path>Cake/ORM/BehaviorRegistry.php <ide> protected function _create($class, $alias, $settings) { <ide> * Store the map of behavior methods and ensure there are no duplicates. <ide> * <ide> * Use the implementedEvents() method to exclude callback methods. <add> * In addition methods starting with `_` will be ignored, as will <add> * method declared on Cake\ORM\Behavior <ide> * <ide> * @param Cake\ORM\Behavior $instance <ide> * @return void <ide> * @throws Cake\Error\Exception when duplicate methods are connected. <ide> */ <ide> protected function _mapMethods(Behavior $instance, $class, $alias) { <ide> $events = $instance->implementedEvents(); <del> $methods = get_class_methods($instance); <add> <add> $reflection = new \ReflectionClass($instance); <add> $eventMethods = []; <ide> foreach ($events as $e => $binding) { <ide> if (is_array($binding) && isset($binding['callable']) && isset($binding['callable'])) { <ide> $binding = $binding['callable']; <ide> } <del> $index = array_search($binding, $methods); <del> unset($methods[$index]); <add> $eventMethods[$binding] = true; <ide> } <ide> <del> foreach ($methods as $method) { <del> $isFinder = substr($method, 0, 4) === 'find'; <del> if (($isFinder && isset($this->_finderMap[$method])) || isset($this->_methodMap[$method])) { <add> foreach ($reflection->getMethods(\ReflectionMethod::IS_PUBLIC) as $method) { <add> if ($method->getDeclaringClass()->getName() === 'Cake\ORM\Behavior') { <add> continue; <add> } <add> <add> $methodName = $method->getName(); <add> if (strpos($methodName, '_') === 0 || isset($eventMethods[$methodName])) { <add> continue; <add> } <add> $methodName = strtolower($methodName); <add> <add> if (isset($this->_finderMap[$methodName]) || isset($this->_methodMap[$methodName])) { <ide> $error = __d( <ide> 'cake_dev', <ide> '%s contains duplicate method "%s" which is already provided by %s', <ide> $class, <del> $method, <del> $this->_methodMap[$method] <add> $method->getName(), <add> $this->_methodMap[$methodName] <ide> ); <ide> throw new Error\Exception($error); <ide> } <add> <add> $isFinder = substr($methodName, 0, 4) === 'find'; <ide> if ($isFinder) { <del> $this->_finderMap[$method] = $alias; <add> $this->_finderMap[$methodName] = $alias; <ide> } else { <del> $this->_methodMap[$method] = $alias; <add> $this->_methodMap[$methodName] = $alias; <ide> } <ide> } <del> return $instance; <ide> } <ide> <ide> /** <ide> protected function _mapMethods(Behavior $instance, $class, $alias) { <ide> * @return boolean <ide> */ <ide> public function hasMethod($method) { <add> $method = strtolower($method); <ide> return isset($this->_methodMap[$method]); <ide> } <ide> <ide> public function hasMethod($method) { <ide> * @return boolean <ide> */ <ide> public function hasFinder($method) { <add> $method = strtolower($method); <ide> return isset($this->_finderMap[$method]); <ide> } <ide> <ide> public function hasFinder($method) { <ide> * @throws Cake\Error\Exception When the method is unknown. <ide> */ <ide> public function call($method, array $args = []) { <add> $method = strtolower($method); <ide> if ($this->hasMethod($method)) { <ide> $alias = $this->_methodMap[$method]; <ide> return call_user_func_array([$this->_loaded[$alias], $method], $args); <ide> } <add> <ide> if ($this->hasFinder($method)) { <ide> $alias = $this->_finderMap[$method]; <ide> return call_user_func_array([$this->_loaded[$alias], $method], $args); <ide> } <add> <ide> throw new Error\Exception(__d('cake_dev', 'Cannot call "%s" it does not belong to any attached behaviors.', $method)); <ide> } <ide> <ide><path>Cake/Test/TestApp/Plugin/TestPlugin/Model/Behavior/PersisterOneBehavior.php <ide> use Cake\ORM\Behavior; <ide> <ide> class PersisterOneBehavior extends Behavior { <add> <add> public function persist() { <add> } <add> <ide> } <ide><path>Cake/Test/TestCase/ORM/BehaviorRegistryTest.php <ide> public function tearDown() { <ide> * @return void <ide> */ <ide> public function testLoad() { <add> Plugin::load('TestPlugin'); <ide> $settings = ['alias' => 'Sluggable', 'replacement' => '-']; <ide> $result = $this->Behaviors->load('Sluggable', $settings); <ide> $this->assertInstanceOf('TestApp\Model\Behavior\SluggableBehavior', $result); <ide> $this->assertEquals($settings, $result->settings); <add> <add> $result = $this->Behaviors->load('TestPlugin.PersisterOne'); <add> $this->assertInstanceOf('TestPlugin\Model\Behavior\PersisterOneBehavior', $result); <ide> } <ide> <ide> /** <ide> public function testLoadDuplicateMethodError() { <ide> public function testHasMethod() { <ide> $this->Behaviors->load('Sluggable'); <ide> $this->assertTrue($this->Behaviors->hasMethod('slugify')); <add> $this->assertTrue($this->Behaviors->hasMethod('SLUGIFY')); <add> <add> $this->assertFalse($this->Behaviors->hasMethod('__construct')); <add> $this->assertFalse($this->Behaviors->hasMethod('settings')); <add> $this->assertFalse($this->Behaviors->hasMethod('implementedEvents')); <add> <ide> $this->assertFalse($this->Behaviors->hasMethod('nope')); <ide> $this->assertFalse($this->Behaviors->hasMethod('beforeFind')); <ide> $this->assertFalse($this->Behaviors->hasMethod('findNoSlug')); <ide> public function testHasFinder() { <ide> $this->Behaviors->load('Sluggable'); <ide> <ide> $this->assertTrue($this->Behaviors->hasFinder('findNoSlug')); <del> $this->assertFalse($this->Behaviors->hasFinder('findnoslug')); <del> $this->assertFalse($this->Behaviors->hasFinder('findnoslug')); <add> $this->assertTrue($this->Behaviors->hasFinder('findnoslug')); <add> $this->assertTrue($this->Behaviors->hasFinder('FINDNOSLUG')); <add> <ide> $this->assertFalse($this->Behaviors->hasFinder('slugify')); <add> $this->assertFalse($this->Behaviors->hasFinder('beforeFind')); <ide> $this->assertFalse($this->Behaviors->hasFinder('nope')); <ide> } <ide>
3
PHP
PHP
apply fixes from styleci
8f363c0e54661f5ea4fdd0dfca5e906b23db5667
<ide><path>src/Illuminate/Database/Eloquent/Concerns/QueriesRelationships.php <ide> use Closure; <ide> use Illuminate\Support\Arr; <ide> use Illuminate\Support\Str; <del>use Illuminate\Database\Query\Expression; <ide> use Illuminate\Database\Eloquent\Builder; <add>use Illuminate\Database\Query\Expression; <ide> use Illuminate\Database\Eloquent\Relations\Relation; <ide> use Illuminate\Database\Query\Builder as QueryBuilder; <ide>
1
PHP
PHP
fix a pile of api doc errors in database/
0ea10bf6e549b56dbdbeb0a7b60fe3e5905e33c8
<ide><path>src/Database/Connection.php <ide> public function configName() { <ide> * <ide> * If no params are passed it will return the current driver instance. <ide> * <del> * @param string|Driver $driver <add> * @param string|Driver $driver The driver instance to use. <ide> * @param array|null $config Either config for a new driver or null. <ide> * @throws \Cake\Database\Error\MissingDriverException When a driver class is missing. <ide> * @throws \Cake\Database\Error\MissingExtensionException When a driver's PHP extension is missing. <del> * @return Driver <add> * @return \Cake\Database\Driver <ide> */ <ide> public function driver($driver = null, $config = null) { <ide> if ($driver === null) { <ide> public function isConnected() { <ide> /** <ide> * Prepares a SQL statement to be executed. <ide> * <del> * @param string|\Cake\Database\Query $sql <add> * @param string|\Cake\Database\Query $sql The SQL to convert into a prepared statement. <ide> * @return \Cake\Database\StatementInterface <ide> */ <ide> public function prepare($sql) { <ide> public function run(Query $query) { <ide> /** <ide> * Executes a SQL statement and returns the Statement object as result. <ide> * <del> * @param string $sql <add> * @param string $sql The SQL query to execute. <ide> * @return \Cake\Database\StatementInterface <ide> */ <ide> public function query($sql) { <ide> public function query($sql) { <ide> /** <ide> * Create a new Query instance for this connection. <ide> * <del> * @return Query <add> * @return \Cake\Database\Query <ide> */ <ide> public function newQuery() { <ide> return new Query($this); <ide> public function rollback() { <ide> * `$connection->useSavePoints(false)` Disables usage of savepoints and returns false <ide> * `$connection->useSavePoints()` Returns current status <ide> * <del> * @param bool|null $enable <add> * @param bool|null $enable Whether or not save points should be used. <ide> * @return bool true if enabled, false otherwise <ide> */ <ide> public function useSavePoints($enable = null) { <ide> public function useSavePoints($enable = null) { <ide> /** <ide> * Creates a new save point for nested transactions. <ide> * <del> * @param string $name <add> * @param string $name The save point name. <ide> * @return void <ide> */ <ide> public function createSavePoint($name) { <ide> public function createSavePoint($name) { <ide> /** <ide> * Releases a save point by its name. <ide> * <del> * @param string $name <add> * @param string $name The save point name. <ide> * @return void <ide> */ <ide> public function releaseSavePoint($name) { <ide> public function releaseSavePoint($name) { <ide> /** <ide> * Rollback a save point by its name. <ide> * <del> * @param string $name <add> * @param string $name The save point name. <ide> * @return void <ide> */ <ide> public function rollbackSavepoint($name) { <ide> public function rollbackSavepoint($name) { <ide> * <ide> * {{{ <ide> * $connection->transactional(function($connection) { <del> * $connection->newQuery()->delete('users')->execute(); <add> * $connection->newQuery()->delete('users')->execute(); <ide> * }); <ide> * }}} <ide> * <ide> public function transactional(callable $callback) { <ide> /** <ide> * Quotes value to be used safely in database query. <ide> * <del> * @param mixed $value <add> * @param mixed $value The value to quote. <ide> * @param string $type Type to be used for determining kind of quoting to perform <ide> * @return mixed quoted value <ide> */ <ide> public function supportsQuoting() { <ide> * Quotes a database identifier (a column name, table name, etc..) to <ide> * be used safely in queries without the risk of using reserved words. <ide> * <del> * @param string $identifier <add> * @param string $identifier The identifier to quote. <ide> * @return string <ide> */ <ide> public function quoteIdentifier($identifier) { <ide><path>src/Database/Driver/PDODriverTrait.php <ide> protected function _connect(array $config) { <ide> * If first argument is passed, it will set internal conenction object or <ide> * result to the value passed <ide> * <del> * @param null|PDO instance $connection <add> * @param null|PDO instance $connection The PDO connection instance. <ide> * @return mixed connection object used internally <ide> */ <ide> public function connection($connection = null) { <ide> public function disconnect() { <ide> /** <ide> * Prepares a sql statement to be executed <ide> * <del> * @param string|\Cake\Database\Query $query <add> * @param string|\Cake\Database\Query $query The query to turn into a prepared statement. <ide> * @return \Cake\Database\StatementInterface <ide> */ <ide> public function prepare($query) { <ide> public function rollbackTransaction() { <ide> /** <ide> * Returns a value in a safe representation to be used in a query string <ide> * <del> * @param mixed $value <add> * @param mixed $value The value to quote. <ide> * @param string $type Type to be used for determining kind of quoting to perform <ide> * @return string <ide> */ <ide><path>src/Database/Driver/Postgres.php <ide> public function enabled() { <ide> /** <ide> * Sets connection encoding <ide> * <del> * @param string $encoding <add> * @param string $encoding The encoding to use. <ide> * @return void <ide> */ <ide> public function setEncoding($encoding) { <ide> public function setEncoding($encoding) { <ide> * Sets connection default schema, if any relation defined in a query is not fully qualified <ide> * postgres will fallback to looking the relation into defined default schema <ide> * <del> * @param string $schema <add> * @param string $schema The schema names to set `search_path` to. <ide> * @return void <ide> */ <ide> public function setSchema($schema) { <ide><path>src/Database/Driver/Sqlite.php <ide> public function enabled() { <ide> /** <ide> * Prepares a sql statement to be executed <ide> * <del> * @param string|\Cake\Database\Query $query <add> * @param string|\Cake\Database\Query $query The query to prepare. <ide> * @return \Cake\Database\StatementInterface <ide> */ <ide> public function prepare($query) { <ide><path>src/Database/Driver/Sqlserver.php <ide> public function enabled() { <ide> /** <ide> * Prepares a sql statement to be executed <ide> * <del> * @param string|\Cake\Database\Query $query <add> * @param string|\Cake\Database\Query $query The query to prepare. <ide> * @return \Cake\Database\StatementInterface <ide> */ <ide> public function prepare($query) { <ide><path>src/Database/Query.php <ide> public function select($fields = [], $overwrite = false) { <ide> * ##Examples: <ide> * <ide> * {{{ <del> * // Filters products with the same name and city <del> * $query->select(['name', 'city'])->from('products')->distinct(); <add> * // Filters products with the same name and city <add> * $query->select(['name', 'city'])->from('products')->distinct(); <ide> * <del> * // Filters products in the same city <del> * $query->distinct(['city']); <add> * // Filters products in the same city <add> * $query->distinct(['city']); <ide> * <del> * // Filter products with the same name <del> * $query->distinct(['name'], true); <add> * // Filter products with the same name <add> * $query->distinct(['name'], true); <ide> * }}} <ide> * <del> * @param array|ExpressionInterface fields to be filtered on <add> * @param array|ExpressionInterface $on fields to be filtered on <ide> * @param bool $overwrite whether to reset fields with passed list or not <del> * @return Query <add> * @return \Cake\Database\Query <ide> */ <ide> public function distinct($on = [], $overwrite = false) { <ide> if ($on === []) { <ide> public function distinct($on = [], $overwrite = false) { <ide> * ### Example: <ide> * <ide> * {{{ <del> * // Ignore cache query in MySQL <del> * $query->select(['name', 'city'])->from('products')->modifier('SQL_NO_CACHE'); <del> * // It will produce the SQL: SELECT SQL_NO_CACHE name, city FROM products <add> * // Ignore cache query in MySQL <add> * $query->select(['name', 'city'])->from('products')->modifier('SQL_NO_CACHE'); <add> * // It will produce the SQL: SELECT SQL_NO_CACHE name, city FROM products <ide> * <del> * // Or with multiple modifiers <del> * $query->select(['name', 'city'])->from('products')->modifier(['HIGH_PRIORITY', 'SQL_NO_CACHE']); <del> * // It will produce the SQL: SELECT HIGH_PRIORITY SQL_NO_CACHE name, city FROM products <add> * // Or with multiple modifiers <add> * $query->select(['name', 'city'])->from('products')->modifier(['HIGH_PRIORITY', 'SQL_NO_CACHE']); <add> * // It will produce the SQL: SELECT HIGH_PRIORITY SQL_NO_CACHE name, city FROM products <ide> * }}} <ide> * <ide> * @param array|ExpressionInterface|string $modifiers modifiers to be applied to the query <ide> * @param bool $overwrite whether to reset order with field list or not <del> * @return Query <add> * @return \Cake\Database\Query <ide> */ <ide> public function modifier($modifiers, $overwrite = false) { <ide> $this->_dirty(); <ide> public function join($tables = null, $types = [], $overwrite = false) { <ide> * If you use string conditions make sure that your values are correctly quoted. <ide> * The safest thing you can do is to never use string conditions. <ide> * <del> * @param string|array|ExpressionInterface|callback $conditions <add> * @param string|array|ExpressionInterface|callback $conditions The conditions to filter on. <ide> * @param array $types associative array of type names used to bind values to query <ide> * @param bool $overwrite whether to reset conditions with passed list or not <ide> * @see \Cake\Database\Type <ide> * @see \Cake\Database\QueryExpression <del> * @return Query <add> * @return \Cake\Database\Query <ide> */ <ide> public function where($conditions = null, $types = [], $overwrite = false) { <ide> if ($overwrite) { <ide> public function where($conditions = null, $types = [], $overwrite = false) { <ide> * ##Examples: <ide> * <ide> * {{{ <del> * $query->where(['title' => 'Hello World')->andWhere(['author_id' => 1]); <add> * $query->where(['title' => 'Hello World')->andWhere(['author_id' => 1]); <ide> * }}} <ide> * <ide> * Will produce: <ide> * <ide> * ``WHERE title = 'Hello World' AND author_id = 1`` <ide> * <ide> * {{{ <del> * $query <del> * ->where(['OR' => ['published' => false, 'published is NULL']]) <del> * ->andWhere(['author_id' => 1, 'comments_count >' => 10]) <add> * $query <add> * ->where(['OR' => ['published' => false, 'published is NULL']]) <add> * ->andWhere(['author_id' => 1, 'comments_count >' => 10]) <ide> * }}} <ide> * <ide> * Produces: <ide> * <ide> * ``WHERE (published = 0 OR published IS NULL) AND author_id = 1 AND comments_count > 10`` <ide> * <ide> * {{{ <del> * $query <del> * ->where(['title' => 'Foo']) <del> * ->andWhere(function($exp, $query) { <del> * return $exp <del> * ->add(['author_id' => 1]) <del> * ->or_(['author_id' => 2]); <del> * }); <add> * $query <add> * ->where(['title' => 'Foo']) <add> * ->andWhere(function($exp, $query) { <add> * return $exp <add> * ->add(['author_id' => 1]) <add> * ->or_(['author_id' => 2]); <add> * }); <ide> * }}} <ide> * <ide> * Generates the following conditions: <ide> * <ide> * ``WHERE (title = 'Foo') AND (author_id = 1 OR author_id = 2)`` <ide> * <del> * @param string|array|ExpressionInterface|callback $conditions <add> * @param string|array|ExpressionInterface|callback $conditions The conditions to add with AND. <ide> * @param array $types associative array of type names used to bind values to query <ide> * @see \Cake\Database\Query::where() <ide> * @see \Cake\Database\Type <del> * @return Query <add> * @return \Cake\Database\Query <ide> */ <ide> public function andWhere($conditions, $types = []) { <ide> $this->_conjugate('where', $conditions, 'AND', $types); <ide> public function andWhere($conditions, $types = []) { <ide> * ##Examples: <ide> * <ide> * {{{ <del> * $query->where(['title' => 'Hello World')->orWhere(['title' => 'Foo']); <add> * $query->where(['title' => 'Hello World')->orWhere(['title' => 'Foo']); <ide> * }}} <ide> * <ide> * Will produce: <ide> * <ide> * ``WHERE title = 'Hello World' OR title = 'Foo'`` <ide> * <ide> * {{{ <del> * $query <del> * ->where(['OR' => ['published' => false, 'published is NULL']]) <del> * ->orWhere(['author_id' => 1, 'comments_count >' => 10]) <add> * $query <add> * ->where(['OR' => ['published' => false, 'published is NULL']]) <add> * ->orWhere(['author_id' => 1, 'comments_count >' => 10]) <ide> * }}} <ide> * <ide> * Produces: <ide> * <ide> * ``WHERE (published = 0 OR published IS NULL) OR (author_id = 1 AND comments_count > 10)`` <ide> * <ide> * {{{ <del> * $query <del> * ->where(['title' => 'Foo']) <del> * ->orWhere(function($exp, $query) { <del> * return $exp <del> * ->add(['author_id' => 1]) <del> * ->or_(['author_id' => 2]); <del> * }); <add> * $query <add> * ->where(['title' => 'Foo']) <add> * ->orWhere(function($exp, $query) { <add> * return $exp <add> * ->add(['author_id' => 1]) <add> * ->or_(['author_id' => 2]); <add> * }); <ide> * }}} <ide> * <ide> * Generates the following conditions: <ide> * <ide> * ``WHERE (title = 'Foo') OR (author_id = 1 OR author_id = 2)`` <ide> * <del> * @param string|array|ExpressionInterface|callback $conditions <add> * @param string|array|ExpressionInterface|callback $conditions The conditions to add with OR. <ide> * @param array $types associative array of type names used to bind values to query <ide> * @see \Cake\Database\Query::where() <ide> * @see \Cake\Database\Type <del> * @return Query <add> * @return \Cake\Database\Query <ide> */ <ide> public function orWhere($conditions, $types = []) { <ide> $this->_conjugate('where', $conditions, 'OR', $types); <ide> public function orWhere($conditions, $types = []) { <ide> * ##Examples: <ide> * <ide> * {{{ <del> * $query->order(['title' => 'DESC', 'author_id' => 'ASC']); <add> * $query->order(['title' => 'DESC', 'author_id' => 'ASC']); <ide> * }}} <ide> * <ide> * Produces: <ide> * <ide> * ``ORDER BY title DESC, author_id ASC`` <ide> * <ide> * {{{ <del> * $query->order(['title' => 'DESC NULLS FIRST'])->order('author_id'); <add> * $query->order(['title' => 'DESC NULLS FIRST'])->order('author_id'); <ide> * }}} <ide> * <ide> * Will generate: <ide> * <ide> * ``ORDER BY title DESC NULLS FIRST, author_id`` <ide> * <ide> * {{{ <del> * $expression = $query->newExpr()->add(['id % 2 = 0']); <del> * $query->order($expression)->order(['title' => 'ASC']); <add> * $expression = $query->newExpr()->add(['id % 2 = 0']); <add> * $query->order($expression)->order(['title' => 'ASC']); <ide> * }}} <ide> * <ide> * Will become: <ide> * <ide> * ``ORDER BY (id %2 = 0), title ASC`` <ide> * <del> * @param array|ExpressionInterface|string $fields fields to be added to the list <add> * @param array|\Cake\Database\ExpressionInterface|string $fields fields to be added to the list <ide> * @param bool $overwrite whether to reset order with field list or not <del> * @return Query <add> * @return \Cake\Database\Query <ide> */ <ide> public function order($fields, $overwrite = false) { <ide> if ($overwrite) { <ide> public function order($fields, $overwrite = false) { <ide> * ##Examples: <ide> * <ide> * {{{ <del> * $query->group(['id', 'title']); // Produces GROUP BY id, title <del> * $query->group('title'); // Produces GROUP BY title <add> * // Produces GROUP BY id, title <add> * $query->group(['id', 'title']); <add> * <add> * // Produces GROUP BY title <add> * $query->group('title'); <ide> * }}} <ide> * <ide> * @param array|ExpressionInterface|string $fields fields to be added to the list <ide> * @param bool $overwrite whether to reset fields with passed list or not <del> * @return Query <add> * @return \Cake\Database\Query <ide> */ <ide> public function group($fields, $overwrite = false) { <ide> if ($overwrite) { <ide> public function group($fields, $overwrite = false) { <ide> <ide> /** <ide> * Adds a condition or set of conditions to be used in the HAVING clause for this <del> * query. This method operates in exactly the same way as the method ``where()`` <add> * query. This method operates in exactly the same way as the method `where()` <ide> * does. Please refer to its documentation for an insight on how to using each <ide> * parameter. <ide> * <del> * @param string|array|ExpressionInterface|callback $conditions <add> * @param string|array|ExpressionInterface|callback $conditions The having conditions. <ide> * @param array $types associative array of type names used to bind values to query <ide> * @param bool $overwrite whether to reset conditions with passed list or not <ide> * @see \Cake\Database\Query::where() <del> * @return Query <add> * @return \Cake\Database\Query <ide> */ <ide> public function having($conditions = null, $types = [], $overwrite = false) { <ide> if ($overwrite) { <ide> public function having($conditions = null, $types = [], $overwrite = false) { <ide> * the same way as the method ``andWhere()`` does. Please refer to its <ide> * documentation for an insight on how to using each parameter. <ide> * <del> * @param string|array|ExpressionInterface|callback $conditions <add> * @param string|array|ExpressionInterface|callback $conditions The AND conditions for HAVING. <ide> * @param array $types associative array of type names used to bind values to query <ide> * @see \Cake\Database\Query::andWhere() <del> * @return Query <add> * @return \Cake\Database\Query <ide> */ <ide> public function andHaving($conditions, $types = []) { <ide> $this->_conjugate('having', $conditions, 'AND', $types); <ide> public function andHaving($conditions, $types = []) { <ide> * the same way as the method ``orWhere()`` does. Please refer to its <ide> * documentation for an insight on how to using each parameter. <ide> * <del> * @param string|array|ExpressionInterface|callback $conditions <del> * @param array $types associative array of type names used to bind values to query <add> * @param string|array|ExpressionInterface|callback $conditions The OR conditions for HAVING. <add> * @param array $types associative array of type names used to bind values to query. <ide> * @see \Cake\Database\Query::orWhere() <del> * @return Query <add> * @return \Cake\Database\Query <ide> */ <ide> public function orHaving($conditions, $types = []) { <ide> $this->_conjugate('having', $conditions, 'OR', $types); <ide> public function orHaving($conditions, $types = []) { <ide> * Pages should start at 1. <ide> * <ide> * @param int $num The page number you want. <del> * @return Query <add> * @return \Cake\Database\Query <ide> */ <ide> public function page($num) { <ide> $limit = $this->clause('limit'); <ide> public function page($num) { <ide> * ## Examples <ide> * <ide> * {{{ <del> * $query->limit(10) // generates LIMIT 10 <del> * $query->limit($query->newExpr()->add(['1 + 1'])); // LIMIT (1 + 1) <add> * $query->limit(10) // generates LIMIT 10 <add> * $query->limit($query->newExpr()->add(['1 + 1'])); // LIMIT (1 + 1) <ide> * }}} <ide> * <ide> * @param int|ExpressionInterface $num number of records to be returned <del> * @return Query <add> * @return \Cake\Database\Query <ide> */ <ide> public function limit($num) { <ide> $this->_dirty(); <ide> public function delete($table = null) { <ide> * {{{ <ide> * $query->select('id')->where(['author_id' => 1])->epilog('FOR UPDATE'); <ide> * $query <del> * ->insert('articles', ['title']) <del> * ->values(['author_id' => 1]) <del> * ->epilog('RETURNING id'); <add> * ->insert('articles', ['title']) <add> * ->values(['author_id' => 1]) <add> * ->epilog('RETURNING id'); <ide> * }}} <ide> * <del> * @param string|QueryExpression the expression to be appended <del> * @return Query <add> * @param string|\Cake\Database\QueryExpression $expression The expression to be appended <add> * @return \Cake\Database\Query <ide> */ <ide> public function epilog($expression = null) { <ide> $this->_dirty(); <ide> public function type() { <ide> * this function in subclasses to use a more specialized QueryExpression class <ide> * if required. <ide> * <del> * @return QueryExpression <add> * @return \Cake\Database\QueryExpression <ide> */ <ide> public function newExpr() { <ide> return new QueryExpression([], $this->typeMap()); <ide> public function newExpr() { <ide> * $query->func()->dateDiff(['2012-01-05', '2012-01-02']) <ide> * }}} <ide> * <del> * @return FunctionsBuilder <add> * @return \Cake\Database\FunctionsBuilder <ide> */ <ide> public function func() { <ide> if (empty($this->_functionsBuilder)) { <ide> public function clause($name) { <ide> * ## Example <ide> * <ide> * {{{ <del> * $query->decorateResults(function($row) { <del> * $row['order_total'] = $row['subtotal'] + ($row['subtotal'] * $row['tax']); <del> * return $row; <del> * }); <add> * $query->decorateResults(function($row) { <add> * $row['order_total'] = $row['subtotal'] + ($row['subtotal'] * $row['tax']); <add> * return $row; <add> * }); <ide> * }}} <ide> * <del> * @param null|callable $callback <del> * @param bool $overwrite <del> * @return Query <add> * @param null|callable $callback The callback to invoke when results are fetched. <add> * @param bool $overwrite Whether or not this should append or replace all existing decorators. <add> * @return \Cake\Database\Query <ide> */ <ide> public function decorateResults($callback, $overwrite = false) { <ide> if ($overwrite) { <ide> public function decorateResults($callback, $overwrite = false) { <ide> * <ide> * @param callable $callback the function to be executed for each ExpressionInterface <ide> * found inside this query. <del> * @return Query <add> * @return \Cake\Database\Query <ide> */ <ide> public function traverseExpressions(callable $callback) { <ide> $visitor = function($expression) use (&$visitor, $callback) { <ide> public function traverseExpressions(callable $callback) { <ide> * will create several placeholders of type string. <ide> * <ide> * @param string|int $param placeholder to be replaced with quoted version <del> * of $value <add> * of $value <ide> * @param mixed $value The value to be bound <ide> * @param string|int $type the mapped type name, used for casting when sending <del> * to database <del> * @return Query <add> * to database <add> * @return \Cake\Database\Query <ide> */ <ide> public function bind($param, $value, $type = 'string') { <ide> $this->valueBinder()->bind($param, $value, $type); <ide> public function bind($param, $value, $type = 'string') { <ide> * associate values to those placeholders so that they can be passed correctly <ide> * statement object. <ide> * <del> * @param ValueBinder $binder new instance to be set. If no value is passed the <del> * default one will be returned <del> * @return Query|\Cake\Database\ValueBinder <add> * @param \Cake\Database\ValueBinder $binder new instance to be set. If no value is passed the <add> * default one will be returned <add> * @return \Cake\Database\Query|\Cake\Database\ValueBinder <ide> */ <ide> public function valueBinder($binder = null) { <ide> if ($binder === null) { <ide><path>src/Database/TypeConverterTrait.php <ide> trait TypeConverterTrait { <ide> * Converts a give value to a suitable database value based on type <ide> * and return relevant internal statement type <ide> * <del> * @param mixed $value <del> * @param string $type <add> * @param mixed $value The value to cast <add> * @param \Cake\Database\Type|string $type The type name or type instance to use. <ide> * @return array list containing converted value and internal type <ide> */ <ide> public function cast($value, $type) {
7