content_type
stringclasses
8 values
main_lang
stringclasses
7 values
message
stringlengths
1
50
sha
stringlengths
40
40
patch
stringlengths
52
962k
file_count
int64
1
300
Javascript
Javascript
use string instead of regexp in split()
0fdb67be9f7b973db68d397121bf80959a60836c
<ide><path>test/parallel/test-http-outgoing-first-chunk-singlebyte-encoding.js <ide> for (const enc of ['utf8', 'utf16le', 'latin1', 'UTF-8']) { <ide> const headerEnd = received.indexOf('\r\n\r\n', 'utf8'); <ide> assert.notStrictEqual(headerEnd, -1); <ide> <del> const header = received.toString('utf8', 0, headerEnd).split(/\r\n/); <add> const header = received.toString('utf8', 0, headerEnd).split('\r\n'); <ide> const body = received.toString(enc, headerEnd + 4); <ide> <ide> assert.strictEqual(header[0], 'HTTP/1.1 200 OK'); <ide><path>test/parallel/test-repl-setprompt.js <ide> child.stdin.end(`e.setPrompt("${p}");${os.EOL}`); <ide> child.on('close', function(code, signal) { <ide> assert.strictEqual(code, 0); <ide> assert.ok(!signal); <del> const lines = data.split(/\n/); <add> const lines = data.split('\n'); <ide> assert.strictEqual(lines.pop(), p); <ide> }); <ide><path>test/parallel/test-stdin-script-child.js <ide> for (const args of [[], ['-']]) { <ide> <ide> child.stderr.setEncoding('utf8'); <ide> child.stderr.on('data', function(c) { <del> console.error(`> ${c.trim().split(/\n/).join('\n> ')}`); <add> console.error(`> ${c.trim().split('\n').join('\n> ')}`); <ide> }); <ide> <ide> child.on('close', common.mustCall(function(c) {
3
Javascript
Javascript
remove compatibly mode for node.buffer
d2b1bca5d9aefc059479bd3073461e16f759c6e5
<ide><path>lib/WebpackOptionsDefaulter.js <ide> function WebpackOptionsDefaulter() { <ide> this.set("node.console", false); <ide> this.set("node.process", true); <ide> this.set("node.global", true); <del> // TODO: add this in next major version <del> // this.set("node.Buffer", true); <add> this.set("node.Buffer", true); <ide> this.set("node.setImmediate", true); <ide> this.set("node.__filename", "mock"); <ide> this.set("node.__dirname", "mock"); <ide><path>lib/node/NodeSourcePlugin.js <ide> NodeSourcePlugin.prototype.apply = function(compiler) { <ide> }); <ide> } <ide> var bufferType = this.options.Buffer <del> if(typeof bufferType === "undefined") { <del> bufferType = this.options.buffer; <del> if(typeof bufferType === "undefined") <del> bufferType = true; <del> } <ide> if(bufferType) { <ide> compiler.parser.plugin("expression Buffer", function(expr) { <ide> return ModuleParserHelpers.addParsedVariable(this, "Buffer", "require(" + JSON.stringify(getPathToModule("buffer", bufferType)) + ").Buffer"); <ide><path>test/configCases/target/buffer-backward/index.js <del>require("should"); <del> <del>it("should provide a global Buffer shim", function () { <del> (typeof Buffer).should.be.eql("undefined"); <del>}); <del> <del>it("should fail on the buffer module", function () { <del> (function(argument) { <del> try { <del> require("buffer"); <del> } catch(e) { throw e; } <del> }).should.throw(); <del>}); <ide><path>test/configCases/target/buffer-backward/warnings.js <del>module.exports = [ <del> [/Cannot resolve module 'buffer'/], <del>]; <ide><path>test/configCases/target/buffer-backward/webpack.config.js <del>module.exports = { <del> target: "web", <del> node: { <del> buffer: false <del> } <del>}; <add><path>test/configCases/target/buffer-default/index.js <del><path>test/configCases/target/buffer-backward2/index.js <ide> require("should"); <ide> <ide> it("should provide a global Buffer shim", function () { <del> Buffer.should.be.a.Function; <add> Buffer.should.be.an.Function; <ide> }); <ide> <ide> it("should provide the buffer module", function () { <del> require("buffer").should.be.an.Object; <add> var buffer = require("buffer"); <add> (typeof buffer).should.be.eql("object"); <ide> }); <add><path>test/configCases/target/buffer-default/webpack.config.js <del><path>test/configCases/target/buffer-backward2/webpack.config.js <ide> module.exports = { <ide> target: "web", <del> node: { <del> buffer: true <del> } <ide> };
7
Text
Text
add backticks around method names
25f5d0913dbc627ab18bd16f95a757b1d083b9e3
<ide><path>activerecord/CHANGELOG.md <ide> <ide> *Ryuta Kamizono* <ide> <del>* Add the touch option to ActiveRecord#increment! and decrement!. <add>* Add the touch option to `#increment!` and `#decrement!`. <ide> <ide> *Hiroaki Izu* <ide>
1
Go
Go
add a test for warning on empty continuation lines
b47b375cb8bb0dca7ee0ebfa093bfc163ad867fb
<ide><path>builder/dockerfile/builder.go <ide> func (b *Builder) build(source builder.Source, dockerfile *parser.Result) (*buil <ide> return nil, errors.Errorf("failed to reach build target %s in Dockerfile", b.options.Target) <ide> } <ide> <add> dockerfile.PrintWarnings(b.Stderr) <ide> b.buildArgs.WarnOnUnusedBuildArgs(b.Stderr) <ide> <ide> if dispatchState.imageID == "" { <ide><path>builder/dockerfile/parser/parser.go <ide> type Result struct { <ide> Warnings []string <ide> } <ide> <add>// PrintWarnings to the writer <add>func (r *Result) PrintWarnings(out io.Writer) { <add> if len(r.Warnings) == 0 { <add> return <add> } <add> fmt.Fprintf(out, strings.Join(r.Warnings, "\n")+"\n") <add>} <add> <ide> // Parse reads lines from a Reader, parses the lines into an AST and returns <ide> // the AST and escape token <ide> func Parse(rwc io.Reader) (*Result, error) { <ide> func Parse(rwc io.Reader) (*Result, error) { <ide> AST: root, <ide> Warnings: warnings, <ide> EscapeToken: d.escapeToken, <del> Platform: d.platformToken, <add> Platform: d.platformToken, <ide> }, nil <ide> } <ide> <ide><path>builder/dockerfile/parser/parser_test.go <ide> func getDirs(t *testing.T, dir string) []string { <ide> return dirs <ide> } <ide> <del>func TestTestNegative(t *testing.T) { <add>func TestParseErrorCases(t *testing.T) { <ide> for _, dir := range getDirs(t, negativeTestDir) { <ide> dockerfile := filepath.Join(negativeTestDir, dir, "Dockerfile") <ide> <ide> df, err := os.Open(dockerfile) <del> require.NoError(t, err) <add> require.NoError(t, err, dockerfile) <ide> defer df.Close() <ide> <ide> _, err = Parse(df) <del> assert.Error(t, err) <add> assert.Error(t, err, dockerfile) <ide> } <ide> } <ide> <del>func TestTestData(t *testing.T) { <add>func TestParseCases(t *testing.T) { <ide> for _, dir := range getDirs(t, testDir) { <ide> dockerfile := filepath.Join(testDir, dir, "Dockerfile") <ide> resultfile := filepath.Join(testDir, dir, "result") <ide> <ide> df, err := os.Open(dockerfile) <del> require.NoError(t, err) <add> require.NoError(t, err, dockerfile) <ide> defer df.Close() <ide> <ide> result, err := Parse(df) <del> require.NoError(t, err) <add> require.NoError(t, err, dockerfile) <ide> <ide> content, err := ioutil.ReadFile(resultfile) <del> require.NoError(t, err) <add> require.NoError(t, err, resultfile) <ide> <ide> if runtime.GOOS == "windows" { <ide> // CRLF --> CR to match Unix behavior <ide> content = bytes.Replace(content, []byte{'\x0d', '\x0a'}, []byte{'\x0a'}, -1) <ide> } <del> <del> assert.Contains(t, result.AST.Dump()+"\n", string(content), "In "+dockerfile) <add> assert.Equal(t, result.AST.Dump()+"\n", string(content), "In "+dockerfile) <ide> } <ide> } <ide> <ide> func TestParseWords(t *testing.T) { <ide> } <ide> } <ide> <del>func TestLineInformation(t *testing.T) { <add>func TestParseIncludesLineNumbers(t *testing.T) { <ide> df, err := os.Open(testFileLineInfo) <ide> require.NoError(t, err) <ide> defer df.Close() <ide> func TestLineInformation(t *testing.T) { <ide> require.NoError(t, err) <ide> <ide> ast := result.AST <del> if ast.StartLine != 5 || ast.endLine != 31 { <del> fmt.Fprintf(os.Stderr, "Wrong root line information: expected(%d-%d), actual(%d-%d)\n", 5, 31, ast.StartLine, ast.endLine) <del> t.Fatal("Root line information doesn't match result.") <del> } <add> assert.Equal(t, 5, ast.StartLine) <add> assert.Equal(t, 31, ast.endLine) <ide> assert.Len(t, ast.Children, 3) <ide> expected := [][]int{ <ide> {5, 5}, <ide> {11, 12}, <ide> {17, 31}, <ide> } <ide> for i, child := range ast.Children { <del> if child.StartLine != expected[i][0] || child.endLine != expected[i][1] { <del> t.Logf("Wrong line information for child %d: expected(%d-%d), actual(%d-%d)\n", <del> i, expected[i][0], expected[i][1], child.StartLine, child.endLine) <del> t.Fatal("Root line information doesn't match result.") <del> } <add> msg := fmt.Sprintf("Child %d", i) <add> assert.Equal(t, expected[i], []int{child.StartLine, child.endLine}, msg) <ide> } <ide> } <add> <add>func TestParseWarnsOnEmptyContinutationLine(t *testing.T) { <add> dockerfile := bytes.NewBufferString(` <add>FROM alpine:3.6 <add> <add>RUN something \ <add> <add> following \ <add> <add> more <add> <add>RUN another \ <add> <add> thing <add> `) <add> <add> result, err := Parse(dockerfile) <add> require.NoError(t, err) <add> warnings := result.Warnings <add> assert.Len(t, warnings, 3) <add> assert.Contains(t, warnings[0], "Empty continuation line found in") <add> assert.Contains(t, warnings[0], "RUN something following more") <add> assert.Contains(t, warnings[1], "RUN another thing") <add> assert.Contains(t, warnings[2], "will become errors in a future release") <add>} <ide><path>builder/remotecontext/detect.go <ide> func newURLRemote(url string, dockerfilePath string, progressReader func(in io.R <ide> return progressReader(rc), nil <ide> }, <ide> }) <del> if err != nil { <del> if err == dockerfileFoundErr { <del> res, err := parser.Parse(dockerfile) <del> if err != nil { <del> return nil, nil, err <del> } <del> return nil, res, nil <del> } <add> switch { <add> case err == dockerfileFoundErr: <add> res, err := parser.Parse(dockerfile) <add> return nil, res, err <add> case err != nil: <ide> return nil, nil, err <ide> } <del> <ide> return withDockerfileFromContext(c.(modifiableContext), dockerfilePath) <ide> } <ide>
4
Go
Go
remove package pkg/ulimit, use go-units instead
83237aab2b9430a88790467867505cc9a5147f3e
<ide><path>api/server/router/build/build_routes.go <ide> import ( <ide> "github.com/docker/docker/pkg/ioutils" <ide> "github.com/docker/docker/pkg/progress" <ide> "github.com/docker/docker/pkg/streamformatter" <del> "github.com/docker/docker/pkg/ulimit" <ide> "github.com/docker/docker/reference" <ide> "github.com/docker/docker/utils" <add> "github.com/docker/go-units" <ide> "golang.org/x/net/context" <ide> ) <ide> <ide> func (br *buildRouter) postBuild(ctx context.Context, w http.ResponseWriter, r * <ide> buildConfig.Isolation = i <ide> } <ide> <del> var buildUlimits = []*ulimit.Ulimit{} <add> var buildUlimits = []*units.Ulimit{} <ide> ulimitsJSON := r.FormValue("ulimits") <ide> if ulimitsJSON != "" { <ide> if err := json.NewDecoder(strings.NewReader(ulimitsJSON)).Decode(&buildUlimits); err != nil { <ide><path>api/types/client.go <ide> import ( <ide> <ide> "github.com/docker/docker/api/types/container" <ide> "github.com/docker/docker/api/types/filters" <del> "github.com/docker/docker/pkg/ulimit" <add> "github.com/docker/go-units" <ide> ) <ide> <ide> // ContainerAttachOptions holds parameters to attach to a container. <ide> type ImageBuildOptions struct { <ide> CgroupParent string <ide> ShmSize string <ide> Dockerfile string <del> Ulimits []*ulimit.Ulimit <add> Ulimits []*units.Ulimit <ide> BuildArgs []string <ide> AuthConfigs map[string]AuthConfig <ide> Context io.Reader <ide><path>api/types/container/host_config.go <ide> import ( <ide> <ide> "github.com/docker/docker/api/types/blkiodev" <ide> "github.com/docker/docker/api/types/strslice" <del> "github.com/docker/docker/pkg/ulimit" <ide> "github.com/docker/go-connections/nat" <add> "github.com/docker/go-units" <ide> ) <ide> <ide> // NetworkMode represents the container network stack. <ide> type Resources struct { <ide> BlkioDeviceWriteBps []*blkiodev.ThrottleDevice <ide> BlkioDeviceReadIOps []*blkiodev.ThrottleDevice <ide> BlkioDeviceWriteIOps []*blkiodev.ThrottleDevice <del> CPUPeriod int64 `json:"CpuPeriod"` // CPU CFS (Completely Fair Scheduler) period <del> CPUQuota int64 `json:"CpuQuota"` // CPU CFS (Completely Fair Scheduler) quota <del> CpusetCpus string // CpusetCpus 0-2, 0,1 <del> CpusetMems string // CpusetMems 0-2, 0,1 <del> Devices []DeviceMapping // List of devices to map inside the container <del> KernelMemory int64 // Kernel memory limit (in bytes) <del> Memory int64 // Memory limit (in bytes) <del> MemoryReservation int64 // Memory soft limit (in bytes) <del> MemorySwap int64 // Total memory usage (memory + swap); set `-1` to disable swap <del> MemorySwappiness *int64 // Tuning container memory swappiness behaviour <del> OomKillDisable bool // Whether to disable OOM Killer or not <del> Ulimits []*ulimit.Ulimit // List of ulimits to be set in the container <add> CPUPeriod int64 `json:"CpuPeriod"` // CPU CFS (Completely Fair Scheduler) period <add> CPUQuota int64 `json:"CpuQuota"` // CPU CFS (Completely Fair Scheduler) quota <add> CpusetCpus string // CpusetCpus 0-2, 0,1 <add> CpusetMems string // CpusetMems 0-2, 0,1 <add> Devices []DeviceMapping // List of devices to map inside the container <add> KernelMemory int64 // Kernel memory limit (in bytes) <add> Memory int64 // Memory limit (in bytes) <add> MemoryReservation int64 // Memory soft limit (in bytes) <add> MemorySwap int64 // Total memory usage (memory + swap); set `-1` to disable swap <add> MemorySwappiness *int64 // Tuning container memory swappiness behaviour <add> OomKillDisable bool // Whether to disable OOM Killer or not <add> Ulimits []*units.Ulimit // List of ulimits to be set in the container <ide> } <ide> <ide> // HostConfig the non-portable Config structure of a container. <ide><path>builder/dockerfile/builder.go <ide> import ( <ide> "github.com/docker/docker/builder" <ide> "github.com/docker/docker/builder/dockerfile/parser" <ide> "github.com/docker/docker/pkg/stringid" <del> "github.com/docker/docker/pkg/ulimit" <add> "github.com/docker/go-units" <ide> ) <ide> <ide> var validCommitCommands = map[string]bool{ <ide> type Config struct { <ide> CPUSetCpus string <ide> CPUSetMems string <ide> CgroupParent string <del> Ulimits []*ulimit.Ulimit <add> Ulimits []*units.Ulimit <ide> } <ide> <ide> // Builder is a Dockerfile builder <ide><path>daemon/container_operations_unix.go <ide> import ( <ide> "github.com/docker/docker/pkg/idtools" <ide> "github.com/docker/docker/pkg/mount" <ide> "github.com/docker/docker/pkg/stringid" <del> "github.com/docker/docker/pkg/ulimit" <ide> "github.com/docker/docker/runconfig" <add> "github.com/docker/go-units" <ide> "github.com/docker/libnetwork" <ide> "github.com/docker/libnetwork/netlabel" <ide> "github.com/docker/libnetwork/options" <ide> func (daemon *Daemon) populateCommand(c *container.Container, env []string) erro <ide> <ide> autoCreatedDevices := mergeDevices(configs.DefaultAutoCreatedDevices, userSpecifiedDevices) <ide> <del> var rlimits []*ulimit.Rlimit <add> var rlimits []*units.Rlimit <ide> ulimits := c.HostConfig.Ulimits <ide> <ide> // Merge ulimits with daemon defaults <del> ulIdx := make(map[string]*ulimit.Ulimit) <add> ulIdx := make(map[string]*units.Ulimit) <ide> for _, ul := range ulimits { <ide> ulIdx[ul.Name] = ul <ide> } <ide><path>daemon/execdriver/driver_unix.go <ide> import ( <ide> "github.com/docker/docker/daemon/execdriver/native/template" <ide> "github.com/docker/docker/pkg/idtools" <ide> "github.com/docker/docker/pkg/mount" <del> "github.com/docker/docker/pkg/ulimit" <add> "github.com/docker/go-units" <ide> "github.com/opencontainers/runc/libcontainer" <ide> "github.com/opencontainers/runc/libcontainer/cgroups/fs" <ide> "github.com/opencontainers/runc/libcontainer/configs" <ide> type Resources struct { <ide> CpusetCpus string `json:"cpuset_cpus"` <ide> CpusetMems string `json:"cpuset_mems"` <ide> CPUPeriod int64 `json:"cpu_period"` <del> Rlimits []*ulimit.Rlimit `json:"rlimits"` <add> Rlimits []*units.Rlimit `json:"rlimits"` <ide> OomKillDisable bool `json:"oom_kill_disable"` <ide> MemorySwappiness int64 `json:"memory_swappiness"` <ide> } <ide><path>integration-cli/docker_cli_build_unix_test.go <ide> import ( <ide> "strings" <ide> <ide> "github.com/docker/docker/pkg/integration/checker" <del> "github.com/docker/docker/pkg/ulimit" <add> "github.com/docker/go-units" <ide> "github.com/go-check/check" <ide> ) <ide> <ide> func (s *DockerSuite) TestBuildResourceConstraintsAreUsed(c *check.C) { <ide> CpusetMems string <ide> CPUShares int64 <ide> CPUQuota int64 <del> Ulimits []*ulimit.Ulimit <add> Ulimits []*units.Ulimit <ide> } <ide> <ide> cfg, err := inspectFieldJSON(cID, "HostConfig") <ide><path>pkg/ulimit/ulimit.go <del>// Package ulimit provides structure and helper function to parse and represent <del>// resource limits (Rlimit and Ulimit, its human friendly version). <del>package ulimit <del> <del>import ( <del> "fmt" <del> "strconv" <del> "strings" <del>) <del> <del>// Ulimit is a human friendly version of Rlimit. <del>type Ulimit struct { <del> Name string <del> Hard int64 <del> Soft int64 <del>} <del> <del>// Rlimit specifies the resource limits, such as max open files. <del>type Rlimit struct { <del> Type int `json:"type,omitempty"` <del> Hard uint64 `json:"hard,omitempty"` <del> Soft uint64 `json:"soft,omitempty"` <del>} <del> <del>const ( <del> // magic numbers for making the syscall <del> // some of these are defined in the syscall package, but not all. <del> // Also since Windows client doesn't get access to the syscall package, need to <del> // define these here <del> rlimitAs = 9 <del> rlimitCore = 4 <del> rlimitCPU = 0 <del> rlimitData = 2 <del> rlimitFsize = 1 <del> rlimitLocks = 10 <del> rlimitMemlock = 8 <del> rlimitMsgqueue = 12 <del> rlimitNice = 13 <del> rlimitNofile = 7 <del> rlimitNproc = 6 <del> rlimitRss = 5 <del> rlimitRtprio = 14 <del> rlimitRttime = 15 <del> rlimitSigpending = 11 <del> rlimitStack = 3 <del>) <del> <del>var ulimitNameMapping = map[string]int{ <del> //"as": rlimitAs, // Disabled since this doesn't seem usable with the way Docker inits a container. <del> "core": rlimitCore, <del> "cpu": rlimitCPU, <del> "data": rlimitData, <del> "fsize": rlimitFsize, <del> "locks": rlimitLocks, <del> "memlock": rlimitMemlock, <del> "msgqueue": rlimitMsgqueue, <del> "nice": rlimitNice, <del> "nofile": rlimitNofile, <del> "nproc": rlimitNproc, <del> "rss": rlimitRss, <del> "rtprio": rlimitRtprio, <del> "rttime": rlimitRttime, <del> "sigpending": rlimitSigpending, <del> "stack": rlimitStack, <del>} <del> <del>// Parse parses and returns a Ulimit from the specified string. <del>func Parse(val string) (*Ulimit, error) { <del> parts := strings.SplitN(val, "=", 2) <del> if len(parts) != 2 { <del> return nil, fmt.Errorf("invalid ulimit argument: %s", val) <del> } <del> <del> if _, exists := ulimitNameMapping[parts[0]]; !exists { <del> return nil, fmt.Errorf("invalid ulimit type: %s", parts[0]) <del> } <del> <del> limitVals := strings.SplitN(parts[1], ":", 2) <del> if len(limitVals) > 2 { <del> return nil, fmt.Errorf("too many limit value arguments - %s, can only have up to two, `soft[:hard]`", parts[1]) <del> } <del> <del> soft, err := strconv.ParseInt(limitVals[0], 10, 64) <del> if err != nil { <del> return nil, err <del> } <del> <del> hard := soft // in case no hard was set <del> if len(limitVals) == 2 { <del> hard, err = strconv.ParseInt(limitVals[1], 10, 64) <del> } <del> if soft > hard { <del> return nil, fmt.Errorf("ulimit soft limit must be less than or equal to hard limit: %d > %d", soft, hard) <del> } <del> <del> return &Ulimit{Name: parts[0], Soft: soft, Hard: hard}, nil <del>} <del> <del>// GetRlimit returns the RLimit corresponding to Ulimit. <del>func (u *Ulimit) GetRlimit() (*Rlimit, error) { <del> t, exists := ulimitNameMapping[u.Name] <del> if !exists { <del> return nil, fmt.Errorf("invalid ulimit name %s", u.Name) <del> } <del> <del> return &Rlimit{Type: t, Soft: uint64(u.Soft), Hard: uint64(u.Hard)}, nil <del>} <del> <del>func (u *Ulimit) String() string { <del> return fmt.Sprintf("%s=%d:%d", u.Name, u.Soft, u.Hard) <del>} <ide><path>pkg/ulimit/ulimit_test.go <del>package ulimit <del> <del>import "testing" <del> <del>func TestParseValid(t *testing.T) { <del> u1 := &Ulimit{"nofile", 1024, 512} <del> if u2, _ := Parse("nofile=512:1024"); *u1 != *u2 { <del> t.Fatalf("expected %q, but got %q", u1, u2) <del> } <del>} <del> <del>func TestParseInvalidLimitType(t *testing.T) { <del> if _, err := Parse("notarealtype=1024:1024"); err == nil { <del> t.Fatalf("expected error on invalid ulimit type") <del> } <del>} <del> <del>func TestParseBadFormat(t *testing.T) { <del> if _, err := Parse("nofile:1024:1024"); err == nil { <del> t.Fatal("expected error on bad syntax") <del> } <del> <del> if _, err := Parse("nofile"); err == nil { <del> t.Fatal("expected error on bad syntax") <del> } <del> <del> if _, err := Parse("nofile="); err == nil { <del> t.Fatal("expected error on bad syntax") <del> } <del> if _, err := Parse("nofile=:"); err == nil { <del> t.Fatal("expected error on bad syntax") <del> } <del> if _, err := Parse("nofile=:1024"); err == nil { <del> t.Fatal("expected error on bad syntax") <del> } <del>} <del> <del>func TestParseHardLessThanSoft(t *testing.T) { <del> if _, err := Parse("nofile:1024:1"); err == nil { <del> t.Fatal("expected error on hard limit less than soft limit") <del> } <del>} <del> <del>func TestParseInvalidValueType(t *testing.T) { <del> if _, err := Parse("nofile:asdf"); err == nil { <del> t.Fatal("expected error on bad value type") <del> } <del>} <del> <del>func TestStringOutput(t *testing.T) { <del> u := &Ulimit{"nofile", 1024, 512} <del> if s := u.String(); s != "nofile=512:1024" { <del> t.Fatal("expected String to return nofile=512:1024, but got", s) <del> } <del>}
9
Javascript
Javascript
allow falsy values in url parameters
4909d1d39d61d6945a0820a5a7276c1e657ba262
<ide><path>src/ngResource/resource.js <ide> angular.module('ngResource', ['ng']). <ide> <ide> params = params || {}; <ide> forEach(this.urlParams, function(_, urlParam){ <del> if (val = (params[urlParam] || self.defaults[urlParam])) { <add> val = params.hasOwnProperty(urlParam) ? params[urlParam] : self.defaults[urlParam]; <add> if (isDefined(val) && val !== null) { <ide> encodedVal = encodeUriSegment(val); <ide> url = url.replace(new RegExp(":" + urlParam + "(\\W)", "g"), encodedVal + "$1"); <ide> } else { <ide><path>test/ngResource/resourceSpec.js <ide> describe("resource", function() { <ide> it('should ignore slashes of undefinend parameters', function() { <ide> var R = $resource('/Path/:a/:b/:c'); <ide> <del> $httpBackend.when('GET').respond('{}'); <del> $httpBackend.expect('GET', '/Path'); <del> $httpBackend.expect('GET', '/Path/1'); <del> $httpBackend.expect('GET', '/Path/2/3'); <del> $httpBackend.expect('GET', '/Path/4/5'); <del> $httpBackend.expect('GET', '/Path/6/7/8'); <add> $httpBackend.when('GET', '/Path').respond('{}'); <add> $httpBackend.when('GET', '/Path/0').respond('{}'); <add> $httpBackend.when('GET', '/Path/false').respond('{}'); <add> $httpBackend.when('GET', '/Path').respond('{}'); <add> $httpBackend.when('GET', '/Path/').respond('{}'); <add> $httpBackend.when('GET', '/Path/1').respond('{}'); <add> $httpBackend.when('GET', '/Path/2/3').respond('{}'); <add> $httpBackend.when('GET', '/Path/4/5').respond('{}'); <add> $httpBackend.when('GET', '/Path/6/7/8').respond('{}'); <ide> <ide> R.get({}); <add> R.get({a:0}); <add> R.get({a:false}); <add> R.get({a:null}); <add> R.get({a:undefined}); <add> R.get({a:''}); <ide> R.get({a:1}); <ide> R.get({a:2, b:3}); <ide> R.get({a:4, c:5});
2
Ruby
Ruby
improve minimum macos version audit for casks
09a2ccdf24d717650751368e5665107e2af8169f
<ide><path>Library/Homebrew/cask/audit.rb <ide> def check_livecheck_min_os <ide> return if item.blank? <ide> <ide> min_os = item.elements["sparkle:minimumSystemVersion"]&.text <add> min_os = "11" if min_os == "10.16" <ide> return if min_os.blank? <ide> <ide> begin <ide> def check_livecheck_min_os <ide> <ide> return if cask_min_os == min_os_string <ide> <del> add_error "Upstream defined #{min_os_string} as minimal OS version and the cask defined #{cask_min_os}" <add> add_error "Upstream defined #{min_os_string.to_sym.inspect} as minimal OS version " \ <add> "and the cask defined #{cask_min_os.to_sym.inspect}" <ide> end <ide> <ide> sig { void }
1
PHP
PHP
fix typing and phpcs errors
6bef1ceca8ccbcbf8ccd38619f58655cc85231ae
<ide><path>src/Error/Middleware/ErrorHandlerMiddleware.php <ide> public function __construct($errorHandler = []) <ide> * <ide> * @param \Psr\Http\Message\ServerRequestInterface $request The request. <ide> * @param \Psr\Http\Server\RequestHandlerInterface $handler The request handler. <del> * @return \Psr\Http\Message\ResponseInterface A response. <add> * @return \Psr\Http\Message\ResponseInterface A response <ide> */ <ide> public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface <ide> { <ide> public function process(ServerRequestInterface $request, RequestHandlerInterface <ide> * <ide> * @param \Throwable $exception The exception to handle. <ide> * @param \Psr\Http\Message\ServerRequestInterface $request The request. <del> * @return \Psr\Http\Message\ResponseInterface A response <add> * @return \Psr\Http\Message\ResponseInterface A response. <ide> */ <ide> public function handleException(Throwable $exception, ServerRequestInterface $request): ResponseInterface <ide> { <ide> public function handleException(Throwable $exception, ServerRequestInterface $re <ide> <ide> try { <ide> $errorHandler->logException($exception, $request); <del> /** @var \Psr\Http\Message\ResponseInterface $response*/ <add> /** @var \Psr\Http\Message\ResponseInterface|string $response */ <ide> $response = $renderer->render(); <add> if (is_string($response)) { <add> return new Response(['body' => $response, 'status' => 500]); <add> } <ide> } catch (Throwable $internalException) { <ide> $errorHandler->logException($internalException, $request); <ide> $response = $this->handleInternalError(); <ide> public function handleRedirect(RedirectException $exception): ResponseInterface <ide> */ <ide> protected function handleInternalError(): ResponseInterface <ide> { <del> $response = new Response(['body' => 'An Internal Server Error Occurred']); <del> <del> return $response->withStatus(500); <add> return new Response([ <add> 'body' => 'An Internal Server Error Occurred', <add> 'status' => 500, <add> ]); <ide> } <ide> <ide> /** <ide><path>tests/TestCase/Error/ExceptionTrapTest.php <ide> public static function initialMemoryProvider(): array <ide> } <ide> <ide> /** <del> * @dataProvider initialMemoryProvider <del> */ <add> * @dataProvider initialMemoryProvider <add> */ <ide> public function testIncreaseMemoryLimit($initial) <ide> { <ide> ini_set('memory_limit', $initial); <ide> public function testIncreaseMemoryLimit($initial) <ide> $initialBytes = Text::parseFileSize($initial, false); <ide> $result = Text::parseFileSize(ini_get('memory_limit'), false); <ide> $this->assertWithinRange($initialBytes + (4 * 1024 * 1024), $result, 1024); <del> <ide> } <ide> }
2
Javascript
Javascript
remove unnecessary comment
847400afdeb92f8b0f509d884b77a9116661c2cb
<ide><path>test/configCases/hash-length/output-filename/webpack.config.js <ide> var webpack = require("../../../../"); <ide> /** @type {import("../../../../").Configuration[]} */ <del>/** @type {import("../../../../").Configuration[]} */ <ide> module.exports = [ <ide> { <ide> name: "hash with length in publicPath",
1
PHP
PHP
fix failing test
9c658699757163bf5e58f04239ffa7383e4e6d58
<ide><path>tests/TestCase/Network/Http/ClientTest.php <ide> public function testGetSimpleWithHeadersAndCookies() <ide> $headers = [ <ide> 'User-Agent' => 'Cake', <ide> 'Connection' => 'close', <del> 'Content-Type' => 'application/json', <add> 'Content-Type' => 'application/x-www-form-urlencoded', <ide> ]; <ide> $cookies = [ <ide> 'split' => 'value'
1
Python
Python
improve ner per type scoring
925a852bb6450e16a23346e97a1813fc0fcb22a0
<ide><path>spacy/scorer.py <ide> def score(self, doc, gold, verbose=False, punct_labels=("p", "punct")): <ide> else: <ide> cand_deps.add((gold_i, gold_head, token.dep_.lower())) <ide> if "-" not in [token[-1] for token in gold.orig_annot]: <add> # Find all NER labels in gold and doc <add> ent_labels = set([x[0] for x in gold_ents] <add> + [k.label_ for k in doc.ents]) <add> # Set up all labels for per type scoring and prepare gold per type <add> gold_per_ents = {ent_label: set() for ent_label in ent_labels} <add> for ent_label in ent_labels: <add> if ent_label not in self.ner_per_ents: <add> self.ner_per_ents[ent_label] = PRFScore() <add> gold_per_ents[ent_label].update([x for x in gold_ents if x[0] == ent_label]) <add> # Find all candidate labels, for all and per type <ide> cand_ents = set() <del> current_ent = {k.label_: set() for k in doc.ents} <del> current_gold = {k.label_: set() for k in doc.ents} <add> cand_per_ents = {ent_label: set() for ent_label in ent_labels} <ide> for ent in doc.ents: <del> if ent.label_ not in self.ner_per_ents: <del> self.ner_per_ents[ent.label_] = PRFScore() <ide> first = gold.cand_to_gold[ent.start] <ide> last = gold.cand_to_gold[ent.end - 1] <ide> if first is None or last is None: <ide> self.ner.fp += 1 <ide> self.ner_per_ents[ent.label_].fp += 1 <ide> else: <ide> cand_ents.add((ent.label_, first, last)) <del> current_ent[ent.label_].update([x for x in cand_ents if x[0] == ent.label_]) <del> current_gold[ent.label_].update([x for x in gold_ents if x[0] == ent.label_]) <add> cand_per_ents[ent.label_].add((ent.label_, first, last)) <ide> # Scores per ent <del> [ <del> v.score_set(current_ent[k], current_gold[k]) <del> for k, v in self.ner_per_ents.items() <del> if k in current_ent <del> ] <add> for k, v in self.ner_per_ents.items(): <add> if k in cand_per_ents: <add> v.score_set(cand_per_ents[k], gold_per_ents[k]) <ide> # Score for all ents <ide> self.ner.score_set(cand_ents, gold_ents) <ide> self.tags.score_set(cand_tags, gold_tags) <ide><path>spacy/tests/regression/test_issue3968.py <del># coding: utf-8 <del>from __future__ import unicode_literals <del> <del>from spacy.gold import GoldParse <del>from spacy.scorer import Scorer <del>from ..util import get_doc <del> <del>test_samples = [ <del> [ <del> "100 - 200", <del> { <del> "entities": [ <del> [0, 3, "CARDINAL"], <del> [6, 9, "CARDINAL"] <del> ] <del> } <del> ] <del>] <del> <del>def test_issue3625(en_vocab): <del> scorer = Scorer() <del> for input_, annot in test_samples: <del> doc = get_doc(en_vocab, words = input_.split(' '), ents = [[0,1,'CARDINAL'], [2,3,'CARDINAL']]); <del> gold = GoldParse(doc, entities = annot['entities']) <del> scorer.score(doc, gold) <del> results = scorer.scores <del> <del> # Expects total accuracy and accuracy for each each entity to be 100% <del> assert results['ents_p'] == 100 <del> assert results['ents_f'] == 100 <del> assert results['ents_r'] == 100 <del> assert results['ents_per_type']['CARDINAL']['p'] == 100 <del> assert results['ents_per_type']['CARDINAL']['f'] == 100 <del> assert results['ents_per_type']['CARDINAL']['r'] == 100 <ide><path>spacy/tests/test_scorer.py <add># coding: utf-8 <add>from __future__ import unicode_literals <add> <add>from pytest import approx <add>from spacy.gold import GoldParse <add>from spacy.scorer import Scorer <add>from .util import get_doc <add> <add>test_ner_cardinal = [ <add> [ <add> "100 - 200", <add> { <add> "entities": [ <add> [0, 3, "CARDINAL"], <add> [6, 9, "CARDINAL"] <add> ] <add> } <add> ] <add>] <add> <add>test_ner_apple = [ <add> [ <add> "Apple is looking at buying U.K. startup for $1 billion", <add> { <add> "entities": [ <add> (0, 5, "ORG"), <add> (27, 31, "GPE"), <add> (44, 54, "MONEY"), <add> ] <add> } <add> ] <add>] <add> <add>def test_ner_per_type(en_vocab): <add> # Gold and Doc are identical <add> scorer = Scorer() <add> for input_, annot in test_ner_cardinal: <add> doc = get_doc(en_vocab, words = input_.split(' '), ents = [[0, 1, 'CARDINAL'], [2, 3, 'CARDINAL']]) <add> gold = GoldParse(doc, entities = annot['entities']) <add> scorer.score(doc, gold) <add> results = scorer.scores <add> <add> assert results['ents_p'] == 100 <add> assert results['ents_f'] == 100 <add> assert results['ents_r'] == 100 <add> assert results['ents_per_type']['CARDINAL']['p'] == 100 <add> assert results['ents_per_type']['CARDINAL']['f'] == 100 <add> assert results['ents_per_type']['CARDINAL']['r'] == 100 <add> <add> # Doc has one missing and one extra entity <add> # Entity type MONEY is not present in Doc <add> scorer = Scorer() <add> for input_, annot in test_ner_apple: <add> doc = get_doc(en_vocab, words = input_.split(' '), ents = [[0, 1, 'ORG'], [5, 6, 'GPE'], [6, 7, 'ORG']]) <add> gold = GoldParse(doc, entities = annot['entities']) <add> scorer.score(doc, gold) <add> results = scorer.scores <add> <add> assert results['ents_p'] == approx(66.66666) <add> assert results['ents_r'] == approx(66.66666) <add> assert results['ents_f'] == approx(66.66666) <add> assert 'GPE' in results['ents_per_type'] <add> assert 'MONEY' in results['ents_per_type'] <add> assert 'ORG' in results['ents_per_type'] <add> assert results['ents_per_type']['GPE']['p'] == 100 <add> assert results['ents_per_type']['GPE']['r'] == 100 <add> assert results['ents_per_type']['GPE']['f'] == 100 <add> assert results['ents_per_type']['MONEY']['p'] == 0 <add> assert results['ents_per_type']['MONEY']['r'] == 0 <add> assert results['ents_per_type']['MONEY']['f'] == 0 <add> assert results['ents_per_type']['ORG']['p'] == 50 <add> assert results['ents_per_type']['ORG']['r'] == 100 <add> assert results['ents_per_type']['ORG']['f'] == approx(66.66666)
3
Ruby
Ruby
add documentation for timewithzone methods
f42c0893112e4411f9f1469c019e41968bcbe0e5
<ide><path>activesupport/lib/active_support/time_with_zone.rb <ide> def localtime <ide> # Returns true if the the current time is within Daylight Savings Time for the <ide> # specified time zone. <ide> # <del> # Time.zone = 'Eastern Time (US & Canada)' # => 'Eastern Time (US & Canada)' <del> # Time.zone.parse("2012-5-30").dst? # => true <del> # Time.zone.parse("2012-11-30").dst? # => false <add> # Time.zone = 'Eastern Time (US & Canada)' # => 'Eastern Time (US & Canada)' <add> # Time.zone.parse("2012-5-30").dst? # => true <add> # Time.zone.parse("2012-11-30").dst? # => false <ide> def dst? <ide> period.dst? <ide> end <ide> alias_method :isdst, :dst? <ide> <add> # Returns true if the the current time zone is set to UTC. <add> # <add> # Time.zone = 'UTC' # => 'UTC' <add> # Time.zone.now.utc? # => true <add> # Time.zone = 'Eastern Time (US & Canada)' # => 'Eastern Time (US & Canada)' <add> # Time.zone.now.utc? # => false <ide> def utc? <ide> time_zone.name == 'UTC' <ide> end <ide> alias_method :gmt?, :utc? <ide> <add> # Returns a +Fixnum+ of the offset from current time zone to UTC time <add> # in seconds. <ide> def utc_offset <ide> period.utc_total_offset <ide> end <ide> def encode_with(coder) <ide> end <ide> end <ide> <add> # Returns a string of the object's date and time in the format used by <add> # HTTP requests. <add> # <add> # Time.zone.now.httpdate # => "Tue, 01 Jan 2013 04:39:43 GMT" <ide> def httpdate <ide> utc.httpdate <ide> end <ide> <add> # Returns a string of the object's date and time in the RFC 2822 standard <add> # format. <add> # <add> # Time.zone.now.rfc2822 # => "Tue, 01 Jan 2013 04:51:39 +0000" <ide> def rfc2822 <ide> to_s(:rfc822) <ide> end
1
Python
Python
add type annotations for perceiver
16399d6197224adafc58ff4fa5ee645d64972973
<ide><path>src/transformers/models/perceiver/modeling_perceiver.py <ide> from dataclasses import dataclass <ide> from functools import reduce <ide> from operator import __add__ <del>from typing import Any, Callable, Mapping, Optional, Tuple <add>from typing import Any, Callable, Dict, Mapping, Optional, Tuple, Union <ide> <ide> import numpy as np <ide> import torch <ide> def __init__(self, config): <ide> @replace_return_docstrings(output_type=PerceiverMaskedLMOutput, config_class=_CONFIG_FOR_DOC) <ide> def forward( <ide> self, <del> inputs=None, <del> attention_mask=None, <del> head_mask=None, <del> output_attentions=None, <del> output_hidden_states=None, <del> labels=None, <del> return_dict=None, <del> input_ids=None, <del> ): <add> inputs: Optional[torch.Tensor] = None, <add> attention_mask: Optional[torch.Tensor] = None, <add> head_mask: Optional[torch.Tensor] = None, <add> output_attentions: Optional[bool] = None, <add> output_hidden_states: Optional[bool] = None, <add> labels: Optional[torch.Tensor] = None, <add> return_dict: Optional[bool] = None, <add> input_ids: Optional[torch.Tensor] = None, <add> ) -> Union[Tuple, PerceiverMaskedLMOutput]: <ide> r""" <ide> labels (`torch.LongTensor` of shape `(batch_size, sequence_length)`, *optional*): <ide> Labels for computing the masked language modeling loss. Indices should be in `[-100, 0, ..., <ide> def __init__(self, config): <ide> @replace_return_docstrings(output_type=PerceiverClassifierOutput, config_class=_CONFIG_FOR_DOC) <ide> def forward( <ide> self, <del> inputs=None, <del> attention_mask=None, <del> head_mask=None, <del> output_attentions=None, <del> output_hidden_states=None, <del> labels=None, <del> return_dict=None, <del> input_ids=None, <del> ): <add> inputs: Optional[torch.Tensor] = None, <add> attention_mask: Optional[torch.Tensor] = None, <add> head_mask: Optional[torch.Tensor] = None, <add> output_attentions: Optional[bool] = None, <add> output_hidden_states: Optional[bool] = None, <add> labels: Optional[torch.Tensor] = None, <add> return_dict: Optional[bool] = None, <add> input_ids: Optional[torch.Tensor] = None, <add> ) -> Union[Tuple, PerceiverClassifierOutput]: <ide> r""" <ide> labels (`torch.LongTensor` of shape `(batch_size,)`, *optional*): <ide> Labels for computing the classification/regression loss. Indices should be in `[0, ..., config.num_labels - <ide> def __init__(self, config): <ide> @replace_return_docstrings(output_type=PerceiverClassifierOutput, config_class=_CONFIG_FOR_DOC) <ide> def forward( <ide> self, <del> inputs=None, <del> attention_mask=None, <del> head_mask=None, <del> output_attentions=None, <del> output_hidden_states=None, <del> labels=None, <del> return_dict=None, <del> pixel_values=None, <del> ): <add> inputs: Optional[torch.Tensor] = None, <add> attention_mask: Optional[torch.Tensor] = None, <add> head_mask: Optional[torch.Tensor] = None, <add> output_attentions: Optional[bool] = None, <add> output_hidden_states: Optional[bool] = None, <add> labels: Optional[torch.Tensor] = None, <add> return_dict: Optional[bool] = None, <add> pixel_values: Optional[torch.Tensor] = None, <add> ) -> Union[Tuple, PerceiverClassifierOutput]: <ide> r""" <ide> labels (`torch.LongTensor` of shape `(batch_size,)`, *optional*): <ide> Labels for computing the image classification/regression loss. Indices should be in `[0, ..., <ide> def __init__(self, config): <ide> @replace_return_docstrings(output_type=PerceiverClassifierOutput, config_class=_CONFIG_FOR_DOC) <ide> def forward( <ide> self, <del> inputs=None, <del> attention_mask=None, <del> head_mask=None, <del> output_attentions=None, <del> output_hidden_states=None, <del> labels=None, <del> return_dict=None, <del> pixel_values=None, <del> ): <add> inputs: Optional[torch.Tensor] = None, <add> attention_mask: Optional[torch.Tensor] = None, <add> head_mask: Optional[torch.Tensor] = None, <add> output_attentions: Optional[bool] = None, <add> output_hidden_states: Optional[bool] = None, <add> labels: Optional[torch.Tensor] = None, <add> return_dict: Optional[bool] = None, <add> pixel_values: Optional[torch.Tensor] = None, <add> ) -> Union[Tuple, PerceiverClassifierOutput]: <ide> r""" <ide> labels (`torch.LongTensor` of shape `(batch_size,)`, *optional*): <ide> Labels for computing the image classification/regression loss. Indices should be in `[0, ..., <ide> def __init__(self, config): <ide> @replace_return_docstrings(output_type=PerceiverClassifierOutput, config_class=_CONFIG_FOR_DOC) <ide> def forward( <ide> self, <del> inputs=None, <del> attention_mask=None, <del> head_mask=None, <del> output_attentions=None, <del> output_hidden_states=None, <del> labels=None, <del> return_dict=None, <del> pixel_values=None, <del> ): <add> inputs: Optional[torch.Tensor] = None, <add> attention_mask: Optional[torch.Tensor] = None, <add> head_mask: Optional[torch.Tensor] = None, <add> output_attentions: Optional[bool] = None, <add> output_hidden_states: Optional[bool] = None, <add> labels: Optional[torch.Tensor] = None, <add> return_dict: Optional[bool] = None, <add> pixel_values: Optional[torch.Tensor] = None, <add> ) -> Union[Tuple, PerceiverClassifierOutput]: <ide> r""" <ide> labels (`torch.LongTensor` of shape `(batch_size,)`, *optional*): <ide> Labels for computing the image classification/regression loss. Indices should be in `[0, ..., <ide> def __init__(self, config): <ide> @replace_return_docstrings(output_type=PerceiverClassifierOutput, config_class=_CONFIG_FOR_DOC) <ide> def forward( <ide> self, <del> inputs=None, <del> attention_mask=None, <del> head_mask=None, <del> output_attentions=None, <del> output_hidden_states=None, <del> labels=None, <del> return_dict=None, <del> ): <add> inputs: Optional[torch.Tensor] = None, <add> attention_mask: Optional[torch.Tensor] = None, <add> head_mask: Optional[torch.Tensor] = None, <add> output_attentions: Optional[bool] = None, <add> output_hidden_states: Optional[bool] = None, <add> labels: Optional[torch.Tensor] = None, <add> return_dict: Optional[bool] = None, <add> ) -> Union[Tuple, PerceiverClassifierOutput]: <ide> r""" <ide> labels (`torch.LongTensor` of shape `(batch_size,)`, *optional*): <ide> Labels for computing the optical flow loss. Indices should be in `[0, ..., config.num_labels - 1]`. <ide> def __init__(self, config): <ide> @replace_return_docstrings(output_type=PerceiverClassifierOutput, config_class=_CONFIG_FOR_DOC) <ide> def forward( <ide> self, <del> inputs=None, <del> attention_mask=None, <del> subsampled_output_points=None, <del> head_mask=None, <del> output_attentions=None, <del> output_hidden_states=None, <del> labels=None, <del> return_dict=None, <del> ): <add> inputs: Optional[torch.Tensor] = None, <add> attention_mask: Optional[torch.Tensor] = None, <add> subsampled_output_points: Optional[Dict[str, torch.tensor]] = None, <add> head_mask: Optional[torch.Tensor] = None, <add> output_attentions: Optional[bool] = None, <add> output_hidden_states: Optional[bool] = None, <add> labels: Optional[torch.Tensor] = None, <add> return_dict: Optional[bool] = None, <add> ) -> Union[Tuple, PerceiverClassifierOutput]: <ide> r""" <ide> labels (`torch.LongTensor` of shape `(batch_size,)`, *optional*): <ide> Labels for computing the image classification/regression loss. Indices should be in `[0, ...,
1
Ruby
Ruby
adjust standard built type
a5c4eb2d3eae9e2fd7b7f0fd431fe763688af82b
<ide><path>Library/Homebrew/formula.rb <ide> def inspect <ide> end <ide> <ide> # Standard parameters for CMake builds. <del> # Using Build Type "None" tells cmake to use our CFLAGS,etc. settings. <del> # Setting it to Release would ignore our flags. <ide> # Setting CMAKE_FIND_FRAMEWORK to "LAST" tells CMake to search for our <ide> # libraries before trying to utilize Frameworks, many of which will be from <ide> # 3rd party installs. <ide> # Note: there isn't a std_autotools variant because autotools is a lot <ide> # less consistent and the standard parameters are more memorable. <ide> def std_cmake_args <ide> %W[ <add> -DCMAKE_C_FLAGS_RELEASE= <add> -DCMAKE_CXX_FLAGS_RELEASE= <ide> -DCMAKE_INSTALL_PREFIX=#{prefix} <del> -DCMAKE_BUILD_TYPE=None <add> -DCMAKE_BUILD_TYPE=Release <ide> -DCMAKE_FIND_FRAMEWORK=LAST <ide> -DCMAKE_VERBOSE_MAKEFILE=ON <ide> -Wno-dev
1
PHP
PHP
remove comment bloat from response class
0dd06ad31408b3a7d7cfa487cf4f48d66f1a4a32
<ide><path>system/response.php <ide> public static function make($content, $status = 200) <ide> */ <ide> public static function prepare($response) <ide> { <del> // If the response is a Redirect instance, grab the Response. The Redirect class <del> // manages a Response instance internally. <ide> if ($response instanceof Redirect) <ide> { <ide> $response = $response->response;
1
Go
Go
show experimental flags and subcommands if enabled
d67aa065ef9f295949ed507fc3d67f29fd56fcdb
<ide><path>cmd/docker/docker.go <ide> func dockerPreRun(opts *cliflags.ClientOptions) { <ide> func hideUnsupportedFeatures(cmd *cobra.Command, clientVersion string, hasExperimental bool) { <ide> cmd.Flags().VisitAll(func(f *pflag.Flag) { <ide> // hide experimental flags <del> if _, ok := f.Annotations["experimental"]; ok { <del> f.Hidden = true <add> if !hasExperimental { <add> if _, ok := f.Annotations["experimental"]; ok { <add> f.Hidden = true <add> } <ide> } <ide> <ide> // hide flags not supported by the server <ide> func hideUnsupportedFeatures(cmd *cobra.Command, clientVersion string, hasExperi <ide> <ide> for _, subcmd := range cmd.Commands() { <ide> // hide experimental subcommands <del> if _, ok := subcmd.Tags["experimental"]; ok { <del> subcmd.Hidden = true <add> if !hasExperimental { <add> if _, ok := subcmd.Tags["experimental"]; ok { <add> subcmd.Hidden = true <add> } <ide> } <ide> <ide> // hide subcommands not supported by the server
1
Javascript
Javascript
remove dead code
4d177cafd5943d3d7937945abfe392716f237d73
<ide><path>packages/ember-htmlbars/lib/system/shadow-root.js <del>import { internal } from "htmlbars-runtime"; <del> <del>/** @private <del> A ShadowRoot represents a new root scope. However, it <del> is not a render tree root. <del>*/ <del> <del>function ShadowRoot(layoutMorph, layoutTemplate, contentScope, contentTemplate) { <del> this.layoutMorph = layoutMorph; <del> this.layoutTemplate = layoutTemplate; <del> <del> this.contentScope = contentScope; <del> this.contentTemplate = contentTemplate; <del>} <del> <del>ShadowRoot.prototype.render = function(env, self, shadowOptions, visitor) { <del> if (!this.layoutTemplate && !this.contentTemplate) { return; } <del> <del> shadowOptions.attrs = self.attrs; <del> <del> var shadowRoot = this; <del> <del> internal.hostBlock(this.layoutMorph, env, this.contentScope, this.contentTemplate || null, null, shadowOptions, visitor, function(options) { <del> var template = options.templates.template; <del> if (shadowRoot.layoutTemplate) { <del> template.yieldIn(shadowRoot.layoutTemplate, self); <del> } else if (template.yield) { <del> template.yield(); <del> } <del> }); <del>}; <del> <del>ShadowRoot.prototype.isStable = function(layout, template) { <del> return this.layoutTemplate === layout && <del> this.contentTemplate === template; <del>}; <del> <del>export default ShadowRoot;
1
Javascript
Javascript
simplify "testtimeout" option
b26628a2bb20abae0e0515394efdd621452267b1
<ide><path>test/data/testrunner.js <ide> var oldStart = window.start, <ide> <ide> // Max time for stop() and asyncTest() until it aborts test <ide> // and start()'s the next test. <del>QUnit.config.testTimeout = 20 * 1000; // 20 seconds <add>QUnit.config.testTimeout = 2e4; // 20 seconds <ide> <ide> // Enforce an "expect" argument or expect() call in all test bodies. <ide> QUnit.config.requireExpects = true;
1
Ruby
Ruby
update 10.11 clang
212d0b82fd33d6520d2639ee6c994eb224623b5a
<ide><path>Library/Homebrew/os/mac/xcode.rb <ide> def installed? <ide> <ide> def latest_version <ide> case MacOS.version <del> when "10.11" then "700.0.59.1" <add> when "10.11" then "700.0.65" <ide> when "10.10" then "602.0.53" <ide> when "10.9" then "600.0.57" <ide> when "10.8" then "503.0.40"
1
Text
Text
warn users about non-ascii paths on build
c134ff24f44ca523566bd38aa2d49f0dce7401aa
<ide><path>BUILDING.md <ide> Prerequisites: <ide> * **Optional** (to build the MSI): the [WiX Toolset v3.11](http://wixtoolset.org/releases/) <ide> and the [Wix Toolset Visual Studio 2017 Extension](https://marketplace.visualstudio.com/items?itemName=RobMensching.WixToolsetVisualStudio2017Extension). <ide> <del>If the path to your build directory contains a space, the build will likely fail. <add>If the path to your build directory contains a space or a non-ASCII character, the <add>build will likely fail. <ide> <ide> ```console <ide> > .\vcbuild
1
Text
Text
fix typo in changelog.md
b837bd279232d7d8f105e5413161a2bf29231d8a
<ide><path>CHANGELOG.md <ide> release. <ide> <tr> <ide> <td valign="top"> <ide> <b><a href="doc/changelogs/CHANGELOG_V7.md#7.9.0">7.9.0</a></b><br/> <del><a href="doc/changelogs/CHANGELOG_V7.md#7.8.0<">7.8.0<</a><br/> <add><a href="doc/changelogs/CHANGELOG_V7.md#7.8.0">7.8.0</a><br/> <ide> <a href="doc/changelogs/CHANGELOG_V7.md#7.7.4">7.7.4</a><br/> <ide> <a href="doc/changelogs/CHANGELOG_V7.md#7.7.3">7.7.3</a><br/> <ide> <a href="doc/changelogs/CHANGELOG_V7.md#7.7.2">7.7.2</a><br/>
1
Ruby
Ruby
add helper class for python virtualenvs
2783adec4a906c8fb5c45aa1305b1460b5bc8a5b
<ide><path>Library/Homebrew/language/python.rb <ide> require "utils" <add>require "language/python_virtualenv_constants" <ide> <ide> module Language <ide> module Python <ide> def self.setup_install_args(prefix) <ide> def self.package_available?(python, module_name) <ide> quiet_system python, "-c", "import #{module_name}" <ide> end <del> end <del>end <add> <add> # Mixin module for {Formula} adding virtualenv support features. <add> module Virtualenv <add> def self.included(base) <add> base.class_eval do <add> resource "homebrew-virtualenv" do <add> url PYTHON_VIRTUALENV_URL <add> sha256 PYTHON_VIRTUALENV_SHA256 <add> end <add> end <add> end <add> <add> # Instantiates, creates, and yields a {Virtualenv} object for use from <add> # Formula#install, which provides helper methods for instantiating and <add> # installing packages into a Python virtualenv. <add> # @param venv_root [Pathname, String] the path to the root of the virtualenv <add> # (often `libexec/"venv"`) <add> # @param python [String] which interpreter to use (e.g. "python" <add> # or "python3") <add> # @param formula [Formula] the active Formula <add> # @return [Virtualenv] a {Virtualenv} instance <add> def virtualenv_create(venv_root, python = "python", formula = self) <add> venv = Virtualenv.new formula, venv_root, python <add> venv.create <add> venv <add> end <add> <add> # Helper method for the common case of installing a Python application. <add> # Creates a virtualenv in `libexec`, installs all `resource`s defined <add> # on the formula, and then installs the formula. <add> def virtualenv_install_with_resources <add> venv = virtualenv_create(libexec) <add> venv.pip_install resources <add> venv.link_scripts(bin) { venv.pip_install buildpath } <add> venv <add> end <add> <add> # Convenience wrapper for creating and installing packages into Python <add> # virtualenvs. <add> class Virtualenv <add> # Initializes a Virtualenv instance. This does not create the virtualenv <add> # on disk; {#create} does that. <add> # @param formula [Formula] the active Formula <add> # @param venv_root [Pathname, String] the path to the root of the <add> # virtualenv <add> # @param python [String] which interpreter to use; i.e. "python" or <add> # "python3" <add> def initialize(formula, venv_root, python) <add> @formula = formula <add> @venv_root = Pathname.new(venv_root) <add> @python = python <add> end <add> <add> # Obtains a copy of the virtualenv library and creates a new virtualenv <add> # on disk. <add> # @return [void] <add> def create <add> return if (@venv_root/"bin/python").exist? <add> <add> @formula.resource("homebrew-virtualenv").stage do |stage| <add> old_pythonpath = ENV.delete "PYTHONPATH" <add> begin <add> xy = Language::Python.major_minor_version(@python) <add> staging = Pathname.new(stage.staging.tmpdir) <add> ENV.prepend_create_path "PYTHONPATH", staging/"target/lib/python#{xy}/site-packages" <add> @formula.system @python, *Language::Python.setup_install_args(staging/"target") <add> @formula.system @python, "-s", staging/"target/bin/virtualenv", "-p", @python, @venv_root <add> ensure <add> ENV["PYTHONPATH"] = old_pythonpath <add> end <add> end <add> <add> # Robustify symlinks to survive python3 patch upgrades <add> @venv_root.find do |f| <add> next unless f.symlink? <add> if (rp = f.realpath.to_s).start_with? HOMEBREW_CELLAR <add> python = rp.include?("python3") ? "python3" : "python" <add> new_target = rp.sub %r{#{HOMEBREW_CELLAR}/#{python}/[^/]+}, Formula[python].opt_prefix <add> f.unlink <add> f.make_symlink new_target <add> end <add> end <add> end <add> <add> # Installs packages represented by `targets` into the virtualenv. <add> # @param targets [String, Pathname, Resource, <add> # Array<String, Pathname, Resource>] (A) token(s) passed to pip <add> # representing the object to be installed. This can be a directory <add> # containing a setup.py, a {Resource} which will be staged and <add> # installed, or a package identifier to be fetched from PyPI. <add> # Multiline strings are allowed and treated as though they represent <add> # the contents of a `requirements.txt`. <add> # @return [void] <add> def pip_install(targets) <add> targets = [targets] unless targets.is_a? Array <add> targets.each do |t| <add> if t.respond_to? :stage <add> next if t.name == "homebrew-virtualenv" <add> t.stage { do_install Pathname.pwd } <add> else <add> t = t.lines.map(&:strip) if t.respond_to?(:lines) && t =~ /\n/ <add> do_install t <add> end <add> end <add> end <add> <add> # Compares the venv bin directory before and after executing a block, <add> # and symlinks any new scripts into `destination`. <add> # Use like: venv.link_scripts(bin) { venv.pip_install my_package } <add> # @param destination [Pathname, String] Destination into which new <add> # scripts should be linked. <add> # @return [void] <add> def link_scripts(destination) <add> bin_before = Dir[@venv_root/"bin/*"].to_set <add> yield <add> bin_after = Dir[@venv_root/"bin/*"].to_set <add> destination = Pathname.new(destination) <add> destination.install_symlink((bin_after - bin_before).to_a) <add> end <add> <add> private <add> <add> def do_install(targets) <add> targets = [targets] unless targets.is_a? Array <add> @formula.system @venv_root/"bin/pip", "install", <add> "-v", "--no-deps", "--no-binary", ":all:", <add> *targets <add> end <add> end # class Virtualenv <add> end # module Virtualenv <add> end # module Python <add>end # module Language <ide><path>Library/Homebrew/language/python_virtualenv_constants.rb <add>PYTHON_VIRTUALENV_URL = "https://files.pythonhosted.org/packages/5c/79/5dae7494b9f5ed061cff9a8ab8d6e1f02db352f3facf907d9eb614fb80e9/virtualenv-15.0.2.tar.gz" <add>PYTHON_VIRTUALENV_SHA256 = "fab40f32d9ad298fba04a260f3073505a16d52539a84843cf8c8369d4fd17167"
2
Text
Text
specify correct extension for text layouts
1f48de101bce1b63e0b250c371a17fb4e851e457
<ide><path>guides/source/layouts_and_rendering.md <ide> service requests that are expecting something other than proper HTML. <ide> <ide> NOTE: By default, if you use the `:plain` option, the text is rendered without <ide> using the current layout. If you want Rails to put the text into the current <del>layout, you need to add the `layout: true` option and use the `.txt.erb` <add>layout, you need to add the `layout: true` option and use the `.text.erb` <ide> extension for the layout file. <ide> <ide> #### Rendering HTML
1
PHP
PHP
fix failing tests on windows
8cfb90fc06c3166f89ffe0e23c30d49a6453fac2
<ide><path>tests/Integration/Mail/RenderingMailWithLocaleTest.php <ide> public function testMailableRendersInDefaultLocale() <ide> { <ide> $mail = new RenderedTestMail; <ide> <del> $this->assertStringContainsString("name\n", $mail->render()); <add> $this->assertStringContainsString('name'.PHP_EOL, $mail->render()); <ide> } <ide> <ide> public function testMailableRendersInSelectedLocale() <ide> { <ide> $mail = (new RenderedTestMail)->locale('es'); <ide> <del> $this->assertStringContainsString("nombre\n", $mail->render()); <add> $this->assertStringContainsString('nombre'.PHP_EOL, $mail->render()); <ide> } <ide> <ide> public function testMailableRendersInAppSelectedLocale() <ide> public function testMailableRendersInAppSelectedLocale() <ide> <ide> $mail = new RenderedTestMail; <ide> <del> $this->assertStringContainsString("nombre\n", $mail->render()); <add> $this->assertStringContainsString('nombre'.PHP_EOL, $mail->render()); <ide> } <ide> } <ide>
1
Javascript
Javascript
fix assert.strictequal argument order
5ad4c44e90b8195e45f7bd293cd06765f1e47953
<ide><path>test/parallel/test-fs-read-stream.js <ide> const rangeFile = fixtures.path('x.txt'); <ide> <ide> file.on('open', common.mustCall(function(fd) { <ide> file.length = 0; <del> assert.strictEqual('number', typeof fd); <add> assert.strictEqual(typeof fd, 'number'); <ide> assert.strictEqual(file.bytesRead, 0); <ide> assert.ok(file.readable); <ide> <ide> const rangeFile = fixtures.path('x.txt'); <ide> const file = fs.createReadStream(fn, { encoding: 'utf8' }); <ide> file.length = 0; <ide> file.on('data', function(data) { <del> assert.strictEqual('string', typeof data); <add> assert.strictEqual(typeof data, 'string'); <ide> file.length += data.length; <ide> <ide> for (let i = 0; i < data.length; i++) { <ide> // http://www.fileformat.info/info/unicode/char/2026/index.htm <del> assert.strictEqual('\u2026', data[i]); <add> assert.strictEqual(data[i], '\u2026'); <ide> } <ide> }); <ide> <ide> common.expectsError( <ide> }); <ide> <ide> stream.on('end', common.mustCall(function() { <del> assert.strictEqual('x', stream.data); <add> assert.strictEqual(stream.data, 'x'); <ide> })); <ide> } <ide> <ide> common.expectsError( <ide> }); <ide> <ide> stream.on('end', common.mustCall(function() { <del> assert.strictEqual('xy', stream.data); <add> assert.strictEqual(stream.data, 'xy'); <ide> })); <ide> } <ide> <ide> if (!common.isWindows) { <ide> }); <ide> <ide> stream.on('end', common.mustCall(function() { <del> assert.strictEqual('xy', stream.data); <add> assert.strictEqual(stream.data, 'xy'); <ide> fs.unlinkSync(filename); <ide> })); <ide> } else {
1
PHP
PHP
remove useless line break
9da1c65818fa2c6542272f8cb7e52b540284c718
<ide><path>src/Illuminate/Database/Eloquent/Builder.php <ide> public function whereHas($relation, Closure $callback, $operator = '>=', $count <ide> return $this->has($relation, $operator, $count, 'and', $callback); <ide> } <ide> <del> <ide> /** <ide> * Add a relationship count condition to the query with where clauses. <ide> *
1
PHP
PHP
fix deprecation warning
30a47becbb875d4600aa08cad9683702e4faf34a
<ide><path>src/View/Helper.php <ide> public function __get($name) <ide> if (isset($removed[$name])) { <ide> $method = $removed[$name]; <ide> deprecationWarning(sprintf( <del> 'Helper::$%s is removed. Use $view->%s() instead.', <add> 'Helper::$%s is deprecated. Use $view->%s() instead.', <ide> $name, <ide> $method <ide> )); <ide> public function __get($name) <ide> <ide> if ($name === 'request') { <ide> deprecationWarning( <del> 'Helper::$%s is removed. Use $view->%s() instead. Use $helper->getView()->getRequest() instead.' <add> 'Helper::$request is deprecated. Use $helper->getView()->getRequest() instead.' <ide> ); <ide> <ide> return $this->_View->getRequest();
1
PHP
PHP
update image() docs
5b9d69fcc8e75dde3aff7e655ede66b1f273166b
<ide><path>lib/Cake/View/Helper/HtmlHelper.php <ide> public function getCrumbList($options = array()) { <ide> } <ide> <ide> /** <del> * Creates a formatted IMG element. If `$options['url']` is provided, an image link will be <del> * generated with the link pointed at `$options['url']`. If `$options['fullBase']` is provided, <del> * the src attribute will receive full address (non-relative url) of the image file. <add> * Creates a formatted IMG element. <add> * <ide> * This method will set an empty alt attribute if one is not supplied. <ide> * <del> * ### Usage <add> * ### Usage: <ide> * <ide> * Create a regular image: <ide> * <ide> public function getCrumbList($options = array()) { <ide> * <ide> * `echo $html->image('cake_icon.png', array('alt' => 'CakePHP', 'url' => 'http://cakephp.org'));` <ide> * <add> * ### Options: <add> * <add> * - `url` If provided an image link will be generated and the link will point at <add> * `$options['url']`. <add> * - `fullBase` If provided the src attribute will get a full addres (non-relative url) for <add> * the image file. <add> * <ide> * @param string $path Path to the image file, relative to the app/webroot/img/ directory. <del> * @param array $options Array of HTML attributes. <add> * @param array $options Array of HTML attributes. See above for special options. <ide> * @return string completed img tag <ide> * @link http://book.cakephp.org/2.0/en/core-libraries/helpers/html.html#HtmlHelper::image <ide> */
1
Go
Go
skip layers+base images
540c8e9b201cfcf46cf9d2c05d42c492edda4117
<ide><path>image/rootfs.go <ide> package image <ide> <del>import "github.com/docker/docker/layer" <add>import ( <add> "runtime" <add> <add> "github.com/Sirupsen/logrus" <add> "github.com/docker/docker/layer" <add>) <ide> <ide> // TypeLayers is used for RootFS.Type for filesystems organized into layers. <ide> const TypeLayers = "layers" <ide> <add>// typeLayersWithBase is an older format used by Windows up to v1.12. We <add>// explicitly handle this as an error case to ensure that a daemon which still <add>// has an older image like this on disk can still start, even though the <add>// image itself is not usable. See https://github.com/docker/docker/pull/25806. <add>const typeLayersWithBase = "layers+base" <add> <ide> // RootFS describes images root filesystem <ide> // This is currently a placeholder that only supports layers. In the future <ide> // this can be made into an interface that supports different implementations. <ide> func (r *RootFS) Append(id layer.DiffID) { <ide> <ide> // ChainID returns the ChainID for the top layer in RootFS. <ide> func (r *RootFS) ChainID() layer.ChainID { <add> if runtime.GOOS == "windows" && r.Type == typeLayersWithBase { <add> logrus.Warnf("Layer type is unsupported on this platform. DiffIDs: '%v'", r.DiffIDs) <add> return "" <add> } <ide> return layer.CreateChainID(r.DiffIDs) <ide> }
1
Ruby
Ruby
fix a test failure when svn is not installed
7c6d2c95f6055dce5a946d985cf4248166ec5513
<ide><path>Library/Homebrew/test/utils/svn_spec.rb <ide> end <ide> <ide> it "returns svn version if svn available" do <del> expect(described_class.svn_available?).to be_truthy <add> if File.executable? "/usr/bin/svn" <add> expect(described_class.svn_available?).to be_truthy <add> else <add> expect(described_class.svn_available?).to be_falsey <add> end <ide> end <ide> end <ide>
1
Python
Python
add text preprocessing test
7f85541785da1183796d1d5fc6494f938ea77b5b
<ide><path>tests/keras/preprocessing/test_text.py <add>from keras.preprocessing.text import Tokenizer, one_hot <add>import pytest <add>import numpy as np <add> <add> <add>def test_one_hot(): <add> text = 'The cat sat on the mat.' <add> encoded = one_hot(text, 5) <add> assert len(encoded) == 6 <add> assert np.max(encoded) <= 4 <add> assert np.min(encoded) >= 0 <add> <add> <add>def test_tokenizer(): <add> texts = ['The cat sat on the mat.', <add> 'The dog sat on the log.', <add> 'Dogs and cats living together.'] <add> tokenizer = Tokenizer(nb_words=20) <add> tokenizer.fit_on_texts(texts) <add> <add> sequences = [] <add> for seq in tokenizer.texts_to_sequences_generator(texts): <add> sequences.append(seq) <add> assert np.max(np.max(sequences)) == 12 <add> assert np.min(np.min(sequences)) == 1 <add> <add> tokenizer.fit_on_sequences(sequences) <add> <add> for mode in ['binary', 'count', 'tfidf', 'freq']: <add> matrix = tokenizer.texts_to_matrix(texts, mode) <add> <add> <add>if __name__ == '__main__': <add> pytest.main([__file__])
1
Python
Python
fix syntax highlighting for numpy.flatnonzero
bcec9c338946a0285262921ab1da5847462021c3
<ide><path>numpy/core/numeric.py <ide> def flatnonzero(a): <ide> """ <ide> Return indices that are non-zero in the flattened version of a. <ide> <del> This is equivalent to np.nonzero(np.ravel(a))[0]. <add> This is equivalent to ``np.nonzero(np.ravel(a))[0]``. <ide> <ide> Parameters <ide> ---------- <ide> def flatnonzero(a): <ide> Returns <ide> ------- <ide> res : ndarray <del> Output array, containing the indices of the elements of `a.ravel()` <add> Output array, containing the indices of the elements of ``a.ravel()`` <ide> that are non-zero. <ide> <ide> See Also
1
Text
Text
add history information for corepack
913c125e98802b8de062b97da64f7292d7d3f7ad
<ide><path>doc/api/corepack.md <ide> <ide> <!-- type=misc --> <ide> <add><!-- YAML <add>added: <add> - v16.9.0 <add> - v14.19.0 <add>--> <add> <ide> > Stability: 1 - Experimental <ide> <ide> _[Corepack][]_ is an experimental tool to help with
1
Javascript
Javascript
add __dev__ around textinput prop check
508cc06565c1a2ab6ec88dbb8d40d3a2962c198c
<ide><path>Libraries/Components/TextInput/TextInput.js <ide> const TextInput = React.createClass({ <ide> var props = Object.assign({}, this.props); <ide> props.style = [styles.input, this.props.style]; <ide> if (!props.multiline) { <del> for (var propKey in onlyMultiline) { <del> if (props[propKey]) { <del> throw new Error( <del> 'TextInput prop `' + propKey + '` is only supported with multiline.' <del> ); <add> if (__DEV__) { <add> for (var propKey in onlyMultiline) { <add> if (props[propKey]) { <add> throw new Error( <add> 'TextInput prop `' + propKey + '` is only supported with multiline.' <add> ); <add> } <ide> } <ide> } <ide> textContainer =
1
Ruby
Ruby
fix multiple execution of python do ... end blocks
e143c3a799b531d6b3793f7bb677652f418d7a46
<ide><path>Library/Homebrew/python_helper.rb <ide> def python_helper(options={:allowed_major_versions => [2, 3]}, &block) <ide> if !filtered_python_reqs.map{ |fpr| fpr.binary }.include?(py.binary) && <ide> py.satisfied? && <ide> options[:allowed_major_versions].include?(py.version.major) && <del> self.build.with?(py.name) || !(py.optional? || py.recommended?) <add> # if optional or recommended then check the build.with? <add> (self.build.with?(py.name) || !(py.optional? || py.recommended?)) <ide> then <ide> filtered_python_reqs << py <ide> end
1
PHP
PHP
fix more sqlserver tests and phpcs
edb19f8173c317d5ef14ddcb3858f5181b2896bb
<ide><path>tests/TestCase/Database/QueryTest.php <ide> public function testTupleComparisonValuesAreBeingBoundCorrectly() <ide> */ <ide> public function testTupleComparisonTypesCanBeOmitted() <ide> { <add> $this->skipIf( <add> $this->connection->getDriver() instanceof Sqlserver, <add> 'This test fails sporadically in SQLServer' <add> ); <ide> // Load with force dropping tables to avoid identities not being reset properly <ide> // in SQL Server when reseeding is applied directly after table creation. <ide> $this->fixtureManager->loadSingle('Profiles', null, true); <ide><path>tests/TestCase/ORM/Behavior/BehaviorRegressionTest.php <ide> */ <ide> namespace Cake\Test\TestCase\ORM\Behavior; <ide> <del>use Cake\Database\Driver\SqlServer; <add>use Cake\Database\Driver\Sqlserver; <ide> use Cake\Datasource\ConnectionManager; <ide> use Cake\TestSuite\TestCase; <ide> use TestApp\Model\Entity\NumberTree; <ide><path>tests/TestCase/ORM/Behavior/CounterCacheBehaviorTest.php <ide> */ <ide> namespace Cake\Test\TestCase\ORM\Behavior; <ide> <del>use Cake\Database\Query; <ide> use Cake\Database\Driver\Sqlserver; <add>use Cake\Database\Query; <ide> use Cake\Datasource\ConnectionManager; <ide> use Cake\Datasource\EntityInterface; <ide> use Cake\Event\EventInterface;
3
Text
Text
fix an sni mistyped as sns
9dcc7c578ee28af3d4b215731eccb3a56e04e12c
<ide><path>doc/api/tls.md <ide> added: v0.5.3 <ide> `cert`, `ca`, etc). <ide> <ide> The `server.addContext()` method adds a secure context that will be used if <del>the client request's SNS hostname matches the supplied `hostname` (or wildcard). <add>the client request's SNI hostname matches the supplied `hostname` (or wildcard). <ide> <ide> ### server.address() <ide> <!-- YAML
1
Python
Python
use twine to upload to pypi
75ff754517c30df043de906b0a6fb0e1777570b7
<ide><path>setup.py <ide> def get_package_data(package): <ide> if os.system("pip freeze | grep wheel"): <ide> print("wheel not installed.\nUse `pip install wheel`.\nExiting.") <ide> sys.exit() <del> os.system("python setup.py sdist upload") <del> os.system("python setup.py bdist_wheel upload") <add> if os.system("pip freeze | grep twine") <add> print("twine not installed.\nUse `pip install twine`.\nExiting.") <add> sys.exit() <add> os.system("python setup.py sdist bdist_wheel") <add> os.system("twine upload dist/*") <ide> print("You probably want to also tag the version now:") <ide> print(" git tag -a %s -m 'version %s'" % (version, version)) <ide> print(" git push --tags")
1
PHP
PHP
allow meta data from response building
73de18e32a7d04ed61c1a37b724732a23aad259c
<ide><path>src/Illuminate/Http/Resources/Json/PaginatedResourceResponse.php <ide> public function toResponse($request) <ide> $this->resource->resolve($request), <ide> array_merge_recursive( <ide> $this->paginationInformation($request), <del> $this->resource->with($request) <add> $this->resource->with($request), <add> $this->resource->additional <ide> ) <ide> ), <ide> $this->calculateStatus() <ide><path>src/Illuminate/Http/Resources/Json/Resource.php <ide> class Resource implements ArrayAccess, JsonSerializable, Responsable, UrlRoutabl <ide> */ <ide> public $with = []; <ide> <add> /** <add> * The additional meta data that should be added to the resource response. <add> * <add> * Added during response constuction by the developer. <add> * <add> * @var array <add> */ <add> public $additional = []; <add> <ide> /** <ide> * The "data" wrapper that should be applied. <ide> * <ide> public function with($request) <ide> return $this->with; <ide> } <ide> <add> /** <add> * Add additional meta data to the resource response. <add> * <add> * @param array $data <add> * @return $this <add> */ <add> public function additional(array $data) <add> { <add> $this->additional = $data; <add> <add> return $this; <add> } <add> <ide> /** <ide> * Customize the response for a request. <ide> * <ide><path>src/Illuminate/Http/Resources/Json/ResourceResponse.php <ide> public function toResponse($request) <ide> return tap(response()->json( <ide> $this->wrap( <ide> $this->resource->resolve($request), <del> $this->resource->with($request) <add> $this->resource->with($request), <add> $this->resource->additional <ide> ), <ide> $this->calculateStatus() <ide> ), function ($response) use ($request) { <ide> public function toResponse($request) <ide> * <ide> * @param array $data <ide> * @param array $with <add> * @param array $additional <ide> * @return array <ide> */ <del> protected function wrap($data, $with = []) <add> protected function wrap($data, $with = [], $additional = []) <ide> { <ide> if ($data instanceof Collection) { <ide> $data = $data->all(); <ide> } <ide> <ide> if ($this->haveDefaultWrapperAndDataIsUnwrapped($data)) { <ide> $data = [$this->wrapper() => $data]; <del> } elseif ($this->haveAdditionalInformationAndDataIsUnwrapped($data, $with)) { <add> } elseif ($this->haveAdditionalInformationAndDataIsUnwrapped($data, $with, $additional)) { <ide> $data = [($this->wrapper() ?? 'data') => $data]; <ide> } <ide> <del> return array_merge_recursive($data, $with); <add> return array_merge_recursive($data, $with, $additional); <ide> } <ide> <ide> /** <ide> protected function haveDefaultWrapperAndDataIsUnwrapped($data) <ide> * <ide> * @param array $data <ide> * @param array $with <add> * @param array $additional <ide> * @return bool <ide> */ <del> protected function haveAdditionalInformationAndDataIsUnwrapped($data, $with) <add> protected function haveAdditionalInformationAndDataIsUnwrapped($data, $with, $additional) <ide> { <del> return ! empty($with) && <del> (! $this->wrapper() || <del> ! array_key_exists($this->wrapper(), $data)); <add> return (! empty($with) || ! empty($additional)) && <add> (! $this->wrapper() || <add> ! array_key_exists($this->wrapper(), $data)); <ide> } <ide> <ide> /** <ide><path>tests/Integration/Http/ResourceTest.php <ide> public function test_resources_may_customize_extra_data() <ide> ]); <ide> } <ide> <add> public function test_resources_may_customize_extra_data_when_building_response() <add> { <add> Route::get('/', function () { <add> return (new PostResourceWithExtraData(new Post([ <add> 'id' => 5, <add> 'title' => 'Test Title', <add> ])))->additional(['baz' => 'qux']); <add> }); <add> <add> $response = $this->withoutExceptionHandling()->get( <add> '/', ['Accept' => 'application/json'] <add> ); <add> <add> $response->assertJson([ <add> 'data' => [ <add> 'id' => 5, <add> 'title' => 'Test Title', <add> ], <add> 'foo' => 'bar', <add> 'baz' => 'qux', <add> ]); <add> } <add> <ide> public function test_custom_headers_may_be_set_on_responses() <ide> { <ide> Route::get('/', function () {
4
Ruby
Ruby
check authentication scheme in basic auth
a7a377ff3950078c44049031315b3b9a96c19bcf
<ide><path>actionpack/lib/action_controller/metal/http_authentication.rb <ide> def user_name_and_password(request) <ide> end <ide> <ide> def decode_credentials(request) <del> ::Base64.decode64(request.authorization.split(' ', 2).last || '') <add> scheme, param = request.authorization.split(' ', 2) <add> if scheme == 'Basic' <add> ::Base64.decode64(param || '') <add> else <add> '' <add> end <ide> end <ide> <ide> def encode_credentials(user_name, password) <ide><path>actionpack/test/controller/http_basic_authentication_test.rb <ide> def test_encode_credentials_has_no_newline <ide> assert_response :unauthorized <ide> end <ide> <add> test "authentication request with wrong scheme" do <add> header = 'Bearer ' + encode_credentials('David', 'Goliath').split(' ', 2)[1] <add> @request.env['HTTP_AUTHORIZATION'] = header <add> get :search <add> assert_response :unauthorized <add> end <add> <ide> private <ide> <ide> def encode_credentials(username, password)
2
Go
Go
use bool instead of string for flags
ab96da8eb2c81a90e5c081da26ee49c3af2f1ca5
<ide><path>api.go <ide> func getImages(srv *Server, w http.ResponseWriter, r *http.Request) error { <ide> return err <ide> } <ide> <del> viz := r.Form.Get("viz") <del> if viz == "1" { <add> viz := r.Form.Get("viz") == "1" <add> if viz { <ide> file, rwc, err := hijackServer(w) <ide> if file != nil { <ide> defer file.Close() <ide> func getImages(srv *Server, w http.ResponseWriter, r *http.Request) error { <ide> return nil <ide> } <ide> <del> all := r.Form.Get("all") <add> all := r.Form.Get("all") == "1" <ide> filter := r.Form.Get("filter") <del> quiet := r.Form.Get("quiet") <add> quiet := r.Form.Get("quiet") == "1" <ide> <del> outs, err := srv.Images(all, filter, quiet) <add> outs, err := srv.Images(all, quiet, filter) <ide> if err != nil { <ide> httpError(w, err) <ide> return err <ide> func getContainers(srv *Server, w http.ResponseWriter, r *http.Request) error { <ide> http.Error(w, err.Error(), http.StatusInternalServerError) <ide> return err <ide> } <del> all := r.Form.Get("all") <del> notrunc := r.Form.Get("notrunc") <del> quiet := r.Form.Get("quiet") <add> all := r.Form.Get("all") == "1" <add> notrunc := r.Form.Get("notrunc") == "1" <add> quiet := r.Form.Get("quiet") == "1" <ide> n, err := strconv.Atoi(r.Form.Get("n")) <ide> if err != nil { <ide> n = -1 <ide> func postImagesTag(srv *Server, w http.ResponseWriter, r *http.Request) error { <ide> tag := r.Form.Get("tag") <ide> vars := mux.Vars(r) <ide> name := vars["name"] <del> var force bool <del> if r.Form.Get("force") == "1" { <del> force = true <del> } <add> force := r.Form.Get("force") == "1" <ide> <ide> if err := srv.ContainerTag(name, repo, tag, force); err != nil { <ide> http.Error(w, err.Error(), http.StatusInternalServerError) <ide> func deleteContainers(srv *Server, w http.ResponseWriter, r *http.Request) error <ide> } <ide> vars := mux.Vars(r) <ide> name := vars["name"] <del> var v bool <del> if r.Form.Get("v") == "1" { <del> v = true <del> } <add> v := r.Form.Get("v") == "1" <add> <ide> if err := srv.ContainerDestroy(name, v); err != nil { <ide> httpError(w, err) <ide> return err <ide> func postContainersAttach(srv *Server, w http.ResponseWriter, r *http.Request) e <ide> http.Error(w, err.Error(), http.StatusInternalServerError) <ide> return err <ide> } <del> logs := r.Form.Get("logs") <del> stream := r.Form.Get("stream") <del> stdin := r.Form.Get("stdin") <del> stdout := r.Form.Get("stdout") <del> stderr := r.Form.Get("stderr") <add> logs := r.Form.Get("logs") == "1" <add> stream := r.Form.Get("stream") == "1" <add> stdin := r.Form.Get("stdin") == "1" <add> stdout := r.Form.Get("stdout") == "1" <add> stderr := r.Form.Get("stderr") == "1" <ide> vars := mux.Vars(r) <ide> name := vars["name"] <ide> <ide><path>server.go <ide> func (srv *Server) ImagesViz(file *os.File) error { <ide> return nil <ide> } <ide> <del>func (srv *Server) Images(all, filter, quiet string) ([]ApiImages, error) { <add>func (srv *Server) Images(all, quiet bool, filter string) ([]ApiImages, error) { <ide> var allImages map[string]*Image <ide> var err error <del> if all == "1" { <add> if all { <ide> allImages, err = srv.runtime.graph.Map() <ide> } else { <ide> allImages, err = srv.runtime.graph.Heads() <ide> func (srv *Server) Images(all, filter, quiet string) ([]ApiImages, error) { <ide> continue <ide> } <ide> delete(allImages, id) <del> if quiet != "1" { <add> if !quiet { <ide> out.Repository = name <ide> out.Tag = tag <ide> out.Id = TruncateId(id) <ide> func (srv *Server) Images(all, filter, quiet string) ([]ApiImages, error) { <ide> if filter == "" { <ide> for id, image := range allImages { <ide> var out ApiImages <del> if quiet != "1" { <add> if !quiet { <ide> out.Repository = "<none>" <ide> out.Tag = "<none>" <ide> out.Id = TruncateId(id) <ide> func (srv *Server) DockerInfo() ApiInfo { <ide> out.Containers = len(srv.runtime.List()) <ide> out.Version = VERSION <ide> out.Images = imgcount <del> if os.Getenv("DEBUG") == "1" { <add> if os.Getenv("DEBUG") != "" { <ide> out.Debug = true <ide> out.NFd = getTotalUsedFds() <ide> out.NGoroutines = runtime.NumGoroutine() <ide> func (srv *Server) ContainerPort(name, privatePort string) (string, error) { <ide> return "", fmt.Errorf("No such container: %s", name) <ide> } <ide> <del>func (srv *Server) Containers(all, notrunc, quiet string, n int) []ApiContainers { <add>func (srv *Server) Containers(all, notrunc, quiet bool, n int) []ApiContainers { <ide> var outs []ApiContainers = []ApiContainers{} //produce [] when empty instead of 'null' <ide> for i, container := range srv.runtime.List() { <del> if !container.State.Running && all != "1" && n == -1 { <add> if !container.State.Running && !all && n == -1 { <ide> continue <ide> } <ide> if i == n { <ide> break <ide> } <ide> var out ApiContainers <ide> out.Id = container.ShortId() <del> if quiet != "1" { <add> if !quiet { <ide> command := fmt.Sprintf("%s %s", container.Path, strings.Join(container.Args, " ")) <del> if notrunc != "1" { <add> if !notrunc { <ide> command = Trunc(command, 20) <ide> } <ide> out.Image = srv.runtime.repositories.ImageName(container.Image) <ide> func (srv *Server) ContainerWait(name string) (int, error) { <ide> return 0, fmt.Errorf("No such container: %s", name) <ide> } <ide> <del>func (srv *Server) ContainerAttach(name, logs, stream, stdin, stdout, stderr string, file *os.File) error { <add>func (srv *Server) ContainerAttach(name string, logs, stream, stdin, stdout, stderr bool, file *os.File) error { <ide> if container := srv.runtime.Get(name); container != nil { <ide> //logs <del> if logs == "1" { <del> if stdout == "1" { <add> if logs { <add> if stdout { <ide> cLog, err := container.ReadLog("stdout") <ide> if err != nil { <ide> Debugf(err.Error()) <ide> } else if _, err := io.Copy(file, cLog); err != nil { <ide> Debugf(err.Error()) <ide> } <ide> } <del> if stderr == "1" { <add> if stderr { <ide> cLog, err := container.ReadLog("stderr") <ide> if err != nil { <ide> Debugf(err.Error()) <ide> func (srv *Server) ContainerAttach(name, logs, stream, stdin, stdout, stderr str <ide> } <ide> <ide> //stream <del> if stream == "1" { <add> if stream { <ide> if container.State.Ghost { <ide> return fmt.Errorf("Impossible to attach to a ghost container") <ide> } <ide> func (srv *Server) ContainerAttach(name, logs, stream, stdin, stdout, stderr str <ide> cStdinCloser io.Closer <ide> ) <ide> <del> if stdin == "1" { <add> if stdin { <ide> r, w := io.Pipe() <ide> go func() { <ide> defer w.Close() <ide> func (srv *Server) ContainerAttach(name, logs, stream, stdin, stdout, stderr str <ide> cStdin = r <ide> cStdinCloser = file <ide> } <del> if stdout == "1" { <add> if stdout { <ide> cStdout = file <ide> } <del> if stderr == "1" { <add> if stderr { <ide> cStderr = file <ide> } <ide>
2
Mixed
Javascript
return this from incomingmessage#destroy()
ff6535a4331d611bf0d205ee23d88e100dce92b2
<ide><path>doc/api/http.md <ide> const req = http.request({ <ide> ### `message.destroy([error])` <ide> <!-- YAML <ide> added: v0.3.0 <add>changes: <add> - version: REPLACEME <add> pr-url: https://github.com/nodejs/node/pull/32789 <add> description: The function returns `this` for consistency with other Readable <add> streams. <ide> --> <ide> <ide> * `error` {Error} <add>* Returns: {this} <ide> <ide> Calls `destroy()` on the socket that received the `IncomingMessage`. If `error` <ide> is provided, an `'error'` event is emitted on the socket and `error` is passed <ide><path>lib/_http_incoming.js <ide> IncomingMessage.prototype.destroy = function destroy(error) { <ide> this.destroyed = true; <ide> if (this.socket) <ide> this.socket.destroy(error); <add> return this; <ide> }; <ide> <ide> <ide><path>test/parallel/test-http-incoming-message-destroy.js <add>'use strict'; <add> <add>// Test that http.IncomingMessage,prototype.destroy() returns `this`. <add>require('../common'); <add> <add>const assert = require('assert'); <add>const http = require('http'); <add>const incomingMessage = new http.IncomingMessage(); <add> <add>assert.strictEqual(incomingMessage.destroy(), incomingMessage);
3
PHP
PHP
fix incorrect test cases
6105714d77fb646a879576aef2af6a53c3bca351
<ide><path>tests/TestCase/Cache/Engine/XcacheEngineTest.php <ide> public function testConfig() <ide> 'prefix' => 'cake_', <ide> 'duration' => 3600, <ide> 'probability' => 100, <add> 'groups' => [], <ide> ]; <ide> $this->assertTrue(isset($config['PHP_AUTH_USER'])); <ide> $this->assertTrue(isset($config['PHP_AUTH_PW'])); <ide> public function testDeleteCache() <ide> */ <ide> public function testClearCache() <ide> { <add> if ((PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg')) { <add> $this->markTestSkipped('Xcache administration functions are not available for the CLI.'); <add> } <ide> $data = 'this is a test of the emergency broadcasting system'; <ide> $result = Cache::write('clear_test_1', $data, 'xcache'); <ide> $this->assertTrue($result); <ide> <ide> $result = Cache::write('clear_test_2', $data, 'xcache'); <ide> $this->assertTrue($result); <ide> <del> $result = Cache::clear(); <add> $result = Cache::clear(false, 'xcache'); <ide> $this->assertTrue($result); <ide> } <ide> <ide> public function testDecrement() <ide> $result = Cache::write('test_decrement', 5, 'xcache'); <ide> $this->assertTrue($result); <ide> <del> $result = Cache::decrement('test_decrement', 'xcache'); <add> $result = Cache::decrement('test_decrement', 1, 'xcache'); <ide> $this->assertEquals(4, $result); <ide> <ide> $result = Cache::read('test_decrement', 'xcache'); <ide> public function testIncrement() <ide> $result = Cache::write('test_increment', 5, 'xcache'); <ide> $this->assertTrue($result); <ide> <del> $result = Cache::increment('test_increment', 'xcache'); <add> $result = Cache::increment('test_increment', 1, 'xcache'); <ide> $this->assertEquals(6, $result); <ide> <ide> $result = Cache::read('test_increment', 'xcache');
1
Ruby
Ruby
move show_detailed_exceptions? to rescue module
5bcd119b8d9bb6d88c949956de1ce13c2673b877
<ide><path>actionpack/lib/action_controller/metal.rb <ide> def dispatch(name, request) #:nodoc: <ide> @_request = request <ide> @_env = request.env <ide> @_env['action_controller.instance'] = self <del> @_env['action_dispatch.show_detailed_exceptions'] = show_detailed_exceptions? <ide> process(name) <ide> to_a <ide> end <ide> <del> def show_detailed_exceptions? <del> defined?(Rails.application) && Rails.application.config.consider_all_requests_local || request.local? <del> end <del> <ide> def to_a #:nodoc: <ide> response ? response.to_a : [status, headers, response_body] <ide> end <ide><path>actionpack/lib/action_controller/metal/rescue.rb <ide> module Rescue <ide> extend ActiveSupport::Concern <ide> include ActiveSupport::Rescuable <ide> <add> included do <add> config_accessor :consider_all_requests_local <add> self.consider_all_requests_local = false if consider_all_requests_local.nil? <add> end <add> <ide> def rescue_with_handler(exception) <ide> if (exception.respond_to?(:original_exception) && <ide> (orig_exception = exception.original_exception) && <ide> def rescue_with_handler(exception) <ide> super(exception) <ide> end <ide> <add> def show_detailed_exceptions? <add> consider_all_requests_local || request.local? <add> end <add> <ide> private <ide> def process_action(*args) <ide> super <ide> rescue Exception => exception <add> request.env['action_dispatch.show_detailed_exceptions'] = show_detailed_exceptions? <ide> rescue_with_handler(exception) || raise(exception) <ide> end <ide> end <ide><path>actionpack/lib/action_controller/railtie.rb <ide> class Railtie < Rails::Railtie <ide> paths = app.config.paths <ide> options = app.config.action_controller <ide> <add> options.consider_all_requests_local ||= app.config.consider_all_requests_local <add> <ide> options.assets_dir ||= paths["public"].first <ide> options.javascripts_dir ||= paths["public/javascripts"].first <ide> options.stylesheets_dir ||= paths["public/stylesheets"].first <ide><path>actionpack/test/controller/show_exceptions_test.rb <ide> require 'abstract_unit' <ide> <ide> module ShowExceptions <del> class ShowExceptionsController < ActionController::Metal <add> class ShowExceptionsController < ActionController::Base <ide> use ActionDispatch::ShowExceptions <ide> <ide> def boom <ide> class ShowExceptionsTest < ActionDispatch::IntegrationTest <ide> end <ide> <ide> test 'show diagnostics from a remote ip when consider_all_requests_local is true' do <del> Rails.stubs(:application).returns stub(:config => stub(:consider_all_requests_local => true)) <add> ShowExceptionsController.any_instance.stubs(:consider_all_requests_local).returns(true) <ide> @app = ShowExceptionsController.action(:boom) <ide> self.remote_addr = '208.77.188.166' <ide> get '/'
4
Python
Python
add aws_conn_id to dynamodbtos3operator
5769defb2ac1bf7ea36a8a9ee9c26cfe515fba70
<ide><path>airflow/providers/amazon/aws/transfers/dynamodb_to_s3.py <ide> def _convert_item_to_json_bytes(item: Dict[str, Any]) -> bytes: <ide> return (json.dumps(item) + '\n').encode('utf-8') <ide> <ide> <del>def _upload_file_to_s3(file_obj: IO, bucket_name: str, s3_key_prefix: str) -> None: <del> s3_client = S3Hook().get_conn() <add>def _upload_file_to_s3( <add> file_obj: IO, bucket_name: str, s3_key_prefix: str, aws_conn_id: str = 'aws_default' <add>) -> None: <add> s3_client = S3Hook(aws_conn_id=aws_conn_id).get_conn() <ide> file_obj.seek(0) <ide> s3_client.upload_file( <ide> Filename=file_obj.name, <ide> class DynamoDBToS3Operator(BaseOperator): <ide> :type s3_key_prefix: Optional[str] <ide> :param process_func: How we transforms a dynamodb item to bytes. By default we dump the json <ide> :type process_func: Callable[[Dict[str, Any]], bytes] <add> :param aws_conn_id: The Airflow connection used for AWS credentials. <add> If this is None or empty then the default boto3 behaviour is used. If <add> running Airflow in a distributed manner and aws_conn_id is None or <add> empty, then default boto3 configuration would be used (and must be <add> maintained on each worker node). <add> :type aws_conn_id: str <ide> """ <ide> <ide> def __init__( <ide> def __init__( <ide> dynamodb_scan_kwargs: Optional[Dict[str, Any]] = None, <ide> s3_key_prefix: str = '', <ide> process_func: Callable[[Dict[str, Any]], bytes] = _convert_item_to_json_bytes, <add> aws_conn_id: str = 'aws_default', <ide> **kwargs, <ide> ) -> None: <ide> super().__init__(**kwargs) <ide> def __init__( <ide> self.dynamodb_scan_kwargs = dynamodb_scan_kwargs <ide> self.s3_bucket_name = s3_bucket_name <ide> self.s3_key_prefix = s3_key_prefix <add> self.aws_conn_id = aws_conn_id <ide> <ide> def execute(self, context) -> None: <del> table = AwsDynamoDBHook().get_conn().Table(self.dynamodb_table_name) <add> hook = AwsDynamoDBHook(aws_conn_id=self.aws_conn_id) <add> table = hook.get_conn().Table(self.dynamodb_table_name) <add> <ide> scan_kwargs = copy(self.dynamodb_scan_kwargs) if self.dynamodb_scan_kwargs else {} <ide> err = None <ide> with NamedTemporaryFile() as f: <ide> def execute(self, context) -> None: <ide> raise e <ide> finally: <ide> if err is None: <del> _upload_file_to_s3(f, self.s3_bucket_name, self.s3_key_prefix) <add> _upload_file_to_s3(f, self.s3_bucket_name, self.s3_key_prefix, self.aws_conn_id) <ide> <ide> def _scan_dynamodb_and_upload_to_s3(self, temp_file: IO, scan_kwargs: dict, table: Any) -> IO: <ide> while True: <ide> def _scan_dynamodb_and_upload_to_s3(self, temp_file: IO, scan_kwargs: dict, tabl <ide> <ide> # Upload the file to S3 if reach file size limit <ide> if getsize(temp_file.name) >= self.file_size: <del> _upload_file_to_s3(temp_file, self.s3_bucket_name, self.s3_key_prefix) <add> _upload_file_to_s3(temp_file, self.s3_bucket_name, self.s3_key_prefix, self.aws_conn_id) <ide> temp_file.close() <ide> <ide> temp_file = NamedTemporaryFile() <ide><path>tests/providers/amazon/aws/transfers/test_dynamodb_to_s3.py <ide> def test_dynamodb_to_s3_success(self, mock_aws_dynamodb_hook, mock_s3_hook): <ide> dynamodb_to_s3_operator.execute(context={}) <ide> <ide> assert [{'a': 1}, {'b': 2}, {'c': 3}] == self.output_queue <add> <add> @patch('airflow.providers.amazon.aws.transfers.dynamodb_to_s3.S3Hook') <add> @patch('airflow.providers.amazon.aws.transfers.dynamodb_to_s3.AwsDynamoDBHook') <add> def test_dynamodb_to_s3_with_different_aws_conn_id(self, mock_aws_dynamodb_hook, mock_s3_hook): <add> responses = [ <add> { <add> 'Items': [{'a': 1}, {'b': 2}], <add> 'LastEvaluatedKey': '123', <add> }, <add> { <add> 'Items': [{'c': 3}], <add> }, <add> ] <add> table = MagicMock() <add> table.return_value.scan.side_effect = responses <add> mock_aws_dynamodb_hook.return_value.get_conn.return_value.Table = table <add> <add> s3_client = MagicMock() <add> s3_client.return_value.upload_file = self.mock_upload_file <add> mock_s3_hook.return_value.get_conn = s3_client <add> <add> aws_conn_id = "test-conn-id" <add> dynamodb_to_s3_operator = DynamoDBToS3Operator( <add> task_id='dynamodb_to_s3', <add> dynamodb_table_name='airflow_rocks', <add> s3_bucket_name='airflow-bucket', <add> file_size=4000, <add> aws_conn_id=aws_conn_id, <add> ) <add> <add> dynamodb_to_s3_operator.execute(context={}) <add> <add> assert [{'a': 1}, {'b': 2}, {'c': 3}] == self.output_queue <add> <add> mock_s3_hook.assert_called_with(aws_conn_id=aws_conn_id) <add> mock_aws_dynamodb_hook.assert_called_with(aws_conn_id=aws_conn_id)
2
Python
Python
add test for chinese tokenization
4d124baf8f4706c6060d446b38f07c4258a91d97
<ide><path>tests/tokenization_test.py <ide> def test_full_tokenizer(self): <ide> self.assertListEqual( <ide> tokenizer.convert_tokens_to_ids(tokens), [7, 4, 5, 10, 8, 9]) <ide> <add> def test_chinese(self): <add> tokenizer = tokenization.BasicTokenizer() <add> <add> self.assertListEqual( <add> tokenizer.tokenize(u"ah\u535A\u63A8zz"), <add> [u"ah", u"\u535A", u"\u63A8", u"zz"]) <add> <ide> def test_basic_tokenizer_lower(self): <ide> tokenizer = tokenization.BasicTokenizer(do_lower_case=True) <ide>
1
PHP
PHP
provide notification callback with swift message
5de1d43c72b1f9d6161def6a6c343c9bf663fbac
<ide><path>src/Illuminate/Notifications/Channels/MailChannel.php <ide> protected function buildMessage($mailMessage, $notifiable, $notification, $messa <ide> if (! is_null($message->priority)) { <ide> $mailMessage->setPriority($message->priority); <ide> } <add> <add> $this->runCallbacks($mailMessage, $message); <ide> } <ide> <ide> /** <ide> protected function addAttachments($mailMessage, $message) <ide> $mailMessage->attachData($attachment['data'], $attachment['name'], $attachment['options']); <ide> } <ide> } <add> <add> /** <add> * Run the callbacks for the message. <add> * <add> * @param \Illuminate\Mail\Message $mailMessage <add> * @param \Illuminate\Notifications\Messages\MailMessage $message <add> * @return $this <add> */ <add> protected function runCallbacks($mailMessage, $message) <add> { <add> foreach ($message->callbacks as $callback) { <add> $callback($mailMessage->getSwiftMessage()); <add> } <add> <add> return $this; <add> } <ide> } <ide><path>src/Illuminate/Notifications/Messages/MailMessage.php <ide> class MailMessage extends SimpleMessage implements Renderable <ide> */ <ide> public $rawAttachments = []; <ide> <add> /** <add> * The callbacks for the message. <add> * <add> * @var array <add> */ <add> public $callbacks = []; <add> <ide> /** <ide> * Priority level of the message. <ide> * <ide> public function attachData($data, $name, array $options = []) <ide> return $this; <ide> } <ide> <add> /** <add> * Add a callback for the message. <add> * <add> * @param callable $callback <add> * @return $this <add> */ <add> public function withSwiftMessage($callback) <add> { <add> $this->callbacks[] = $callback; <add> <add> return $this; <add> } <add> <ide> /** <ide> * Set the priority of this message. <ide> * <ide><path>tests/Notifications/NotificationMailMessageTest.php <ide> public function testReplyToIsSetCorrectly() <ide> <ide> $this->assertSame([['test@example.com', null], ['test@example.com', 'Test']], $message->replyTo); <ide> } <add> <add> public function testCallbackIsSetCorrectly() <add> { <add> $callback = function () { <add> // <add> }; <add> <add> $message = new MailMessage; <add> $message->withSwiftMessage($callback); <add> <add> $this->assertSame([$callback], $message->callbacks); <add> } <ide> }
3
Text
Text
remove link to edgeapi [ci skip]
529cebe22fb363385c00c8da833a74ba4aeaee03
<ide><path>guides/source/configuring.md <ide> application. Accepts a valid week day symbol (e.g. `:monday`). <ide> you don't want shown in the logs, such as passwords or credit card <ide> numbers. By default, Rails filters out passwords by adding `Rails.application.config.filter_parameters += [:password]` in `config/initializers/filter_parameter_logging.rb`. Parameters filter works by partial matching regular expression. <ide> <del>* `config.force_ssl` forces all requests to be served over HTTPS by using the `ActionDispatch::SSL` middleware, and sets `config.action_mailer.default_url_options` to be `{ protocol: 'https' }`. This can be configured by setting `config.ssl_options` - see the [ActionDispatch::SSL documentation](http://edgeapi.rubyonrails.org/classes/ActionDispatch/SSL.html) for details. <add>* `config.force_ssl` forces all requests to be served over HTTPS by using the `ActionDispatch::SSL` middleware, and sets `config.action_mailer.default_url_options` to be `{ protocol: 'https' }`. This can be configured by setting `config.ssl_options` - see the [ActionDispatch::SSL documentation](http://api.rubyonrails.org/classes/ActionDispatch/SSL.html) for details. <ide> <ide> * `config.log_formatter` defines the formatter of the Rails logger. This option defaults to an instance of `ActiveSupport::Logger::SimpleFormatter` for all modes. If you are setting a value for `config.logger` you must manually pass the value of your formatter to your logger before it is wrapped in an `ActiveSupport::TaggedLogging` instance, Rails will not do it for you. <ide>
1
Ruby
Ruby
use 6.1 on mavericks.""
e5e206f4f1c6735e8b9ce0c8378e76ba56141d64
<ide><path>Library/Homebrew/os/mac/xcode.rb <ide> def latest_version <ide> when "10.6" then "3.2.6" <ide> when "10.7" then "4.6.3" <ide> when "10.8" then "5.1.1" <del> when "10.9" then "6.0.1" <add> when "10.9" then "6.1" <ide> when "10.10" then "6.1" <ide> else <ide> # Default to newest known version of Xcode for unreleased OSX versions. <ide> def installed? <ide> def latest_version <ide> case MacOS.version <ide> when "10.10" then "600.0.54" <del> when "10.9" then "600.0.51" <add> when "10.9" then "600.0.54" <ide> when "10.8" then "503.0.40" <ide> else <ide> "425.0.28"
1
Text
Text
add tensorboard instruction to slim's readme.md
0b279c7a0967ab149454e672f61e3a7413351b01
<ide><path>slim/README.md <ide> and/or multiple CPUs, either synchrononously or asynchronously. <ide> See [model_deploy](https://github.com/tensorflow/models/blob/master/slim/deployment/model_deploy.py) <ide> for details. <ide> <add>### TensorBoard <add> <add>To visualize the losses and other metrics during training, you can use <add>[TensorBoard](https://github.com/tensorflow/tensorboard) <add>by running the command below. <add> <add>```shell <add>tensorboard --logdir=${TRAIN_DIR} <add>``` <add> <add>Once TensorBoard is running, navigate your web browser to http://localhost:6006. <ide> <ide> # Fine-tuning a model from an existing checkpoint <ide> <a id='Tuning'></a>
1
Go
Go
add test coverage for devicemapper driver.go
6b3dd02bb8068fd9f1d35e75db95d0650a1d3123
<ide><path>devmapper/driver.go <ide> type Driver struct { <ide> } <ide> <ide> func Init(home string) (graphdriver.Driver, error) { <del> deviceSet, err := NewDeviceSet(home); <add> deviceSet, err := NewDeviceSet(home) <ide> if err != nil { <ide> return nil, err <ide> } <ide> func (d *Driver) Size(id string) (int64, error) { <ide> return -1, fmt.Errorf("Not implemented") <ide> } <ide> <del>func (d *Driver) mount(id, mp string) error { <add>func (d *Driver) mount(id, mountPoint string) error { <ide> // Create the target directories if they don't exist <del> if err := os.MkdirAll(mp, 0755); err != nil && !os.IsExist(err) { <add> if err := os.MkdirAll(mountPoint, 0755); err != nil && !os.IsExist(err) { <ide> return err <ide> } <ide> // If mountpoint is already mounted, do nothing <del> if mounted, err := Mounted(mp); err != nil { <add> if mounted, err := Mounted(mountPoint); err != nil { <ide> return fmt.Errorf("Error checking mountpoint: %s", err) <ide> } else if mounted { <ide> return nil <ide> } <ide> // Mount the device <del> return d.DeviceSet.MountDevice(id, mp, false) <add> return d.DeviceSet.MountDevice(id, mountPoint, false) <ide> } <ide><path>devmapper/driver_test.go <ide> package devmapper <ide> import ( <ide> "io/ioutil" <ide> "os" <add> "path" <ide> "testing" <ide> ) <ide> <add>func init() { <add> // Reduce the size the the base fs and loopback for the tests <add> DefaultDataLoopbackSize = 300 * 1024 * 1024 <add> DefaultMetaDataLoopbackSize = 200 * 1024 * 1024 <add> DefaultBaseFsSize = 300 * 1024 * 1024 <add> <add>} <add> <ide> func mkTestDirectory(t *testing.T) string { <ide> dir, err := ioutil.TempDir("", "docker-test-devmapper-") <ide> if err != nil { <ide> func mkTestDirectory(t *testing.T) string { <ide> return dir <ide> } <ide> <add>func newDriver(t *testing.T) *Driver { <add> home := mkTestDirectory(t) <add> d, err := Init(home) <add> if err != nil { <add> t.Fatal(err) <add> } <add> return d.(*Driver) <add>} <add> <add>func cleanup(d *Driver) { <add> d.Cleanup() <add> os.RemoveAll(d.home) <add>} <add> <ide> func TestInit(t *testing.T) { <ide> home := mkTestDirectory(t) <ide> defer os.RemoveAll(home) <ide> func TestInit(t *testing.T) { <ide> t.Fatal(err) <ide> } <ide> defer func() { <del> return <ide> if err := driver.Cleanup(); err != nil { <ide> t.Fatal(err) <ide> } <ide> }() <add> <ide> id := "foo" <ide> if err := driver.Create(id, ""); err != nil { <ide> t.Fatal(err) <ide> func TestInit(t *testing.T) { <ide> t.Fatalf("Get(%V) did not return a directory", id) <ide> } <ide> } <add> <add>func TestDriverName(t *testing.T) { <add> d := newDriver(t) <add> defer cleanup(d) <add> <add> if d.String() != "devicemapper" { <add> t.Fatalf("Expected driver name to be devicemapper got %s", d.String()) <add> } <add>} <add> <add>func TestDriverCreate(t *testing.T) { <add> d := newDriver(t) <add> defer cleanup(d) <add> <add> if err := d.Create("1", ""); err != nil { <add> t.Fatal(err) <add> } <add>} <add> <add>func TestDriverRemove(t *testing.T) { <add> d := newDriver(t) <add> defer cleanup(d) <add> <add> if err := d.Create("1", ""); err != nil { <add> t.Fatal(err) <add> } <add> <add> if err := d.Remove("1"); err != nil { <add> t.Fatal(err) <add> } <add>} <add> <add>func TestCleanup(t *testing.T) { <add> d := newDriver(t) <add> defer os.RemoveAll(d.home) <add> <add> mountPoints := make([]string, 2) <add> <add> if err := d.Create("1", ""); err != nil { <add> t.Fatal(err) <add> } <add> // Mount the id <add> p, err := d.Get("1") <add> if err != nil { <add> t.Fatal(err) <add> } <add> mountPoints[0] = p <add> <add> if err := d.Create("2", "1"); err != nil { <add> t.Fatal(err) <add> } <add> <add> p, err = d.Get("2") <add> if err != nil { <add> t.Fatal(err) <add> } <add> mountPoints[1] = p <add> <add> // Ensure that all the mount points are currently mounted <add> for _, p := range mountPoints { <add> if mounted, err := Mounted(p); err != nil { <add> t.Fatal(err) <add> } else if !mounted { <add> t.Fatalf("Expected %s to be mounted", p) <add> } <add> } <add> <add> // Ensure that devices are active <add> for _, p := range []string{"1", "2"} { <add> if !d.HasActivatedDevice(p) { <add> t.Fatalf("Expected %s to have an active device", p) <add> } <add> } <add> <add> if err := d.Cleanup(); err != nil { <add> t.Fatal(err) <add> } <add> <add> // Ensure that all the mount points are no longer mounted <add> for _, p := range mountPoints { <add> if mounted, err := Mounted(p); err != nil { <add> t.Fatal(err) <add> } else if mounted { <add> t.Fatalf("Expected %s to not be mounted", p) <add> } <add> } <add> <add> // Ensure that devices are no longer activated <add> for _, p := range []string{"1", "2"} { <add> if d.HasActivatedDevice(p) { <add> t.Fatalf("Expected %s not be an active device", p) <add> } <add> } <add>} <add> <add>func TestNotMounted(t *testing.T) { <add> d := newDriver(t) <add> defer cleanup(d) <add> <add> if err := d.Create("1", ""); err != nil { <add> t.Fatal(err) <add> } <add> <add> mounted, err := Mounted(path.Join(d.home, "mnt", "1")) <add> if err != nil { <add> t.Fatal(err) <add> } <add> if mounted { <add> t.Fatal("Id 1 should not be mounted") <add> } <add>} <add> <add>func TestMounted(t *testing.T) { <add> d := newDriver(t) <add> defer cleanup(d) <add> <add> if err := d.Create("1", ""); err != nil { <add> t.Fatal(err) <add> } <add> if _, err := d.Get("1"); err != nil { <add> t.Fatal(err) <add> } <add> <add> mounted, err := Mounted(path.Join(d.home, "mnt", "1")) <add> if err != nil { <add> t.Fatal(err) <add> } <add> if !mounted { <add> t.Fatal("Id 1 should be mounted") <add> } <add>} <add> <add>func TestInitCleanedDriver(t *testing.T) { <add> d := newDriver(t) <add> <add> if err := d.Create("1", ""); err != nil { <add> t.Fatal(err) <add> } <add> if _, err := d.Get("1"); err != nil { <add> t.Fatal(err) <add> } <add> <add> if err := d.Cleanup(); err != nil { <add> t.Fatal(err) <add> } <add> <add> driver, err := Init(d.home) <add> if err != nil { <add> t.Fatal(err) <add> } <add> d = driver.(*Driver) <add> defer cleanup(d) <add> <add> if _, err := d.Get("1"); err != nil { <add> t.Fatal(err) <add> } <add>} <add> <add>func TestMountMountedDriver(t *testing.T) { <add> d := newDriver(t) <add> defer cleanup(d) <add> <add> if err := d.Create("1", ""); err != nil { <add> t.Fatal(err) <add> } <add> <add> // Perform get on same id to ensure that it will <add> // not be mounted twice <add> if _, err := d.Get("1"); err != nil { <add> t.Fatal(err) <add> } <add> if _, err := d.Get("1"); err != nil { <add> t.Fatal(err) <add> } <add>} <add> <add>func TestGetReturnsValidDevice(t *testing.T) { <add> d := newDriver(t) <add> defer cleanup(d) <add> <add> if err := d.Create("1", ""); err != nil { <add> t.Fatal(err) <add> } <add> <add> if !d.HasDevice("1") { <add> t.Fatalf("Expected id 1 to be in device set") <add> } <add> <add> if _, err := d.Get("1"); err != nil { <add> t.Fatal(err) <add> } <add> <add> if !d.HasActivatedDevice("1") { <add> t.Fatalf("Expected id 1 to be activated") <add> } <add> <add> if !d.HasInitializedDevice("1") { <add> t.Fatalf("Expected id 1 to be initialized") <add> } <add>} <add> <add>func TestDriverGetSize(t *testing.T) { <add> t.Skipf("Size is currently not implemented") <add> <add> d := newDriver(t) <add> defer cleanup(d) <add> <add> if err := d.Create("1", ""); err != nil { <add> t.Fatal(err) <add> } <add> <add> mountPoint, err := d.Get("1") <add> if err != nil { <add> t.Fatal(err) <add> } <add> <add> size := int64(1024) <add> <add> f, err := os.Create(path.Join(mountPoint, "test_file")) <add> if err != nil { <add> t.Fatal(err) <add> } <add> if err := f.Truncate(size); err != nil { <add> t.Fatal(err) <add> } <add> f.Close() <add> <add> diffSize, err := d.Size("1") <add> if err != nil { <add> t.Fatal(err) <add> } <add> if diffSize != size { <add> t.Fatalf("Expected size %d got %d", size, diffSize) <add> } <add>}
2
Javascript
Javascript
remove three prefixes
6404d18493e9d75bd12bf5f7ae787d0ea51dac2b
<ide><path>src/renderers/WebGLRenderer.js <ide> function WebGLRenderer( parameters ) { <ide> <ide> _projScreenMatrix = new Matrix4(), <ide> <del> _vector3 = new THREE.Vector3(), <del> _matrix4 = new THREE.Matrix4(), _matrix42 = new THREE.Matrix4(), <add> _vector3 = new Vector3(), <add> _matrix4 = new Matrix4(), <add> _matrix42 = new Matrix4(), <ide> <ide> // light arrays cache <ide>
1
Javascript
Javascript
utilize `map` and `set` in `property_events`
56183a1c248bd60a3ec3f92c8fefa0ddf4e423fe
<ide><path>packages/ember-metal/lib/property_events.js <del>import { guidFor, symbol } from 'ember-utils'; <add>import { symbol } from 'ember-utils'; <ide> import { <ide> descriptorFor, <ide> peekMeta <ide> function notifyPropertyChange(obj, keyName, _meta) { <ide> } <ide> } <ide> <del>let DID_SEEN; <add>let DID_SEEN = null; <ide> <ide> // called whenever a property has just changed to update dependent keys <ide> function dependentKeysDidChange(obj, depKey, meta) { <ide> if (meta.isSourceDestroying() || !meta.hasDeps(depKey)) { return; } <ide> let seen = DID_SEEN; <del> let top = !seen; <add> let top = seen === null; <ide> <ide> if (top) { <del> seen = DID_SEEN = {}; <add> seen = DID_SEEN = new Map(); <ide> } <ide> <ide> iterDeps(notifyPropertyChange, obj, depKey, seen, meta); <ide> function dependentKeysDidChange(obj, depKey, meta) { <ide> } <ide> <ide> function iterDeps(method, obj, depKey, seen, meta) { <del> let possibleDesc; <del> let guid = guidFor(obj); <del> let current = seen[guid]; <del> <del> if (!current) { <del> current = seen[guid] = {}; <del> } <add> let current = seen.get(obj); <ide> <del> if (current[depKey]) { <del> return; <add> if (current === undefined) { <add> current = new Set(); <add> seen.set(obj, current); <ide> } <ide> <del> current[depKey] = true; <add> if (current.has(depKey)) { return; } <ide> <add> let possibleDesc; <ide> meta.forEachInDeps(depKey, (key, value) => { <ide> if (!value) { return; } <ide>
1
Javascript
Javascript
update open graph and twitter meta
c21af106bb9bdd4b868e143ac2981c586633f50e
<ide><path>client/src/head/meta.js <ide> import React from 'react'; <ide> <ide> const meta = [ <add> <meta content='freeCodeCamp.org' name='og:title' />, <add> <meta <add> content={ <add> 'Learn to code. Build projects. Earn certifications.' + <add> 'Since 2015, 40,000 graduates have gotten jobs at tech ' + <add> 'companies including Google, Apple, Amazon, and Microsoft.' <add> } <add> name='og:description' <add> />, <add> <meta <add> content='https://cdn.freecodecamp.org/platform/universal/fcc-og-1200-social-green.png' <add> property='og:image' <add> />, <ide> <meta content='summary_large_image' key='twitter:card' name='twitter:card' />, <ide> <meta <del> content='https://s3.amazonaws.com/freecodecamp/curriculum-diagram-full.jpg' <del> key='https://s3.amazonaws.com/freecodecamp/curriculum-diagram-full.jpg' <add> content='https://cdn.freecodecamp.org/platform/universal/fcc-twitter-1120X600-social-green.png' <ide> name='twitter:image:src' <ide> />, <add> <meta content='freeCodeCamp.org' name='twitter:title' />, <ide> <meta <del> content='https://s3.amazonaws.com/freecodecamp/curriculum-diagram-full.jpg' <del> key='https://s3.amazonaws.com/freecodecamp/curriculum-diagram-full.jpg' <del> property='og:image' <add> content={ <add> 'Learn to code. Build projects. Earn certifications.' + <add> 'Since 2015, 40,000 graduates have gotten jobs at tech ' + <add> 'companies including Google, Apple, Amazon, and Microsoft.' <add> } <add> name='twitter:description' <ide> /> <ide> ]; <ide>
1
PHP
PHP
remove outdated information
0860444e37099f1de9a7634b3d743092ba4537d8
<ide><path>src/Shell/TestShell.php <ide> public function outputWarning() { <ide> $this->err(''); <ide> $this->err('TestShell has been removed and replaced with <info>phpunit</info>.'); <ide> $this->err(''); <del> $this->err('To run your application tests run <info>phpunit --stderr</info>'); <del> $this->err('To run plugin tests, cd into the plugin directory and run <info>phpunit --stderr</info>'); <add> $this->err('To run your application tests run <info>phpunit</info>'); <add> $this->err('To run plugin tests, cd into the plugin directory and run <info>phpunit</info>'); <ide> } <ide> <ide> }
1
Text
Text
remove minor contradiction in debugger doc
98f9b5df1268a9473bf36a48373fc2b3792b3dd0
<ide><path>doc/api/debugger.md <ide> <ide> <!-- type=misc --> <ide> <del>Node.js includes a full-featured out-of-process debugging utility accessible <del>via a simple [TCP-based protocol][] and built-in debugging client. To use it, <del>start Node.js with the `debug` argument followed by the path to the script to <del>debug; a prompt will be displayed indicating successful launch of the debugger: <add>Node.js includes an out-of-process debugging utility accessible via a <add>[TCP-based protocol][] and built-in debugging client. To use it, start Node.js <add>with the `debug` argument followed by the path to the script to debug; a prompt <add>will be displayed indicating successful launch of the debugger: <ide> <ide> ```txt <ide> $ node debug myscript.js
1
Python
Python
add `isupper` examples
91d1c1ebd26d3269c45051d61bf24efb8db0678e
<ide><path>numpy/core/defchararray.py <ide> def istitle(a): <ide> @array_function_dispatch(_unary_op_dispatcher) <ide> def isupper(a): <ide> """ <del> Returns true for each element if all cased characters in the <add> Return true for each element if all cased characters in the <ide> string are uppercase and there is at least one character, false <ide> otherwise. <ide> <ide> def isupper(a): <ide> -------- <ide> >>> str = "GHC" <ide> >>> np.char.isupper(str) <del> array(True) <add> array(True) <add> >>> a = np.array(["hello", "HELLO", "Hello"]) <add> >>> np.char.isupper(a) <add> array([False, True, False]) <ide> <ide> """ <ide> return _vec_string(a, bool_, 'isupper')
1
Javascript
Javascript
fire a tick immediately on start
55759258fdb5e01a2d42c6a1101d687f0c5ce01c
<ide><path>d3.js <ide> function d3_transition(groups, id) { <ide> <ide> delay <= elapsed ? start() : d3.timer(start, delay, then); <ide> <del> function start() { <add> function start(elapsed) { <ide> if (lock.active > id) return stop(); <ide> lock.active = id; <ide> <ide> function d3_transition(groups, id) { <ide> } <ide> <ide> event.start.dispatch.call(node, d, i); <del> d3.timer(tick, 0, then); <add> if (!tick(elapsed)) d3.timer(tick, 0, then); <ide> return 1; <ide> } <ide> <ide><path>d3.min.js <del>(function(){function dl(a,b,c){function i(a,b){var c=a.__domain||(a.__domain=a.domain()),d=a.range().map(function(a){return(a-b)/h});a.domain(c).domain(d.map(a.invert))}var d=Math.pow(2,(c$[2]=a)-c[2]),e=c$[0]=b[0]-d*c[0],f=c$[1]=b[1]-d*c[1],g=d3.event,h=Math.pow(2,a);d3.event={scale:h,translate:[e,f],transform:function(a,b){a&&i(a,e),b&&i(b,f)}};try{c_.apply(da,db)}finally{d3.event=g}g.preventDefault()}function dk(){dd&&(d3.event.stopPropagation(),d3.event.preventDefault(),dd=!1)}function dj(){cW&&(dc&&(dd=!0),di(),cW=null)}function di(){cX=null,cW&&(dc=!0,dl(c$[2],d3.svg.mouse(da),cW))}function dh(){var a=d3.svg.touches(da);switch(a.length){case 1:var b=a[0];dl(c$[2],b,cY[b.identifier]);break;case 2:var c=a[0],d=a[1],e=[(c[0]+d[0])/2,(c[1]+d[1])/2],f=cY[c.identifier],g=cY[d.identifier],h=[(f[0]+g[0])/2,(f[1]+g[1])/2,f[2]];dl(Math.log(d3.event.scale)/Math.LN2+f[2],e,h)}}function dg(){var a=d3.svg.touches(da),b=-1,c=a.length,d;while(++b<c)cY[(d=a[b]).identifier]=de(d);return a}function df(){cV||(cV=d3.select("body").append("div").style("visibility","hidden").style("top",0).style("height",0).style("width",0).style("overflow-y","scroll").append("div").style("height","2000px").node().parentNode);var a=d3.event,b;try{cV.scrollTop=1e3,cV.dispatchEvent(a),b=1e3-cV.scrollTop}catch(c){b=a.wheelDelta||-a.detail*5}return b*.005}function de(a){return[a[0]-c$[0],a[1]-c$[1],c$[2]]}function cU(){d3.event.stopPropagation(),d3.event.preventDefault()}function cT(){cO&&(cU(),cO=!1)}function cS(){!cK||(cP("dragend"),cK=null,cN&&(cO=!0,cU()))}function cR(){if(!!cK){var a=cK.parentNode;if(!a)return cS();cP("drag"),cU()}}function cQ(a){return d3.event.touches?d3.svg.touches(a)[0]:d3.svg.mouse(a)}function cP(a){var b=d3.event,c=cK.parentNode,d=0,e=0;c&&(c=cQ(c),d=c[0]-cM[0],e=c[1]-cM[1],cM=c,cN|=d|e);try{d3.event={dx:d,dy:e},cJ[a].dispatch.apply(cK,cL)}finally{d3.event=b}b.preventDefault()}function cI(a,b,c){e=[];if(c&&b.length>1){var d=bm(a.domain()),e,f=-1,g=b.length,h=(b[1]-b[0])/++c,i,j;while(++f<g)for(i=c;--i>0;)(j=+b[f]-i*h)>=d[0]&&e.push(j);for(--f,i=0;++i<c&&(j=+b[f]+i*h)<d[1];)e.push(j)}return e}function cH(a,b){a.attr("transform",function(a){return"translate(0,"+b(a)+")"})}function cG(a,b){a.attr("transform",function(a){return"translate("+b(a)+",0)"})}function cC(){return"circle"}function cB(){return 64}function cA(a,b){var c=(a.ownerSVGElement||a).createSVGPoint();if(cz<0&&(window.scrollX||window.scrollY)){var d=d3.select(document.body).append("svg:svg").style("position","absolute").style("top",0).style("left",0),e=d[0][0].getScreenCTM();cz=!e.f&&!e.e,d.remove()}cz?(c.x=b.pageX,c.y=b.pageY):(c.x=b.clientX,c.y=b.clientY),c=c.matrixTransform(a.getScreenCTM().inverse());return[c.x,c.y]}function cy(a){return function(){var b=a.apply(this,arguments),c=b[0],d=b[1]+bK;return[c*Math.cos(d),c*Math.sin(d)]}}function cx(a){return[a.x,a.y]}function cw(a){return a.endAngle}function cv(a){return a.startAngle}function cu(a){return a.radius}function ct(a){return a.target}function cs(a){return a.source}function cr(a){return function(b,c){return a[c][1]}}function cq(a){return function(b,c){return a[c][0]}}function cp(a){function i(f){if(f.length<1)return null;var i=bR(this,f,b,d),j=bR(this,f,b===c?cq(i):c,d===e?cr(i):e);return"M"+g(a(j),h)+"L"+g(a(i.reverse()),h)+"Z"}var b=bS,c=bS,d=0,e=bT,f="linear",g=bU[f],h=.7;i.x=function(a){if(!arguments.length)return c;b=c=a;return i},i.x0=function(a){if(!arguments.length)return b;b=a;return i},i.x1=function(a){if(!arguments.length)return c;c=a;return i},i.y=function(a){if(!arguments.length)return e;d=e=a;return i},i.y0=function(a){if(!arguments.length)return d;d=a;return i},i.y1=function(a){if(!arguments.length)return e;e=a;return i},i.interpolate=function(a){if(!arguments.length)return f;g=bU[f=a];return i},i.tension=function(a){if(!arguments.length)return h;h=a;return i};return i}function co(a){var b,c=-1,d=a.length,e,f;while(++c<d)b=a[c],e=b[0],f=b[1]+bK,b[0]=e*Math.cos(f),b[1]=e*Math.sin(f);return a}function cn(a){return a.length<3?bV(a):a[0]+b_(a,cm(a))}function cm(a){var b=[],c,d,e,f,g=cl(a),h=-1,i=a.length-1;while(++h<i)c=ck(a[h],a[h+1]),Math.abs(c)<1e-6?g[h]=g[h+1]=0:(d=g[h]/c,e=g[h+1]/c,f=d*d+e*e,f>9&&(f=c*3/Math.sqrt(f),g[h]=f*d,g[h+1]=f*e));h=-1;while(++h<=i)f=(a[Math.min(i,h+1)][0]-a[Math.max(0,h-1)][0])/(6*(1+g[h]*g[h])),b.push([f||0,g[h]*f||0]);return b}function cl(a){var b=0,c=a.length-1,d=[],e=a[0],f=a[1],g=d[0]=ck(e,f);while(++b<c)d[b]=g+(g=ck(e=f,f=a[b+1]));d[b]=g;return d}function ck(a,b){return(b[1]-a[1])/(b[0]-a[0])}function cj(a,b,c){a.push("C",cf(cg,b),",",cf(cg,c),",",cf(ch,b),",",cf(ch,c),",",cf(ci,b),",",cf(ci,c))}function cf(a,b){return a[0]*b[0]+a[1]*b[1]+a[2]*b[2]+a[3]*b[3]}function ce(a,b){var c=a.length-1,d=a[0][0],e=a[0][1],f=a[c][0]-d,g=a[c][1]-e,h=-1,i,j;while(++h<=c)i=a[h],j=h/c,i[0]=b*i[0]+(1-b)*(d+j*f),i[1]=b*i[1]+(1-b)*(e+j*g);return cb(a)}function cd(a){var b,c=-1,d=a.length,e=d+4,f,g=[],h=[];while(++c<4)f=a[c%d],g.push(f[0]),h.push(f[1]);b=[cf(ci,g),",",cf(ci,h)],--c;while(++c<e)f=a[c%d],g.shift(),g.push(f[0]),h.shift(),h.push(f[1]),cj(b,g,h);return b.join("")}function cc(a){if(a.length<4)return bV(a);var b=[],c=-1,d=a.length,e,f=[0],g=[0];while(++c<3)e=a[c],f.push(e[0]),g.push(e[1]);b.push(cf(ci,f)+","+cf(ci,g)),--c;while(++c<d)e=a[c],f.shift(),f.push(e[0]),g.shift(),g.push(e[1]),cj(b,f,g);return b.join("")}function cb(a){if(a.length<3)return bV(a);var b=[],c=1,d=a.length,e=a[0],f=e[0],g=e[1],h=[f,f,f,(e=a[1])[0]],i=[g,g,g,e[1]];b.push(f,",",g),cj(b,h,i);while(++c<d)e=a[c],h.shift(),h.push(e[0]),i.shift(),i.push(e[1]),cj(b,h,i);c=-1;while(++c<2)h.shift(),h.push(e[0]),i.shift(),i.push(e[1]),cj(b,h,i);return b.join("")}function ca(a,b){var c=[],d=(1-b)/2,e,f=a[0],g=a[1],h=1,i=a.length;while(++h<i)e=f,f=g,g=a[h],c.push([d*(g[0]-e[0]),d*(g[1]-e[1])]);return c}function b_(a,b){if(b.length<1||a.length!=b.length&&a.length!=b.length+2)return bV(a);var c=a.length!=b.length,d="",e=a[0],f=a[1],g=b[0],h=g,i=1;c&&(d+="Q"+(f[0]-g[0]*2/3)+","+(f[1]-g[1]*2/3)+","+f[0]+","+f[1],e=a[1],i=2);if(b.length>1){h=b[1],f=a[i],i++,d+="C"+(e[0]+g[0])+","+(e[1]+g[1])+","+(f[0]-h[0])+","+(f[1]-h[1])+","+f[0]+","+f[1];for(var j=2;j<b.length;j++,i++)f=a[i],h=b[j],d+="S"+(f[0]-h[0])+","+(f[1]-h[1])+","+f[0]+","+f[1]}if(c){var k=a[i];d+="Q"+(f[0]+h[0]*2/3)+","+(f[1]+h[1]*2/3)+","+k[0]+","+k[1]}return d}function b$(a,b,c){return a.length<3?bV(a):a[0]+b_(a,ca(a,b))}function bZ(a,b){return a.length<3?bV(a):a[0]+b_((a.push(a[0]),a),ca([a[a.length-2]].concat(a,[a[1]]),b))}function bY(a,b){return a.length<4?bV(a):a[1]+b_(a.slice(1,a.length-1),ca(a,b))}function bX(a){var b=[],c=0,d=a.length,e=a[0];b.push(e[0],",",e[1]);while(++c<d)b.push("H",(e=a[c])[0],"V",e[1]);return b.join("")}function bW(a){var b=[],c=0,d=a.length,e=a[0];b.push(e[0],",",e[1]);while(++c<d)b.push("V",(e=a[c])[1],"H",e[0]);return b.join("")}function bV(a){var b=[],c=0,d=a.length,e=a[0];b.push(e[0],",",e[1]);while(++c<d)b.push("L",(e=a[c])[0],",",e[1]);return b.join("")}function bT(a){return a[1]}function bS(a){return a[0]}function bR(a,b,c,d){var e=[],f=-1,g=b.length,h=typeof c=="function",i=typeof d=="function",j;if(h&&i)while(++f<g)e.push([c.call(a,j=b[f],f),d.call(a,j,f)]);else if(h)while(++f<g)e.push([c.call(a,b[f],f),d]);else if(i)while(++f<g)e.push([c,d.call(a,b[f],f)]);else while(++f<g)e.push([c,d]);return e}function bQ(a){function g(d){return d.length<1?null:"M"+e(a(bR(this,d,b,c)),f)}var b=bS,c=bT,d="linear",e=bU[d],f=.7;g.x=function(a){if(!arguments.length)return b;b=a;return g},g.y=function(a){if(!arguments.length)return c;c=a;return g},g.interpolate=function(a){if(!arguments.length)return d;e=bU[d=a];return g},g.tension=function(a){if(!arguments.length)return f;f=a;return g};return g}function bP(a){return a.endAngle}function bO(a){return a.startAngle}function bN(a){return a.outerRadius}function bM(a){return a.innerRadius}function bJ(a,b,c){function g(){d=c.length/(b-a),e=c.length-1;return f}function f(b){return c[Math.max(0,Math.min(e,Math.floor(d*(b-a))))]}var d,e;f.domain=function(c){if(!arguments.length)return[a,b];a=+c[0],b=+c[c.length-1];return g()},f.range=function(a){if(!arguments.length)return c;c=a;return g()},f.copy=function(){return bJ(a,b,c)};return g()}function bI(a,b){function e(a){return isNaN(a=+a)?NaN:b[d3.bisect(c,a)]}function d(){var d=0,f=a.length,g=b.length;c=[];while(++d<g)c[d-1]=d3.quantile(a,d/g);return e}var c;e.domain=function(b){if(!arguments.length)return a;a=b.filter(function(a){return!isNaN(a)}).sort(d3.ascending);return d()},e.range=function(a){if(!arguments.length)return b;b=a;return d()},e.quantiles=function(){return c},e.copy=function(){return bI(a,b)};return d()}function bD(a,b,c){function f(c){return d[((a[c]||(a[c]=++b))-1)%d.length]}var d,e;f.domain=function(d){if(!arguments.length)return d3.keys(a);a={},b=0;var e=-1,g=d.length,h;while(++e<g)a[h=d[e]]||(a[h]=++b);return f[c.t](c.x,c.p)},f.range=function(a){if(!arguments.length)return d;d=a,e=0,c={t:"range",x:a};return f},f.rangePoints=function(a,g){arguments.length<2&&(g=0);var h=a[0],i=a[1],j=(i-h)/(b-1+g);d=b<2?[(h+i)/2]:d3.range(h+j*g/2,i+j/2,j),e=0,c={t:"rangePoints",x:a,p:g};return f},f.rangeBands=function(a,g){arguments.length<2&&(g=0);var h=a[0],i=a[1],j=(i-h)/(b+g);d=d3.range(h+j*g,i,j),e=j*(1-g),c={t:"rangeBands",x:a,p:g};return f},f.rangeRoundBands=function(a,g){arguments.length<2&&(g=0);var h=a[0],i=a[1],j=Math.floor((i-h)/(b+g)),k=i-h-(b-g)*j;d=d3.range(h+Math.round(k/2),i,j),e=Math.round(j*(1-g)),c={t:"rangeRoundBands",x:a,p:g};return f},f.rangeBand=function(){return e},f.copy=function(){var d={},e;for(e in a)d[e]=a[e];return bD(d,b,c)};return f[c.t](c.x,c.p)}function bC(a){return function(b){return b<0?-Math.pow(-b,a):Math.pow(b,a)}}function bB(a,b){function e(b){return a(c(b))}var c=bC(b),d=bC(1/b);e.invert=function(b){return d(a.invert(b))},e.domain=function(b){if(!arguments.length)return a.domain().map(d);a.domain(b.map(c));return e},e.ticks=function(a){return bt(e.domain(),a)},e.tickFormat=function(a){return bu(e.domain(),a)},e.nice=function(){return e.domain(bn(e.domain(),br))},e.exponent=function(a){if(!arguments.length)return b;var f=e.domain();c=bC(b=a),d=bC(1/b);return e.domain(f)},e.copy=function(){return bB(a.copy(),b)};return bq(e,a)}function bA(a){return a.toPrecision(1)}function bz(a){return-Math.log(-a)/Math.LN10}function by(a){return Math.log(a)/Math.LN10}function bx(a,b){function d(c){return a(b(c))}var c=b.pow;d.invert=function(b){return c(a.invert(b))},d.domain=function(e){if(!arguments.length)return a.domain().map(c);b=e[0]<0?bz:by,c=b.pow,a.domain(e.map(b));return d},d.nice=function(){a.domain(bn(a.domain(),bo));return d},d.ticks=function(){var d=bm(a.domain()),e=[];if(d.every(isFinite)){var f=Math.floor(d[0]),g=Math.ceil(d[1]),h=c(d[0]),i=c(d[1]);if(b===bz){e.push(c(f));for(;f++<g;)for(var j=9;j>0;j--)e.push(c(f)*j)}else{for(;f<g;f++)for(var j=1;j<10;j++)e.push(c(f)*j);e.push(c(f))}for(f=0;e[f]<h;f++);for(g=e.length;e[g-1]>i;g--);e=e.slice(f,g)}return e},d.tickFormat=function(){return bA},d.copy=function(){return bx(a.copy(),b)};return bq(d,a)}function bw(a,b,c,d){var e=[],f=[],g=0,h=a.length;while(++g<h)e.push(c(a[g-1],a[g])),f.push(d(b[g-1],b[g]));return function(b){var c=d3.bisect(a,b,1,a.length-1)-1;return f[c](e[c](b))}}function bv(a,b,c,d){var e=c(a[0],a[1]),f=d(b[0],b[1]);return function(a){return f(e(a))}}function bu(a,b){return d3.format(",."+Math.max(0,-Math.floor(Math.log(bs(a,b)[2])/Math.LN10+.01))+"f")}function bt(a,b){return d3.range.apply(d3,bs(a,b))}function bs(a,b){var c=bm(a),d=c[1]-c[0],e=Math.pow(10,Math.floor(Math.log(d/b)/Math.LN10)),f=b/d*e;f<=.15?e*=10:f<=.35?e*=5:f<=.75&&(e*=2),c[0]=Math.ceil(c[0]/e)*e,c[1]=Math.floor(c[1]/e)*e+e*.5,c[2]=e;return c}function br(a){a=Math.pow(10,Math.round(Math.log(a)/Math.LN10)-1);return{floor:function(b){return Math.floor(b/a)*a},ceil:function(b){return Math.ceil(b/a)*a}}}function bq(a,b){a.range=d3.rebind(a,b.range),a.rangeRound=d3.rebind(a,b.rangeRound),a.interpolate=d3.rebind(a,b.interpolate),a.clamp=d3.rebind(a,b.clamp);return a}function bp(a,b,c,d){function h(a){return e(a)}function g(){var g=a.length==2?bv:bw,i=d?D:C;e=g(a,b,i,c),f=g(b,a,i,d3.interpolate);return h}var e,f;h.invert=function(a){return f(a)},h.domain=function(b){if(!arguments.length)return a;a=b.map(Number);return g()},h.range=function(a){if(!arguments.length)return b;b=a;return g()},h.rangeRound=function(a){return h.range(a).interpolate(d3.interpolateRound)},h.clamp=function(a){if(!arguments.length)return d;d=a;return g()},h.interpolate=function(a){if(!arguments.length)return c;c=a;return g()},h.ticks=function(b){return bt(a,b)},h.tickFormat=function(b){return bu(a,b)},h.nice=function(){bn(a,br);return g()},h.copy=function(){return bp(a,b,c,d)};return g()}function bo(){return Math}function bn(a,b){var c=0,d=a.length-1,e=a[c],f=a[d],g;f<e&&(g=c,c=d,d=g,g=e,e=f,f=g),b=b(f-e),a[c]=b.floor(e),a[d]=b.ceil(f);return a}function bm(a){var b=a[0],c=a[a.length-1];return b<c?[b,c]:[c,b]}function bl(){}function bj(){var a=null,b=bf,c=Infinity;while(b)b.flush?b=a?a.next=b.next:bf=b.next:(c=Math.min(c,b.then+b.delay),b=(a=b).next);return c}function bi(){var a,b=Date.now(),c=bf;while(c)a=b-c.then,a>=c.delay&&(c.flush=c.callback(a)),c=c.next;var d=bj()-b;d>24?(isFinite(d)&&(clearTimeout(bh),bh=setTimeout(bi,d)),bg=0):(bg=1,bk(bi))}function be(a){for(var b=0,c=this.length;b<c;b++)for(var d=this[b],e=0,f=d.length;e<f;e++){var g=d[e];g&&a.call(g=g.node,g.__data__,e,b)}return this}function _(a){return typeof a=="function"?function(b,c,d){var e=a.call(this,b,c)+"";return d!=e&&d3.interpolate(d,e)}:(a=a+"",function(b,c,d){return d!=a&&d3.interpolate(d,a)})}function $(b,c){a(b,ba);var d={},e=d3.dispatch("start","end"),f=bd,g=Date.now();b.id=c,b.tween=function(a,c){if(arguments.length<2)return d[a];c==null?delete d[a]:d[a]=c;return b},b.ease=function(a){if(!arguments.length)return f;f=typeof a=="function"?a:d3.ease.apply(d3,arguments);return b},b.each=function(a,c){if(arguments.length<2)return be.call(b,a);e[a].add(c);return b},d3.timer(function(a){b.each(function(h,i,j){function r(){--o.count||delete l.__transition__;return 1}function q(a){if(o.active!==c)return r();var b=Math.min(1,(a-m)/n),d=f(b),g=k.length;while(g>0)k[--g].call(l,d);if(b===1){r(),bc=c,e.end.dispatch.call(l,h,i),bc=0;return 1}}function p(){if(o.active>c)return r();o.active=c;for(var a in d)(a=d[a].call(l,h,i))&&k.push(a);e.start.dispatch.call(l,h,i),d3.timer(q,0,g);return 1}var k=[],l=this,m=b[j][i].delay,n=b[j][i].duration,o=l.__transition__||(l.__transition__={active:0,count:0});++o.count,m<=a?p():d3.timer(p,m,g)});return 1},0,g);return b}function Y(a){arguments.length||(a=d3.ascending);return function(b,c){return a(b&&b.__data__,c&&c.__data__)}}function W(b){a(b,X);return b}function V(a){return{__data__:a}}function U(a){return function(){return R(a,this)}}function T(a){return function(){return Q(a,this)}}function P(b){a(b,S);return b}function O(a,b,c){function g(a){return Math.round(f(a)*255)}function f(a){a>360?a-=360:a<0&&(a+=360);return a<60?d+(e-d)*a/60:a<180?e:a<240?d+(e-d)*(240-a)/60:d}var d,e;a=a%360,a<0&&(a+=360),b=b<0?0:b>1?1:b,c=c<0?0:c>1?1:c,e=c<=.5?c*(1+b):c+b-c*b,d=2*c-e;return E(g(a+120),g(a),g(a-120))}function N(a,b,c){this.h=a,this.s=b,this.l=c}function M(a,b,c){return new N(a,b,c)}function J(a){var b=parseFloat(a);return a.charAt(a.length-1)==="%"?Math.round(b*2.55):b}function I(a,b,c){var d=Math.min(a/=255,b/=255,c/=255),e=Math.max(a,b,c),f=e-d,g,h,i=(e+d)/2;f?(h=i<.5?f/(e+d):f/(2-e-d),a==e?g=(b-c)/f+(b<c?6:0):b==e?g=(c-a)/f+2:g=(a-b)/f+4,g*=60):h=g=0;return M(g,h,i)}function H(a,b,c){var d=0,e=0,f=0,g,h,i;g=/([a-z]+)\((.*)\)/i.exec(a);if(g){h=g[2].split(",");switch(g[1]){case"hsl":return c(parseFloat(h[0]),parseFloat(h[1])/100,parseFloat(h[2])/100);case"rgb":return b(J(h[0]),J(h[1]),J(h[2]))}}if(i=K[a])return b(i.r,i.g,i.b);a!=null&&a.charAt(0)==="#"&&(a.length===4?(d=a.charAt(1),d+=d,e=a.charAt(2),e+=e,f=a.charAt(3),f+=f):a.length===7&&(d=a.substring(1,3),e=a.substring(3,5),f=a.substring(5,7)),d=parseInt(d,16),e=parseInt(e,16),f=parseInt(f,16));return b(d,e,f)}function G(a){return a<16?"0"+a.toString(16):a.toString(16)}function F(a,b,c){this.r=a,this.g=b,this.b=c}function E(a,b,c){return new F(a,b,c)}function D(a,b){b=b-(a=+a)?1/(b-a):0;return function(c){return Math.max(0,Math.min(1,(c-a)*b))}}function C(a,b){b=b-(a=+a)?1/(b-a):0;return function(c){return(c-a)*b}}function B(a){return a in A||/\bcolor\b/.test(a)?d3.interpolateRgb:d3.interpolate}function y(a){return a<1/2.75?7.5625*a*a:a<2/2.75?7.5625*(a-=1.5/2.75)*a+.75:a<2.5/2.75?7.5625*(a-=2.25/2.75)*a+.9375:7.5625*(a-=2.625/2.75)*a+.984375}function x(a){a||(a=1.70158);return function(b){return b*b*((a+1)*b-a)}}function w(a,b){var c;arguments.length<2&&(b=.45),arguments.length<1?(a=1,c=b/4):c=b/(2*Math.PI)*Math.asin(1/a);return function(d){return 1+a*Math.pow(2,10*-d)*Math.sin((d-c)*2*Math.PI/b)}}function v(a){return 1-Math.sqrt(1-a*a)}function u(a){return Math.pow(2,10*(a-1))}function t(a){return 1-Math.cos(a*Math.PI/2)}function s(a){return function(b){return Math.pow(b,a)}}function r(a){return a}function q(a){return function(b){return.5*(b<.5?a(2*b):2-a(2-2*b))}}function p(a){return function(b){return 1-a(1-b)}}function k(a){var b=a.lastIndexOf("."),c=b>=0?a.substring(b):(b=a.length,""),d=[];while(b>0)d.push(a.substring(b-=3,b+3));return d.reverse().join(",")+c}function j(a){return a+""}function g(a){var b={},c=[];b.add=function(a){for(var d=0;d<c.length;d++)if(c[d].listener==a)return b;c.push({listener:a,on:!0});return b},b.remove=function(a){for(var d=0;d<c.length;d++){var e=c[d];if(e.listener==a){e.on=!1,c=c.slice(0,d).concat(c.slice(d+1));break}}return b},b.dispatch=function(){var a=c;for(var b=0,d=a.length;b<d;b++){var e=a[b];e.on&&e.listener.apply(this,arguments)}};return b}function e(a){return a.replace(/(^\s+)|(\s+$)/g,"").replace(/\s+/g," ")}function d(a){return a==null}function c(a){return a.length}function b(){return this}d3={version:"2.0.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=[].__proto__?function(a,b){a.__proto__=b}:function(a,b){for(var c in b)a[c]=b[c]};d3.functor=function(a){return typeof a=="function"?a:function(){return a}},d3.rebind=function(a,b){return function(){var c=b.apply(a,arguments);return arguments.length?a:c}},d3.ascending=function(a,b){return a<b?-1:a>b?1:a>=b?0:NaN},d3.descending=function(a,b){return b<a?-1:b>a?1:b>=a?0:NaN},d3.min=function(a,b){var c=-1,d=a.length,e,f;if(arguments.length===1){while(++c<d&&((e=a[c])==null||e!=e))e=undefined;while(++c<d)(f=a[c])!=null&&e>f&&(e=f)}else{while(++c<d&&((e=b.call(a,a[c],c))==null||e!=e))e=undefined;while(++c<d)(f=b.call(a,a[c],c))!=null&&e>f&&(e=f)}return e},d3.max=function(a,b){var c=-1,d=a.length,e,f;if(arguments.length===1){while(++c<d&&((e=a[c])==null||e!=e))e=undefined;while(++c<d)(f=a[c])!=null&&f>e&&(e=f)}else{while(++c<d&&((e=b.call(a,a[c],c))==null||e!=e))e=undefined;while(++c<d)(f=b.call(a,a[c],c))!=null&&f>e&&(e=f)}return e},d3.sum=function(a,b){var c=0,d=a.length,e,f=-1;if(arguments.length===1)while(++f<d)isNaN(e=+a[f])||(c+=e);else while(++f<d)isNaN(e=+b.call(a,a[f],f))||(c+=e);return c},d3.quantile=function(a,b){var c=(a.length-1)*b+1,d=Math.floor(c),e=a[d-1],f=c-d;return f?e+f*(a[d]-e):e},d3.zip=function(){if(!(f=arguments.length))return[];for(var a=-1,b=d3.min(arguments,c),d=Array(b);++a<b;)for(var e=-1,f,g=d[a]=Array(f);++e<f;)g[e]=arguments[e][a];return d},d3.bisectLeft=function(a,b,c,d){arguments.length<3&&(c=0),arguments.length<4&&(d=a.length);while(c<d){var e=c+d>>1;a[e]<b?c=e+1:d=e}return c},d3.bisect=d3.bisectRight=function(a,b,c,d){arguments.length<3&&(c=0),arguments.length<4&&(d=a.length);while(c<d){var e=c+d>>1;b<a[e]?d=e:c=e+1}return c},d3.first=function(a,b){var c=0,d=a.length,e=a[0],f;arguments.length===1&&(b=d3.ascending);while(++c<d)b.call(a,e,f=a[c])>0&&(e=f);return e},d3.last=function(a,b){var c=0,d=a.length,e=a[0],f;arguments.length===1&&(b=d3.ascending);while(++c<d)b.call(a,e,f=a[c])<=0&&(e=f);return e},d3.nest=function(){function g(a,d){if(d>=b.length)return a;var e=[],f=c[d++],h;for(h in a)e.push({key:h,values:g(a[h],d)});f&&e.sort(function(a,b){return f(a.key,b.key)});return e}function f(c,g){if(g>=b.length)return e?e.call(a,c):d?c.sort(d):c;var h=-1,i=c.length,j=b[g++],k,l,m={};while(++h<i)(k=j(l=c[h]))in m?m[k].push(l):m[k]=[l];for(k in m)m[k]=f(m[k],g);return m}var a={},b=[],c=[],d,e;a.map=function(a){return f(a,0)},a.entries=function(a){return g(f(a,0),0)},a.key=function(c){b.push(c);return a},a.sortKeys=function(d){c[b.length-1]=d;return a},a.sortValues=function(b){d=b;return a},a.rollup=function(b){e=b;return a};return a},d3.keys=function(a){var b=[];for(var c in a)b.push(c);return b},d3.values=function(a){var b=[];for(var c in a)b.push(a[c]);return b},d3.entries=function(a){var b=[];for(var c in a)b.push({key:c,value:a[c]});return b},d3.permute=function(a,b){var c=[],d=-1,e=b.length;while(++d<e)c[d]=a[b[d]];return c},d3.merge=function(a){return Array.prototype.concat.apply([],a)},d3.split=function(a,b){var c=[],e=[],f,g=-1,h=a.length;arguments.length<2&&(b=d);while(++g<h)b.call(e,f=a[g],g)?e=[]:(e.length||c.push(e),e.push(f));return c},d3.range=function(a,b,c){arguments.length<3&&(c=1,arguments.length<2&&(b=a,a=0));if((b-a)/c==Infinity)throw new Error("infinite range");var d=[],e=-1,f;if(c<0)while((f=a+c*++e)>b)d.push(f);else while((f=a+c*++e)<b)d.push(f);return d},d3.requote=function(a){return a.replace(f,"\\$&")};var f=/[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g;d3.round=function(a,b){return b?Math.round(a*Math.pow(10,b))*Math.pow(10,-b):Math.round(a)},d3.xhr=function(a,b,c){var d=new XMLHttpRequest;arguments.length<3?c=b:b&&d.overrideMimeType&&d.overrideMimeType(b),d.open("GET",a,!0),d.onreadystatechange=function(){d.readyState===4&&c(d.status<300?d:null)},d.send(null)},d3.text=function(a,b,c){function d(a){c(a&&a.responseText)}arguments.length<3&&(c=b,b=null),d3.xhr(a,b,d)},d3.json=function(a,b){d3.text(a,"application/json",function(a){b(a?JSON.parse(a):null)})},d3.html=function(a,b){d3.text(a,"text/html",function(a){if(a!=null){var c=document.createRange();c.selectNode(document.body),a=c.createContextualFragment(a)}b(a)})},d3.xml=function(a,b,c){function d(a){c(a&&a.responseXML)}arguments.length<3&&(c=b,b=null),d3.xhr(a,b,d)},d3.ns={prefix:{svg:"http://www.w3.org/2000/svg",xhtml:"http://www.w3.org/1999/xhtml",xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"},qualify:function(a){var b=a.indexOf(":");return b<0?a:{space:d3.ns.prefix[a.substring(0,b)],local:a.substring(b+1)}}},d3.dispatch=function(a){var b={},c;for(var d=0,e=arguments.length;d<e;d++)c=arguments[d],b[c]=g(c);return b},d3.format=function(a){var b=h.exec(a),c=b[1]||" ",d=b[3]||"",e=b[5],f=+b[6],g=b[7],l=b[8],m=b[9],n=!1,o=!1;l&&(l=l.substring(1)),e&&(c="0",g&&(f-=Math.floor((f-1)/4)));switch(m){case"n":g=!0,m="g";break;case"%":n=!0,m="f";break;case"p":n=!0,m="r";break;case"d":o=!0,l="0"}m=i[m]||j;return function(a){var b=n?a*100:+a,h=b<0&&(b=-b)?"−":d;if(o&&b%1)return"";a=m(b,l);if(e){var i=a.length+h.length;i<f&&(a=Array(f-i+1).join(c)+a),g&&(a=k(a)),a=h+a}else{g&&(a=k(a)),a=h+a;var i=a.length;i<f&&(a=Array(f-i+1).join(c)+a)}n&&(a+="%");return a}};var h=/(?:([^{])?([<>=^]))?([+\- ])?(#)?(0)?([0-9]+)?(,)?(\.[0-9]+)?([a-zA-Z%])?/,i={g:function(a,b){return a.toPrecision(b)},e:function(a,b){return a.toExponential(b)},f:function(a,b){return a.toFixed(b)},r:function(a,b){var c=1+Math.floor(1e-15+Math.log(a)/Math.LN10);return d3.round(a,b-c).toFixed(Math.max(0,Math.min(20,b-c)))}},l=s(2),m=s(3),n={linear:function(){return r},poly:s,quad:function(){return l},cubic:function(){return m},sin:function(){return t},exp:function(){return u},circle:function(){return v},elastic:w,back:x,bounce:function(){return y}},o={"in":function(a){return a},out:p,"in-out":q,"out-in":function(a){return q(p(a))}};d3.ease=function(a){var b=a.indexOf("-"),c=b>=0?a.substring(0,b):a,d=b>=0?a.substring(b+1):"in";return o[d](n[c].apply(null,Array.prototype.slice.call(arguments,1)))},d3.event=null,d3.interpolate=function(a,b){var c=d3.interpolators.length,d;while(--c>=0&&!(d=d3.interpolators[c](a,b)));return d},d3.interpolateNumber=function(a,b){b-=a;return function(c){return a+b*c}},d3.interpolateRound=function(a,b){b-=a;return function(c){return Math.round(a+b*c)}},d3.interpolateString=function(a,b){var c,d,e,f=0,g=0,h=[],i=[],j,k;z.lastIndex=0;for(d=0;c=z.exec(b);++d)c.index&&h.push(b.substring(f,g=c.index)),i.push({i:h.length,x:c[0]}),h.push(null),f=z.lastIndex;f<b.length&&h.push(b.substring(f));for(d=0,j=i.length;(c=z.exec(a))&&d<j;++d){k=i[d];if(k.x==c[0]){if(k.i)if(h[k.i+1]==null){h[k.i-1]+=k.x,h.splice(k.i,1);for(e=d+1;e<j;++e)i[e].i--}else{h[k.i-1]+=k.x+h[k.i+1],h.splice(k.i,2);for(e=d+1;e<j;++e)i[e].i-=2}else if(h[k.i+1]==null)h[k.i]=k.x;else{h[k.i]=k.x+h[k.i+1],h.splice(k.i+1,1);for(e=d+1;e<j;++e)i[e].i--}i.splice(d,1),j--,d--}else k.x=d3.interpolateNumber(parseFloat(c[0]),parseFloat(k.x))}while(d<j)k=i.pop(),h[k.i+1]==null?h[k.i]=k.x:(h[k.i]=k.x+h[k.i+1],h.splice(k.i+1,1)),j--;return h.length===1?h[0]==null?i[0].x:function(){return b}:function(a){for(d=0;d<j;++d)h[(k=i[d]).i]=k.x(a);return h.join("")}},d3.interpolateRgb=function(a,b){a=d3.rgb(a),b=d3.rgb(b);var c=a.r,d=a.g,e=a.b,f=b.r-c,g=b.g-d,h=b.b-e;return function(a){return"rgb("+Math.round(c+f*a)+","+Math.round(d+g*a)+","+Math.round(e+h*a)+")"}},d3.interpolateHsl=function(a,b){a=d3.hsl(a),b=d3.hsl(b);var c=a.h,d=a.s,e=a.l,f=b.h-c,g=b.s-d,h=b.l-e;return function(a){return O(c+f*a,d+g*a,e+h*a).toString()}},d3.interpolateArray=function(a,b){var c=[],d=[],e=a.length,f=b.length,g=Math.min(a.length,b.length),h;for(h=0;h<g;++h)c.push(d3.interpolate(a[h],b[h]));for(;h<e;++h)d[h]=a[h];for(;h<f;++h)d[h]=b[h];return function(a){for(h=0;h<g;++h)d[h]=c[h](a);return d}},d3.interpolateObject=function(a,b){var c={},d={},e;for(e in a)e in b?c[e]=B(e)(a[e],b[e]):d[e]=a[e];for(e in b)e in a||(d[e]=b[e]);return function(a){for(e in c)d[e]=c[e](a);return d}};var z=/[-+]?(?:\d+\.\d+|\d+\.|\.\d+|\d+)(?:[eE][-]?\d+)?/g,A={background:1,fill:1,stroke:1};d3.interpolators=[d3.interpolateObject,function(a,b){return b instanceof Array&&d3.interpolateArray(a,b)},function(a,b){return typeof b=="string"&&d3.interpolateString(String(a),b)},function(a,b){return(typeof b=="string"?b in K||/^(#|rgb\(|hsl\()/.test(b):b instanceof F||b instanceof N)&&d3.interpolateRgb(String(a),b)},function(a,b){return typeof b=="number"&&d3.interpolateNumber(+a,b)}],d3.rgb=function(a,b,c){return arguments.length===1?H(""+a,E,O):E(~~a,~~b,~~c)},F.prototype.brighter=function(a){a=Math.pow(.7,arguments.length?a:1);var b=this.r,c=this.g,d=this.b,e=30;if(!b&&!c&&!d)return E(e,e,e);b&&b<e&&(b=e),c&&c<e&&(c=e),d&&d<e&&(d=e);return E(Math.min(255,Math.floor(b/a)),Math.min(255,Math.floor(c/a)),Math.min(255,Math.floor(d/a)))},F.prototype.darker=function(a){a=Math.pow(.7,arguments.length?a:1);return E(Math.max(0,Math.floor(a*this.r)),Math.max(0,Math.floor(a*this.g)),Math.max(0,Math.floor(a*this.b)))},F.prototype.hsl=function(){return I(this.r,this.g,this.b)},F.prototype.toString=function(){return"#"+G(this.r)+G(this.g)+G(this.b)};var K={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"};for(var L in K)K[L]=H(K[L],E,O);d3.hsl=function(a,b,c){return arguments.length===1?H(""+a,I,M):M(+a,+b,+c)},N.prototype.brighter=function(a){a=Math.pow(.7,arguments.length?a:1);return M(this.h,this.s,this.l/a)},N.prototype.darker=function(a){a=Math.pow(.7,arguments.length?a:1);return M(this.h,this.s,a*this.l)},N.prototype.rgb=function(){return O(this.h,this.s,this.l)},N.prototype.toString=function(){return"hsl("+this.h+","+this.s*100+"%,"+this.l*100+"%)"};var Q=function(a,b){return b.querySelector(a)},R=function(a,b){return b.querySelectorAll(a)};typeof Sizzle=="function"&&(Q=function(a,b){return Sizzle(a,b)[0]},R=function(a,b){return Sizzle.uniqueSort(Sizzle(a,b))});var S=[];d3.selection=function(){return Z},d3.selection.prototype=S,S.select=function(a){var b=[],c,d,e,f;typeof a!="function"&&(a=T(a));for(var g=-1,h=this.length;++g<h;){b.push(c=[]),c.parentNode=(e=this[g]).parentNode;for(var i=-1,j=e.length;++i<j;)(f=e[i])?(c.push(d=a.call(f,f.__data__,i)),d&&"__data__"in f&&(d.__data__=f.__data__)):c.push(null)}return P(b)},S.selectAll=function(a){var b=[],c,d;typeof a!="function"&&(a=U(a));for(var e=-1,f=this.length;++e<f;)for(var g=this[e],h=-1,i=g.length;++h<i;)if(d=g[h])b.push(c=a.call(d,d.__data__,h)),c.parentNode=d;return P(b)},S.attr=function(a,b){function i(){var c=b.apply(this,arguments);c==null?this.removeAttributeNS(a.space,a.local):this.setAttributeNS(a.space,a.local,c)}function h(){var c=b.apply(this,arguments);c==null?this.removeAttribute(a):this.setAttribute(a,c)}function g(){this.setAttributeNS(a.space,a.local,b)}function f(){this.setAttribute(a,b)}function e(){this.removeAttributeNS(a.space,a.local)}function d(){this.removeAttribute(a)}a=d3.ns.qualify(a);if(arguments.length<2){var c=this.node();return a.local?c.getAttributeNS(a.space,a.local):c.getAttribute(a)}return this.each(b==null?a.local?e:d:typeof b=="function"?a.local?i:h:a.local?g:f)},S.classed=function(a,b){function i(){(b.apply(this,arguments)?g:h).call(this)}function h(){if(b=this.classList)return b.remove(a);var b=this.className,d=b.baseVal!=null,f=d?b.baseVal:b;f=e(f.replace(c," ")),d?b.baseVal=f:this.className=f}function g(){if(b=this.classList)return b.add(a);var b=this.className,d=b.baseVal!=null,f=d?b.baseVal:b;c.lastIndex=0,c.test(f)||(f=e(f+" "+a),d?b.baseVal=f:this.className=f)}var c=new RegExp("(^|\\s+)"+d3.requote(a)+"(\\s+|$)","g");if(arguments.length<2){var d=this.node();if(f=d.classList)return f.contains(a);var f=d.className;c.lastIndex=0;return c.test(f.baseVal!=null?f.baseVal:f)}return this.each(typeof b=="function"?i:b?g:h)},S.style=function(a,b,c){function f <add>(function(){function dl(a,b,c){function i(a,b){var c=a.__domain||(a.__domain=a.domain()),d=a.range().map(function(a){return(a-b)/h});a.domain(c).domain(d.map(a.invert))}var d=Math.pow(2,(c$[2]=a)-c[2]),e=c$[0]=b[0]-d*c[0],f=c$[1]=b[1]-d*c[1],g=d3.event,h=Math.pow(2,a);d3.event={scale:h,translate:[e,f],transform:function(a,b){a&&i(a,e),b&&i(b,f)}};try{c_.apply(da,db)}finally{d3.event=g}g.preventDefault()}function dk(){dd&&(d3.event.stopPropagation(),d3.event.preventDefault(),dd=!1)}function dj(){cW&&(dc&&(dd=!0),di(),cW=null)}function di(){cX=null,cW&&(dc=!0,dl(c$[2],d3.svg.mouse(da),cW))}function dh(){var a=d3.svg.touches(da);switch(a.length){case 1:var b=a[0];dl(c$[2],b,cY[b.identifier]);break;case 2:var c=a[0],d=a[1],e=[(c[0]+d[0])/2,(c[1]+d[1])/2],f=cY[c.identifier],g=cY[d.identifier],h=[(f[0]+g[0])/2,(f[1]+g[1])/2,f[2]];dl(Math.log(d3.event.scale)/Math.LN2+f[2],e,h)}}function dg(){var a=d3.svg.touches(da),b=-1,c=a.length,d;while(++b<c)cY[(d=a[b]).identifier]=de(d);return a}function df(){cV||(cV=d3.select("body").append("div").style("visibility","hidden").style("top",0).style("height",0).style("width",0).style("overflow-y","scroll").append("div").style("height","2000px").node().parentNode);var a=d3.event,b;try{cV.scrollTop=1e3,cV.dispatchEvent(a),b=1e3-cV.scrollTop}catch(c){b=a.wheelDelta||-a.detail*5}return b*.005}function de(a){return[a[0]-c$[0],a[1]-c$[1],c$[2]]}function cU(){d3.event.stopPropagation(),d3.event.preventDefault()}function cT(){cO&&(cU(),cO=!1)}function cS(){!cK||(cP("dragend"),cK=null,cN&&(cO=!0,cU()))}function cR(){if(!!cK){var a=cK.parentNode;if(!a)return cS();cP("drag"),cU()}}function cQ(a){return d3.event.touches?d3.svg.touches(a)[0]:d3.svg.mouse(a)}function cP(a){var b=d3.event,c=cK.parentNode,d=0,e=0;c&&(c=cQ(c),d=c[0]-cM[0],e=c[1]-cM[1],cM=c,cN|=d|e);try{d3.event={dx:d,dy:e},cJ[a].dispatch.apply(cK,cL)}finally{d3.event=b}b.preventDefault()}function cI(a,b,c){e=[];if(c&&b.length>1){var d=bm(a.domain()),e,f=-1,g=b.length,h=(b[1]-b[0])/++c,i,j;while(++f<g)for(i=c;--i>0;)(j=+b[f]-i*h)>=d[0]&&e.push(j);for(--f,i=0;++i<c&&(j=+b[f]+i*h)<d[1];)e.push(j)}return e}function cH(a,b){a.attr("transform",function(a){return"translate(0,"+b(a)+")"})}function cG(a,b){a.attr("transform",function(a){return"translate("+b(a)+",0)"})}function cC(){return"circle"}function cB(){return 64}function cA(a,b){var c=(a.ownerSVGElement||a).createSVGPoint();if(cz<0&&(window.scrollX||window.scrollY)){var d=d3.select(document.body).append("svg:svg").style("position","absolute").style("top",0).style("left",0),e=d[0][0].getScreenCTM();cz=!e.f&&!e.e,d.remove()}cz?(c.x=b.pageX,c.y=b.pageY):(c.x=b.clientX,c.y=b.clientY),c=c.matrixTransform(a.getScreenCTM().inverse());return[c.x,c.y]}function cy(a){return function(){var b=a.apply(this,arguments),c=b[0],d=b[1]+bK;return[c*Math.cos(d),c*Math.sin(d)]}}function cx(a){return[a.x,a.y]}function cw(a){return a.endAngle}function cv(a){return a.startAngle}function cu(a){return a.radius}function ct(a){return a.target}function cs(a){return a.source}function cr(a){return function(b,c){return a[c][1]}}function cq(a){return function(b,c){return a[c][0]}}function cp(a){function i(f){if(f.length<1)return null;var i=bR(this,f,b,d),j=bR(this,f,b===c?cq(i):c,d===e?cr(i):e);return"M"+g(a(j),h)+"L"+g(a(i.reverse()),h)+"Z"}var b=bS,c=bS,d=0,e=bT,f="linear",g=bU[f],h=.7;i.x=function(a){if(!arguments.length)return c;b=c=a;return i},i.x0=function(a){if(!arguments.length)return b;b=a;return i},i.x1=function(a){if(!arguments.length)return c;c=a;return i},i.y=function(a){if(!arguments.length)return e;d=e=a;return i},i.y0=function(a){if(!arguments.length)return d;d=a;return i},i.y1=function(a){if(!arguments.length)return e;e=a;return i},i.interpolate=function(a){if(!arguments.length)return f;g=bU[f=a];return i},i.tension=function(a){if(!arguments.length)return h;h=a;return i};return i}function co(a){var b,c=-1,d=a.length,e,f;while(++c<d)b=a[c],e=b[0],f=b[1]+bK,b[0]=e*Math.cos(f),b[1]=e*Math.sin(f);return a}function cn(a){return a.length<3?bV(a):a[0]+b_(a,cm(a))}function cm(a){var b=[],c,d,e,f,g=cl(a),h=-1,i=a.length-1;while(++h<i)c=ck(a[h],a[h+1]),Math.abs(c)<1e-6?g[h]=g[h+1]=0:(d=g[h]/c,e=g[h+1]/c,f=d*d+e*e,f>9&&(f=c*3/Math.sqrt(f),g[h]=f*d,g[h+1]=f*e));h=-1;while(++h<=i)f=(a[Math.min(i,h+1)][0]-a[Math.max(0,h-1)][0])/(6*(1+g[h]*g[h])),b.push([f||0,g[h]*f||0]);return b}function cl(a){var b=0,c=a.length-1,d=[],e=a[0],f=a[1],g=d[0]=ck(e,f);while(++b<c)d[b]=g+(g=ck(e=f,f=a[b+1]));d[b]=g;return d}function ck(a,b){return(b[1]-a[1])/(b[0]-a[0])}function cj(a,b,c){a.push("C",cf(cg,b),",",cf(cg,c),",",cf(ch,b),",",cf(ch,c),",",cf(ci,b),",",cf(ci,c))}function cf(a,b){return a[0]*b[0]+a[1]*b[1]+a[2]*b[2]+a[3]*b[3]}function ce(a,b){var c=a.length-1,d=a[0][0],e=a[0][1],f=a[c][0]-d,g=a[c][1]-e,h=-1,i,j;while(++h<=c)i=a[h],j=h/c,i[0]=b*i[0]+(1-b)*(d+j*f),i[1]=b*i[1]+(1-b)*(e+j*g);return cb(a)}function cd(a){var b,c=-1,d=a.length,e=d+4,f,g=[],h=[];while(++c<4)f=a[c%d],g.push(f[0]),h.push(f[1]);b=[cf(ci,g),",",cf(ci,h)],--c;while(++c<e)f=a[c%d],g.shift(),g.push(f[0]),h.shift(),h.push(f[1]),cj(b,g,h);return b.join("")}function cc(a){if(a.length<4)return bV(a);var b=[],c=-1,d=a.length,e,f=[0],g=[0];while(++c<3)e=a[c],f.push(e[0]),g.push(e[1]);b.push(cf(ci,f)+","+cf(ci,g)),--c;while(++c<d)e=a[c],f.shift(),f.push(e[0]),g.shift(),g.push(e[1]),cj(b,f,g);return b.join("")}function cb(a){if(a.length<3)return bV(a);var b=[],c=1,d=a.length,e=a[0],f=e[0],g=e[1],h=[f,f,f,(e=a[1])[0]],i=[g,g,g,e[1]];b.push(f,",",g),cj(b,h,i);while(++c<d)e=a[c],h.shift(),h.push(e[0]),i.shift(),i.push(e[1]),cj(b,h,i);c=-1;while(++c<2)h.shift(),h.push(e[0]),i.shift(),i.push(e[1]),cj(b,h,i);return b.join("")}function ca(a,b){var c=[],d=(1-b)/2,e,f=a[0],g=a[1],h=1,i=a.length;while(++h<i)e=f,f=g,g=a[h],c.push([d*(g[0]-e[0]),d*(g[1]-e[1])]);return c}function b_(a,b){if(b.length<1||a.length!=b.length&&a.length!=b.length+2)return bV(a);var c=a.length!=b.length,d="",e=a[0],f=a[1],g=b[0],h=g,i=1;c&&(d+="Q"+(f[0]-g[0]*2/3)+","+(f[1]-g[1]*2/3)+","+f[0]+","+f[1],e=a[1],i=2);if(b.length>1){h=b[1],f=a[i],i++,d+="C"+(e[0]+g[0])+","+(e[1]+g[1])+","+(f[0]-h[0])+","+(f[1]-h[1])+","+f[0]+","+f[1];for(var j=2;j<b.length;j++,i++)f=a[i],h=b[j],d+="S"+(f[0]-h[0])+","+(f[1]-h[1])+","+f[0]+","+f[1]}if(c){var k=a[i];d+="Q"+(f[0]+h[0]*2/3)+","+(f[1]+h[1]*2/3)+","+k[0]+","+k[1]}return d}function b$(a,b,c){return a.length<3?bV(a):a[0]+b_(a,ca(a,b))}function bZ(a,b){return a.length<3?bV(a):a[0]+b_((a.push(a[0]),a),ca([a[a.length-2]].concat(a,[a[1]]),b))}function bY(a,b){return a.length<4?bV(a):a[1]+b_(a.slice(1,a.length-1),ca(a,b))}function bX(a){var b=[],c=0,d=a.length,e=a[0];b.push(e[0],",",e[1]);while(++c<d)b.push("H",(e=a[c])[0],"V",e[1]);return b.join("")}function bW(a){var b=[],c=0,d=a.length,e=a[0];b.push(e[0],",",e[1]);while(++c<d)b.push("V",(e=a[c])[1],"H",e[0]);return b.join("")}function bV(a){var b=[],c=0,d=a.length,e=a[0];b.push(e[0],",",e[1]);while(++c<d)b.push("L",(e=a[c])[0],",",e[1]);return b.join("")}function bT(a){return a[1]}function bS(a){return a[0]}function bR(a,b,c,d){var e=[],f=-1,g=b.length,h=typeof c=="function",i=typeof d=="function",j;if(h&&i)while(++f<g)e.push([c.call(a,j=b[f],f),d.call(a,j,f)]);else if(h)while(++f<g)e.push([c.call(a,b[f],f),d]);else if(i)while(++f<g)e.push([c,d.call(a,b[f],f)]);else while(++f<g)e.push([c,d]);return e}function bQ(a){function g(d){return d.length<1?null:"M"+e(a(bR(this,d,b,c)),f)}var b=bS,c=bT,d="linear",e=bU[d],f=.7;g.x=function(a){if(!arguments.length)return b;b=a;return g},g.y=function(a){if(!arguments.length)return c;c=a;return g},g.interpolate=function(a){if(!arguments.length)return d;e=bU[d=a];return g},g.tension=function(a){if(!arguments.length)return f;f=a;return g};return g}function bP(a){return a.endAngle}function bO(a){return a.startAngle}function bN(a){return a.outerRadius}function bM(a){return a.innerRadius}function bJ(a,b,c){function g(){d=c.length/(b-a),e=c.length-1;return f}function f(b){return c[Math.max(0,Math.min(e,Math.floor(d*(b-a))))]}var d,e;f.domain=function(c){if(!arguments.length)return[a,b];a=+c[0],b=+c[c.length-1];return g()},f.range=function(a){if(!arguments.length)return c;c=a;return g()},f.copy=function(){return bJ(a,b,c)};return g()}function bI(a,b){function e(a){return isNaN(a=+a)?NaN:b[d3.bisect(c,a)]}function d(){var d=0,f=a.length,g=b.length;c=[];while(++d<g)c[d-1]=d3.quantile(a,d/g);return e}var c;e.domain=function(b){if(!arguments.length)return a;a=b.filter(function(a){return!isNaN(a)}).sort(d3.ascending);return d()},e.range=function(a){if(!arguments.length)return b;b=a;return d()},e.quantiles=function(){return c},e.copy=function(){return bI(a,b)};return d()}function bD(a,b,c){function f(c){return d[((a[c]||(a[c]=++b))-1)%d.length]}var d,e;f.domain=function(d){if(!arguments.length)return d3.keys(a);a={},b=0;var e=-1,g=d.length,h;while(++e<g)a[h=d[e]]||(a[h]=++b);return f[c.t](c.x,c.p)},f.range=function(a){if(!arguments.length)return d;d=a,e=0,c={t:"range",x:a};return f},f.rangePoints=function(a,g){arguments.length<2&&(g=0);var h=a[0],i=a[1],j=(i-h)/(b-1+g);d=b<2?[(h+i)/2]:d3.range(h+j*g/2,i+j/2,j),e=0,c={t:"rangePoints",x:a,p:g};return f},f.rangeBands=function(a,g){arguments.length<2&&(g=0);var h=a[0],i=a[1],j=(i-h)/(b+g);d=d3.range(h+j*g,i,j),e=j*(1-g),c={t:"rangeBands",x:a,p:g};return f},f.rangeRoundBands=function(a,g){arguments.length<2&&(g=0);var h=a[0],i=a[1],j=Math.floor((i-h)/(b+g)),k=i-h-(b-g)*j;d=d3.range(h+Math.round(k/2),i,j),e=Math.round(j*(1-g)),c={t:"rangeRoundBands",x:a,p:g};return f},f.rangeBand=function(){return e},f.copy=function(){var d={},e;for(e in a)d[e]=a[e];return bD(d,b,c)};return f[c.t](c.x,c.p)}function bC(a){return function(b){return b<0?-Math.pow(-b,a):Math.pow(b,a)}}function bB(a,b){function e(b){return a(c(b))}var c=bC(b),d=bC(1/b);e.invert=function(b){return d(a.invert(b))},e.domain=function(b){if(!arguments.length)return a.domain().map(d);a.domain(b.map(c));return e},e.ticks=function(a){return bt(e.domain(),a)},e.tickFormat=function(a){return bu(e.domain(),a)},e.nice=function(){return e.domain(bn(e.domain(),br))},e.exponent=function(a){if(!arguments.length)return b;var f=e.domain();c=bC(b=a),d=bC(1/b);return e.domain(f)},e.copy=function(){return bB(a.copy(),b)};return bq(e,a)}function bA(a){return a.toPrecision(1)}function bz(a){return-Math.log(-a)/Math.LN10}function by(a){return Math.log(a)/Math.LN10}function bx(a,b){function d(c){return a(b(c))}var c=b.pow;d.invert=function(b){return c(a.invert(b))},d.domain=function(e){if(!arguments.length)return a.domain().map(c);b=e[0]<0?bz:by,c=b.pow,a.domain(e.map(b));return d},d.nice=function(){a.domain(bn(a.domain(),bo));return d},d.ticks=function(){var d=bm(a.domain()),e=[];if(d.every(isFinite)){var f=Math.floor(d[0]),g=Math.ceil(d[1]),h=c(d[0]),i=c(d[1]);if(b===bz){e.push(c(f));for(;f++<g;)for(var j=9;j>0;j--)e.push(c(f)*j)}else{for(;f<g;f++)for(var j=1;j<10;j++)e.push(c(f)*j);e.push(c(f))}for(f=0;e[f]<h;f++);for(g=e.length;e[g-1]>i;g--);e=e.slice(f,g)}return e},d.tickFormat=function(){return bA},d.copy=function(){return bx(a.copy(),b)};return bq(d,a)}function bw(a,b,c,d){var e=[],f=[],g=0,h=a.length;while(++g<h)e.push(c(a[g-1],a[g])),f.push(d(b[g-1],b[g]));return function(b){var c=d3.bisect(a,b,1,a.length-1)-1;return f[c](e[c](b))}}function bv(a,b,c,d){var e=c(a[0],a[1]),f=d(b[0],b[1]);return function(a){return f(e(a))}}function bu(a,b){return d3.format(",."+Math.max(0,-Math.floor(Math.log(bs(a,b)[2])/Math.LN10+.01))+"f")}function bt(a,b){return d3.range.apply(d3,bs(a,b))}function bs(a,b){var c=bm(a),d=c[1]-c[0],e=Math.pow(10,Math.floor(Math.log(d/b)/Math.LN10)),f=b/d*e;f<=.15?e*=10:f<=.35?e*=5:f<=.75&&(e*=2),c[0]=Math.ceil(c[0]/e)*e,c[1]=Math.floor(c[1]/e)*e+e*.5,c[2]=e;return c}function br(a){a=Math.pow(10,Math.round(Math.log(a)/Math.LN10)-1);return{floor:function(b){return Math.floor(b/a)*a},ceil:function(b){return Math.ceil(b/a)*a}}}function bq(a,b){a.range=d3.rebind(a,b.range),a.rangeRound=d3.rebind(a,b.rangeRound),a.interpolate=d3.rebind(a,b.interpolate),a.clamp=d3.rebind(a,b.clamp);return a}function bp(a,b,c,d){function h(a){return e(a)}function g(){var g=a.length==2?bv:bw,i=d?D:C;e=g(a,b,i,c),f=g(b,a,i,d3.interpolate);return h}var e,f;h.invert=function(a){return f(a)},h.domain=function(b){if(!arguments.length)return a;a=b.map(Number);return g()},h.range=function(a){if(!arguments.length)return b;b=a;return g()},h.rangeRound=function(a){return h.range(a).interpolate(d3.interpolateRound)},h.clamp=function(a){if(!arguments.length)return d;d=a;return g()},h.interpolate=function(a){if(!arguments.length)return c;c=a;return g()},h.ticks=function(b){return bt(a,b)},h.tickFormat=function(b){return bu(a,b)},h.nice=function(){bn(a,br);return g()},h.copy=function(){return bp(a,b,c,d)};return g()}function bo(){return Math}function bn(a,b){var c=0,d=a.length-1,e=a[c],f=a[d],g;f<e&&(g=c,c=d,d=g,g=e,e=f,f=g),b=b(f-e),a[c]=b.floor(e),a[d]=b.ceil(f);return a}function bm(a){var b=a[0],c=a[a.length-1];return b<c?[b,c]:[c,b]}function bl(){}function bj(){var a=null,b=bf,c=Infinity;while(b)b.flush?b=a?a.next=b.next:bf=b.next:(c=Math.min(c,b.then+b.delay),b=(a=b).next);return c}function bi(){var a,b=Date.now(),c=bf;while(c)a=b-c.then,a>=c.delay&&(c.flush=c.callback(a)),c=c.next;var d=bj()-b;d>24?(isFinite(d)&&(clearTimeout(bh),bh=setTimeout(bi,d)),bg=0):(bg=1,bk(bi))}function be(a){for(var b=0,c=this.length;b<c;b++)for(var d=this[b],e=0,f=d.length;e<f;e++){var g=d[e];g&&a.call(g=g.node,g.__data__,e,b)}return this}function _(a){return typeof a=="function"?function(b,c,d){var e=a.call(this,b,c)+"";return d!=e&&d3.interpolate(d,e)}:(a=a+"",function(b,c,d){return d!=a&&d3.interpolate(d,a)})}function $(b,c){a(b,ba);var d={},e=d3.dispatch("start","end"),f=bd,g=Date.now();b.id=c,b.tween=function(a,c){if(arguments.length<2)return d[a];c==null?delete d[a]:d[a]=c;return b},b.ease=function(a){if(!arguments.length)return f;f=typeof a=="function"?a:d3.ease.apply(d3,arguments);return b},b.each=function(a,c){if(arguments.length<2)return be.call(b,a);e[a].add(c);return b},d3.timer(function(a){b.each(function(h,i,j){function r(){--o.count||delete l.__transition__;return 1}function q(a){if(o.active!==c)return r();var b=Math.min(1,(a-m)/n),d=f(b),g=k.length;while(g>0)k[--g].call(l,d);if(b===1){r(),bc=c,e.end.dispatch.call(l,h,i),bc=0;return 1}}function p(a){if(o.active>c)return r();o.active=c;for(var b in d)(b=d[b].call(l,h,i))&&k.push(b);e.start.dispatch.call(l,h,i),q(a)||d3.timer(q,0,g);return 1}var k=[],l=this,m=b[j][i].delay,n=b[j][i].duration,o=l.__transition__||(l.__transition__={active:0,count:0});++o.count,m<=a?p():d3.timer(p,m,g)});return 1},0,g);return b}function Y(a){arguments.length||(a=d3.ascending);return function(b,c){return a(b&&b.__data__,c&&c.__data__)}}function W(b){a(b,X);return b}function V(a){return{__data__:a}}function U(a){return function(){return R(a,this)}}function T(a){return function(){return Q(a,this)}}function P(b){a(b,S);return b}function O(a,b,c){function g(a){return Math.round(f(a)*255)}function f(a){a>360?a-=360:a<0&&(a+=360);return a<60?d+(e-d)*a/60:a<180?e:a<240?d+(e-d)*(240-a)/60:d}var d,e;a=a%360,a<0&&(a+=360),b=b<0?0:b>1?1:b,c=c<0?0:c>1?1:c,e=c<=.5?c*(1+b):c+b-c*b,d=2*c-e;return E(g(a+120),g(a),g(a-120))}function N(a,b,c){this.h=a,this.s=b,this.l=c}function M(a,b,c){return new N(a,b,c)}function J(a){var b=parseFloat(a);return a.charAt(a.length-1)==="%"?Math.round(b*2.55):b}function I(a,b,c){var d=Math.min(a/=255,b/=255,c/=255),e=Math.max(a,b,c),f=e-d,g,h,i=(e+d)/2;f?(h=i<.5?f/(e+d):f/(2-e-d),a==e?g=(b-c)/f+(b<c?6:0):b==e?g=(c-a)/f+2:g=(a-b)/f+4,g*=60):h=g=0;return M(g,h,i)}function H(a,b,c){var d=0,e=0,f=0,g,h,i;g=/([a-z]+)\((.*)\)/i.exec(a);if(g){h=g[2].split(",");switch(g[1]){case"hsl":return c(parseFloat(h[0]),parseFloat(h[1])/100,parseFloat(h[2])/100);case"rgb":return b(J(h[0]),J(h[1]),J(h[2]))}}if(i=K[a])return b(i.r,i.g,i.b);a!=null&&a.charAt(0)==="#"&&(a.length===4?(d=a.charAt(1),d+=d,e=a.charAt(2),e+=e,f=a.charAt(3),f+=f):a.length===7&&(d=a.substring(1,3),e=a.substring(3,5),f=a.substring(5,7)),d=parseInt(d,16),e=parseInt(e,16),f=parseInt(f,16));return b(d,e,f)}function G(a){return a<16?"0"+a.toString(16):a.toString(16)}function F(a,b,c){this.r=a,this.g=b,this.b=c}function E(a,b,c){return new F(a,b,c)}function D(a,b){b=b-(a=+a)?1/(b-a):0;return function(c){return Math.max(0,Math.min(1,(c-a)*b))}}function C(a,b){b=b-(a=+a)?1/(b-a):0;return function(c){return(c-a)*b}}function B(a){return a in A||/\bcolor\b/.test(a)?d3.interpolateRgb:d3.interpolate}function y(a){return a<1/2.75?7.5625*a*a:a<2/2.75?7.5625*(a-=1.5/2.75)*a+.75:a<2.5/2.75?7.5625*(a-=2.25/2.75)*a+.9375:7.5625*(a-=2.625/2.75)*a+.984375}function x(a){a||(a=1.70158);return function(b){return b*b*((a+1)*b-a)}}function w(a,b){var c;arguments.length<2&&(b=.45),arguments.length<1?(a=1,c=b/4):c=b/(2*Math.PI)*Math.asin(1/a);return function(d){return 1+a*Math.pow(2,10*-d)*Math.sin((d-c)*2*Math.PI/b)}}function v(a){return 1-Math.sqrt(1-a*a)}function u(a){return Math.pow(2,10*(a-1))}function t(a){return 1-Math.cos(a*Math.PI/2)}function s(a){return function(b){return Math.pow(b,a)}}function r(a){return a}function q(a){return function(b){return.5*(b<.5?a(2*b):2-a(2-2*b))}}function p(a){return function(b){return 1-a(1-b)}}function k(a){var b=a.lastIndexOf("."),c=b>=0?a.substring(b):(b=a.length,""),d=[];while(b>0)d.push(a.substring(b-=3,b+3));return d.reverse().join(",")+c}function j(a){return a+""}function g(a){var b={},c=[];b.add=function(a){for(var d=0;d<c.length;d++)if(c[d].listener==a)return b;c.push({listener:a,on:!0});return b},b.remove=function(a){for(var d=0;d<c.length;d++){var e=c[d];if(e.listener==a){e.on=!1,c=c.slice(0,d).concat(c.slice(d+1));break}}return b},b.dispatch=function(){var a=c;for(var b=0,d=a.length;b<d;b++){var e=a[b];e.on&&e.listener.apply(this,arguments)}};return b}function e(a){return a.replace(/(^\s+)|(\s+$)/g,"").replace(/\s+/g," ")}function d(a){return a==null}function c(a){return a.length}function b(){return this}d3={version:"2.0.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=[].__proto__?function(a,b){a.__proto__=b}:function(a,b){for(var c in b)a[c]=b[c]};d3.functor=function(a){return typeof a=="function"?a:function(){return a}},d3.rebind=function(a,b){return function(){var c=b.apply(a,arguments);return arguments.length?a:c}},d3.ascending=function(a,b){return a<b?-1:a>b?1:a>=b?0:NaN},d3.descending=function(a,b){return b<a?-1:b>a?1:b>=a?0:NaN},d3.min=function(a,b){var c=-1,d=a.length,e,f;if(arguments.length===1){while(++c<d&&((e=a[c])==null||e!=e))e=undefined;while(++c<d)(f=a[c])!=null&&e>f&&(e=f)}else{while(++c<d&&((e=b.call(a,a[c],c))==null||e!=e))e=undefined;while(++c<d)(f=b.call(a,a[c],c))!=null&&e>f&&(e=f)}return e},d3.max=function(a,b){var c=-1,d=a.length,e,f;if(arguments.length===1){while(++c<d&&((e=a[c])==null||e!=e))e=undefined;while(++c<d)(f=a[c])!=null&&f>e&&(e=f)}else{while(++c<d&&((e=b.call(a,a[c],c))==null||e!=e))e=undefined;while(++c<d)(f=b.call(a,a[c],c))!=null&&f>e&&(e=f)}return e},d3.sum=function(a,b){var c=0,d=a.length,e,f=-1;if(arguments.length===1)while(++f<d)isNaN(e=+a[f])||(c+=e);else while(++f<d)isNaN(e=+b.call(a,a[f],f))||(c+=e);return c},d3.quantile=function(a,b){var c=(a.length-1)*b+1,d=Math.floor(c),e=a[d-1],f=c-d;return f?e+f*(a[d]-e):e},d3.zip=function(){if(!(f=arguments.length))return[];for(var a=-1,b=d3.min(arguments,c),d=Array(b);++a<b;)for(var e=-1,f,g=d[a]=Array(f);++e<f;)g[e]=arguments[e][a];return d},d3.bisectLeft=function(a,b,c,d){arguments.length<3&&(c=0),arguments.length<4&&(d=a.length);while(c<d){var e=c+d>>1;a[e]<b?c=e+1:d=e}return c},d3.bisect=d3.bisectRight=function(a,b,c,d){arguments.length<3&&(c=0),arguments.length<4&&(d=a.length);while(c<d){var e=c+d>>1;b<a[e]?d=e:c=e+1}return c},d3.first=function(a,b){var c=0,d=a.length,e=a[0],f;arguments.length===1&&(b=d3.ascending);while(++c<d)b.call(a,e,f=a[c])>0&&(e=f);return e},d3.last=function(a,b){var c=0,d=a.length,e=a[0],f;arguments.length===1&&(b=d3.ascending);while(++c<d)b.call(a,e,f=a[c])<=0&&(e=f);return e},d3.nest=function(){function g(a,d){if(d>=b.length)return a;var e=[],f=c[d++],h;for(h in a)e.push({key:h,values:g(a[h],d)});f&&e.sort(function(a,b){return f(a.key,b.key)});return e}function f(c,g){if(g>=b.length)return e?e.call(a,c):d?c.sort(d):c;var h=-1,i=c.length,j=b[g++],k,l,m={};while(++h<i)(k=j(l=c[h]))in m?m[k].push(l):m[k]=[l];for(k in m)m[k]=f(m[k],g);return m}var a={},b=[],c=[],d,e;a.map=function(a){return f(a,0)},a.entries=function(a){return g(f(a,0),0)},a.key=function(c){b.push(c);return a},a.sortKeys=function(d){c[b.length-1]=d;return a},a.sortValues=function(b){d=b;return a},a.rollup=function(b){e=b;return a};return a},d3.keys=function(a){var b=[];for(var c in a)b.push(c);return b},d3.values=function(a){var b=[];for(var c in a)b.push(a[c]);return b},d3.entries=function(a){var b=[];for(var c in a)b.push({key:c,value:a[c]});return b},d3.permute=function(a,b){var c=[],d=-1,e=b.length;while(++d<e)c[d]=a[b[d]];return c},d3.merge=function(a){return Array.prototype.concat.apply([],a)},d3.split=function(a,b){var c=[],e=[],f,g=-1,h=a.length;arguments.length<2&&(b=d);while(++g<h)b.call(e,f=a[g],g)?e=[]:(e.length||c.push(e),e.push(f));return c},d3.range=function(a,b,c){arguments.length<3&&(c=1,arguments.length<2&&(b=a,a=0));if((b-a)/c==Infinity)throw new Error("infinite range");var d=[],e=-1,f;if(c<0)while((f=a+c*++e)>b)d.push(f);else while((f=a+c*++e)<b)d.push(f);return d},d3.requote=function(a){return a.replace(f,"\\$&")};var f=/[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g;d3.round=function(a,b){return b?Math.round(a*Math.pow(10,b))*Math.pow(10,-b):Math.round(a)},d3.xhr=function(a,b,c){var d=new XMLHttpRequest;arguments.length<3?c=b:b&&d.overrideMimeType&&d.overrideMimeType(b),d.open("GET",a,!0),d.onreadystatechange=function(){d.readyState===4&&c(d.status<300?d:null)},d.send(null)},d3.text=function(a,b,c){function d(a){c(a&&a.responseText)}arguments.length<3&&(c=b,b=null),d3.xhr(a,b,d)},d3.json=function(a,b){d3.text(a,"application/json",function(a){b(a?JSON.parse(a):null)})},d3.html=function(a,b){d3.text(a,"text/html",function(a){if(a!=null){var c=document.createRange();c.selectNode(document.body),a=c.createContextualFragment(a)}b(a)})},d3.xml=function(a,b,c){function d(a){c(a&&a.responseXML)}arguments.length<3&&(c=b,b=null),d3.xhr(a,b,d)},d3.ns={prefix:{svg:"http://www.w3.org/2000/svg",xhtml:"http://www.w3.org/1999/xhtml",xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"},qualify:function(a){var b=a.indexOf(":");return b<0?a:{space:d3.ns.prefix[a.substring(0,b)],local:a.substring(b+1)}}},d3.dispatch=function(a){var b={},c;for(var d=0,e=arguments.length;d<e;d++)c=arguments[d],b[c]=g(c);return b},d3.format=function(a){var b=h.exec(a),c=b[1]||" ",d=b[3]||"",e=b[5],f=+b[6],g=b[7],l=b[8],m=b[9],n=!1,o=!1;l&&(l=l.substring(1)),e&&(c="0",g&&(f-=Math.floor((f-1)/4)));switch(m){case"n":g=!0,m="g";break;case"%":n=!0,m="f";break;case"p":n=!0,m="r";break;case"d":o=!0,l="0"}m=i[m]||j;return function(a){var b=n?a*100:+a,h=b<0&&(b=-b)?"−":d;if(o&&b%1)return"";a=m(b,l);if(e){var i=a.length+h.length;i<f&&(a=Array(f-i+1).join(c)+a),g&&(a=k(a)),a=h+a}else{g&&(a=k(a)),a=h+a;var i=a.length;i<f&&(a=Array(f-i+1).join(c)+a)}n&&(a+="%");return a}};var h=/(?:([^{])?([<>=^]))?([+\- ])?(#)?(0)?([0-9]+)?(,)?(\.[0-9]+)?([a-zA-Z%])?/,i={g:function(a,b){return a.toPrecision(b)},e:function(a,b){return a.toExponential(b)},f:function(a,b){return a.toFixed(b)},r:function(a,b){var c=1+Math.floor(1e-15+Math.log(a)/Math.LN10);return d3.round(a,b-c).toFixed(Math.max(0,Math.min(20,b-c)))}},l=s(2),m=s(3),n={linear:function(){return r},poly:s,quad:function(){return l},cubic:function(){return m},sin:function(){return t},exp:function(){return u},circle:function(){return v},elastic:w,back:x,bounce:function(){return y}},o={"in":function(a){return a},out:p,"in-out":q,"out-in":function(a){return q(p(a))}};d3.ease=function(a){var b=a.indexOf("-"),c=b>=0?a.substring(0,b):a,d=b>=0?a.substring(b+1):"in";return o[d](n[c].apply(null,Array.prototype.slice.call(arguments,1)))},d3.event=null,d3.interpolate=function(a,b){var c=d3.interpolators.length,d;while(--c>=0&&!(d=d3.interpolators[c](a,b)));return d},d3.interpolateNumber=function(a,b){b-=a;return function(c){return a+b*c}},d3.interpolateRound=function(a,b){b-=a;return function(c){return Math.round(a+b*c)}},d3.interpolateString=function(a,b){var c,d,e,f=0,g=0,h=[],i=[],j,k;z.lastIndex=0;for(d=0;c=z.exec(b);++d)c.index&&h.push(b.substring(f,g=c.index)),i.push({i:h.length,x:c[0]}),h.push(null),f=z.lastIndex;f<b.length&&h.push(b.substring(f));for(d=0,j=i.length;(c=z.exec(a))&&d<j;++d){k=i[d];if(k.x==c[0]){if(k.i)if(h[k.i+1]==null){h[k.i-1]+=k.x,h.splice(k.i,1);for(e=d+1;e<j;++e)i[e].i--}else{h[k.i-1]+=k.x+h[k.i+1],h.splice(k.i,2);for(e=d+1;e<j;++e)i[e].i-=2}else if(h[k.i+1]==null)h[k.i]=k.x;else{h[k.i]=k.x+h[k.i+1],h.splice(k.i+1,1);for(e=d+1;e<j;++e)i[e].i--}i.splice(d,1),j--,d--}else k.x=d3.interpolateNumber(parseFloat(c[0]),parseFloat(k.x))}while(d<j)k=i.pop(),h[k.i+1]==null?h[k.i]=k.x:(h[k.i]=k.x+h[k.i+1],h.splice(k.i+1,1)),j--;return h.length===1?h[0]==null?i[0].x:function(){return b}:function(a){for(d=0;d<j;++d)h[(k=i[d]).i]=k.x(a);return h.join("")}},d3.interpolateRgb=function(a,b){a=d3.rgb(a),b=d3.rgb(b);var c=a.r,d=a.g,e=a.b,f=b.r-c,g=b.g-d,h=b.b-e;return function(a){return"rgb("+Math.round(c+f*a)+","+Math.round(d+g*a)+","+Math.round(e+h*a)+")"}},d3.interpolateHsl=function(a,b){a=d3.hsl(a),b=d3.hsl(b);var c=a.h,d=a.s,e=a.l,f=b.h-c,g=b.s-d,h=b.l-e;return function(a){return O(c+f*a,d+g*a,e+h*a).toString()}},d3.interpolateArray=function(a,b){var c=[],d=[],e=a.length,f=b.length,g=Math.min(a.length,b.length),h;for(h=0;h<g;++h)c.push(d3.interpolate(a[h],b[h]));for(;h<e;++h)d[h]=a[h];for(;h<f;++h)d[h]=b[h];return function(a){for(h=0;h<g;++h)d[h]=c[h](a);return d}},d3.interpolateObject=function(a,b){var c={},d={},e;for(e in a)e in b?c[e]=B(e)(a[e],b[e]):d[e]=a[e];for(e in b)e in a||(d[e]=b[e]);return function(a){for(e in c)d[e]=c[e](a);return d}};var z=/[-+]?(?:\d+\.\d+|\d+\.|\.\d+|\d+)(?:[eE][-]?\d+)?/g,A={background:1,fill:1,stroke:1};d3.interpolators=[d3.interpolateObject,function(a,b){return b instanceof Array&&d3.interpolateArray(a,b)},function(a,b){return typeof b=="string"&&d3.interpolateString(String(a),b)},function(a,b){return(typeof b=="string"?b in K||/^(#|rgb\(|hsl\()/.test(b):b instanceof F||b instanceof N)&&d3.interpolateRgb(String(a),b)},function(a,b){return typeof b=="number"&&d3.interpolateNumber(+a,b)}],d3.rgb=function(a,b,c){return arguments.length===1?H(""+a,E,O):E(~~a,~~b,~~c)},F.prototype.brighter=function(a){a=Math.pow(.7,arguments.length?a:1);var b=this.r,c=this.g,d=this.b,e=30;if(!b&&!c&&!d)return E(e,e,e);b&&b<e&&(b=e),c&&c<e&&(c=e),d&&d<e&&(d=e);return E(Math.min(255,Math.floor(b/a)),Math.min(255,Math.floor(c/a)),Math.min(255,Math.floor(d/a)))},F.prototype.darker=function(a){a=Math.pow(.7,arguments.length?a:1);return E(Math.max(0,Math.floor(a*this.r)),Math.max(0,Math.floor(a*this.g)),Math.max(0,Math.floor(a*this.b)))},F.prototype.hsl=function(){return I(this.r,this.g,this.b)},F.prototype.toString=function(){return"#"+G(this.r)+G(this.g)+G(this.b)};var K={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"};for(var L in K)K[L]=H(K[L],E,O);d3.hsl=function(a,b,c){return arguments.length===1?H(""+a,I,M):M(+a,+b,+c)},N.prototype.brighter=function(a){a=Math.pow(.7,arguments.length?a:1);return M(this.h,this.s,this.l/a)},N.prototype.darker=function(a){a=Math.pow(.7,arguments.length?a:1);return M(this.h,this.s,a*this.l)},N.prototype.rgb=function(){return O(this.h,this.s,this.l)},N.prototype.toString=function(){return"hsl("+this.h+","+this.s*100+"%,"+this.l*100+"%)"};var Q=function(a,b){return b.querySelector(a)},R=function(a,b){return b.querySelectorAll(a)};typeof Sizzle=="function"&&(Q=function(a,b){return Sizzle(a,b)[0]},R=function(a,b){return Sizzle.uniqueSort(Sizzle(a,b))});var S=[];d3.selection=function(){return Z},d3.selection.prototype=S,S.select=function(a){var b=[],c,d,e,f;typeof a!="function"&&(a=T(a));for(var g=-1,h=this.length;++g<h;){b.push(c=[]),c.parentNode=(e=this[g]).parentNode;for(var i=-1,j=e.length;++i<j;)(f=e[i])?(c.push(d=a.call(f,f.__data__,i)),d&&"__data__"in f&&(d.__data__=f.__data__)):c.push(null)}return P(b)},S.selectAll=function(a){var b=[],c,d;typeof a!="function"&&(a=U(a));for(var e=-1,f=this.length;++e<f;)for(var g=this[e],h=-1,i=g.length;++h<i;)if(d=g[h])b.push(c=a.call(d,d.__data__,h)),c.parentNode=d;return P(b)},S.attr=function(a,b){function i(){var c=b.apply(this,arguments);c==null?this.removeAttributeNS(a.space,a.local):this.setAttributeNS(a.space,a.local,c)}function h(){var c=b.apply(this,arguments);c==null?this.removeAttribute(a):this.setAttribute(a,c)}function g(){this.setAttributeNS(a.space,a.local,b)}function f(){this.setAttribute(a,b)}function e(){this.removeAttributeNS(a.space,a.local)}function d(){this.removeAttribute(a)}a=d3.ns.qualify(a);if(arguments.length<2){var c=this.node();return a.local?c.getAttributeNS(a.space,a.local):c.getAttribute(a)}return this.each(b==null?a.local?e:d:typeof b=="function"?a.local?i:h:a.local?g:f)},S.classed=function(a,b){function i(){(b.apply(this,arguments)?g:h).call(this)}function h(){if(b=this.classList)return b.remove(a);var b=this.className,d=b.baseVal!=null,f=d?b.baseVal:b;f=e(f.replace(c," ")),d?b.baseVal=f:this.className=f}function g(){if(b=this.classList)return b.add(a);var b=this.className,d=b.baseVal!=null,f=d?b.baseVal:b;c.lastIndex=0,c.test(f)||(f=e(f+" "+a),d?b.baseVal=f:this.className=f)}var c=new RegExp("(^|\\s+)"+d3.requote(a)+"(\\s+|$)","g");if(arguments.length<2){var d=this.node();if(f=d.classList)return f.contains(a);var f=d.className;c.lastIndex=0;return c.test(f.baseVal!=null?f.baseVal:f)}return this.each(typeof b=="function"?i:b?g:h)},S.style=function(a,b,c){function f <ide> (){var d=b.apply(this,arguments);d==null?this.style.removeProperty(a):this.style.setProperty(a,d,c)}function e(){this.style.setProperty(a,b,c)}function d(){this.style.removeProperty(a)}arguments.length<3&&(c="");return arguments.length<2?window.getComputedStyle(this.node(),null).getPropertyValue(a):this.each(b==null?d:typeof b=="function"?f:e)},S.property=function(a,b){function e(){var c=b.apply(this,arguments);c==null?delete this[a]:this[a]=c}function d(){this[a]=b}function c(){delete this[a]}return arguments.length<2?this.node()[a]:this.each(b==null?c:typeof b=="function"?e:d)},S.text=function(a){return arguments.length<1?this.node().textContent:this.each(typeof a=="function"?function(){this.textContent=a.apply(this,arguments)}:function(){this.textContent=a})},S.html=function(a){return arguments.length<1?this.node().innerHTML:this.each(typeof a=="function"?function(){this.innerHTML=a.apply(this,arguments)}:function(){this.innerHTML=a})},S.append=function(a){function c(){return this.appendChild(document.createElementNS(a.space,a.local))}function b(){return this.appendChild(document.createElement(a))}a=d3.ns.qualify(a);return this.select(a.local?c:b)},S.insert=function(a,b){function d(){return this.insertBefore(document.createElementNS(a.space,a.local),Q(b,this))}function c(){return this.insertBefore(document.createElement(a),Q(b,this))}a=d3.ns.qualify(a);return this.select(a.local?d:c)},S.remove=function(){return this.each(function(){var a=this.parentNode;a&&a.removeChild(this)})},S.data=function(a,b){function f(a,f){var g,h=a.length,i=f.length,j=Math.min(h,i),k=Math.max(h,i),l=[],m=[],n=[],o,p;if(b){var q={},r=[],s,t=f.length;for(g=-1;++g<h;)s=b.call(o=a[g],o.__data__,g),s in q?n[t++]=o:q[s]=o,r.push(s);for(g=-1;++g<i;)o=q[s=b.call(f,p=f[g],g)],o?(o.__data__=p,l[g]=o,m[g]=n[g]=null):(m[g]=V(p),l[g]=n[g]=null),delete q[s];for(g=-1;++g<h;)r[g]in q&&(n[g]=a[g])}else{for(g=-1;++g<j;)o=a[g],p=f[g],o?(o.__data__=p,l[g]=o,m[g]=n[g]=null):(m[g]=V(p),l[g]=n[g]=null);for(;g<i;++g)m[g]=V(f[g]),l[g]=n[g]=null;for(;g<k;++g)n[g]=a[g],m[g]=l[g]=null}m.update=l,m.parentNode=l.parentNode=n.parentNode=a.parentNode,c.push(m),d.push(l),e.push(n)}var c=[],d=[],e=[],g=-1,h=this.length,i;if(typeof a=="function")while(++g<h)f(i=this[g],a.call(i,i.parentNode.__data__,g));else while(++g<h)f(i=this[g],a);var j=P(d);j.enter=function(){return W(c)},j.exit=function(){return P(e)};return j};var X=[];X.append=S.append,X.insert=S.insert,X.empty=S.empty,X.select=function(a){var b=[],c,d,e,f,g;for(var h=-1,i=this.length;++h<i;){e=(f=this[h]).update,b.push(c=[]),c.parentNode=f.parentNode;for(var j=-1,k=f.length;++j<k;)(g=f[j])?(c.push(e[j]=d=a.call(f.parentNode,g.__data__,j)),d.__data__=g.__data__):c.push(null)}return P(b)},S.filter=function(a){var b=[],c,d,e;for(var f=0,g=this.length;f<g;f++){b.push(c=[]),c.parentNode=(d=this[f]).parentNode;for(var h=0,i=d.length;h<i;h++)(e=d[h])&&a.call(e,e.__data__,h)&&c.push(e)}return P(b)},S.map=function(a){return this.each(function(){this.__data__=a.apply(this,arguments)})},S.sort=function(a){a=Y.apply(this,arguments);for(var b=0,c=this.length;b<c;b++)for(var d=this[b].sort(a),e=1,f=d.length,g=d[0];e<f;e++){var h=d[e];h&&(g&&g.parentNode.insertBefore(h,g.nextSibling),g=h)}return this},S.on=function(a,b,c){arguments.length<3&&(c=!1);var d="__on"+a,e=a.indexOf(".");e>0&&(a=a.substring(0,e));return arguments.length<2?(e=this.node()[d])&&e._:this.each(function(e,f){function h(a){var c=d3.event;d3.event=a;try{b.call(g,g.__data__,f)}finally{d3.event=c}}var g=this;g[d]&&g.removeEventListener(a,g[d],c),b&&g.addEventListener(a,g[d]=h,c),h._=b})},S.each=function(a){for(var b=-1,c=this.length;++b<c;)for(var d=this[b],e=-1,f=d.length;++e<f;){var g=d[e];g&&a.call(g,g.__data__,e,b)}return this},S.call=function(a){a.apply(this,(arguments[0]=this,arguments));return this},S.empty=function(){return!this.node()},S.node=function(a){for(var b=0,c=this.length;b<c;b++)for(var d=this[b],e=0,f=d.length;e<f;e++){var g=d[e];if(g)return g}return null},S.transition=function(){var a=[],b,c;for(var d=-1,e=this.length;++d<e;){a.push(b=[]);for(var f=this[d],g=-1,h=f.length;++g<h;)b.push((c=f[g])?{node:c,delay:0,duration:250}:null)}return $(a,bc||++bb)};var Z=P([[document]]);Z[0].parentNode=document.documentElement,d3.select=function(a){return typeof a=="string"?Z.select(a):P([[a]])},d3.selectAll=function(a){return typeof a=="string"?Z.selectAll(a):P([a])};var ba=[],bb=0,bc=0,bd=d3.ease("cubic-in-out");ba.call=S.call,d3.transition=function(){return Z.transition()},d3.transition.prototype=ba,ba.select=function(a){var b=[],c,d,e;typeof a!="function"&&(a=T(a));for(var f=-1,g=this.length;++f<g;){b.push(c=[]);for(var h=this[f],i=-1,j=h.length;++i<j;)(e=h[i])&&(d=a.call(e.node,e.node.__data__,i))?("__data__"in e.node&&(d.__data__=e.node.__data__),c.push({node:d,delay:e.delay,duration:e.duration})):c.push(null)}return $(b,this.id).ease(this.ease())},ba.selectAll=function(a){var b=[],c,d;typeof a!="function"&&(a=U(a));for(var e=-1,f=this.length;++e<f;)for(var g=this[e],h=-1,i=g.length;++h<i;)if(d=g[h]){b.push(c=a.call(d.node,d.node.__data__,h));for(var j=-1,k=c.length;++j<k;)c[j]={node:c[j],delay:d.delay,duration:d.duration}}return $(b,this.id).ease(this.ease())},ba.attr=function(a,b){return this.attrTween(a,_(b))},ba.attrTween=function(a,b){function d(c,d){var e=b.call(this,c,d,this.getAttributeNS(a.space,a.local));return e&&function(b){this.setAttributeNS(a.space,a.local,e(b))}}function c(c,d){var e=b.call(this,c,d,this.getAttribute(a));return e&&function(b){this.setAttribute(a,e(b))}}a=d3.ns.qualify(a);return this.tween("attr."+a,a.local?d:c)},ba.style=function(a,b,c){arguments.length<3&&(c=null);return this.styleTween(a,_(b),c)},ba.styleTween=function(a,b,c){arguments.length<3&&(c=null);return this.tween("style."+a,function(d,e){var f=b.call(this,d,e,window.getComputedStyle(this,null).getPropertyValue(a));return f&&function(b){this.style.setProperty(a,f(b),c)}})},ba.text=function(a){return this.tween("text",function(b,c){this.textContent=typeof a=="function"?a.call(this,b,c):a})},ba.remove=function(){return this.each("end",function(){var a;!this.__transition__&&(a=this.parentNode)&&a.removeChild(this)})},ba.delay=function(a){var b=this;return b.each(typeof a=="function"?function(c,d,e){b[e][d].delay=+a.apply(this,arguments)}:(a=+a,function(c,d,e){b[e][d].delay=a}))},ba.duration=function(a){var b=this;return b.each(typeof a=="function"?function(c,d,e){b[e][d].duration=+a.apply(this,arguments)}:(a=+a,function(c,d,e){b[e][d].duration=a}))},ba.transition=function(){return this.select(b)};var bf=null,bg,bh;d3.timer=function(a,b,c){var d=!1,e,f=bf;if(arguments.length<3){if(arguments.length<2)b=0;else if(!isFinite(b))return;c=Date.now()}while(f){if(f.callback===a){f.then=c,f.delay=b,d=!0;break}e=f,f=f.next}d||(bf={callback:a,then:c,delay:b,next:bf}),bg||(bh=clearTimeout(bh),bg=1,bk(bi))},d3.timer.flush=function(){var a,b=Date.now(),c=bf;while(c)a=b-c.then,c.delay||(c.flush=c.callback(a)),c=c.next;bj()};var bk=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(a){setTimeout(a,17)};d3.scale={},d3.scale.linear=function(){return bp([0,1],[0,1],d3.interpolate,!1)},d3.scale.log=function(){return bx(d3.scale.linear(),by)},by.pow=function(a){return Math.pow(10,a)},bz.pow=function(a){return-Math.pow(10,-a)},d3.scale.pow=function(){return bB(d3.scale.linear(),1)},d3.scale.sqrt=function(){return d3.scale.pow().exponent(.5)},d3.scale.ordinal=function(){return bD({},0,{t:"range",x:[]})},d3.scale.category10=function(){return d3.scale.ordinal().range(bE)},d3.scale.category20=function(){return d3.scale.ordinal().range(bF)},d3.scale.category20b=function(){return d3.scale.ordinal().range(bG)},d3.scale.category20c=function(){return d3.scale.ordinal().range(bH)};var bE=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],bF=["#1f77b4","#aec7e8","#ff7f0e","#ffbb78","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5","#8c564b","#c49c94","#e377c2","#f7b6d2","#7f7f7f","#c7c7c7","#bcbd22","#dbdb8d","#17becf","#9edae5"],bG=["#393b79","#5254a3","#6b6ecf","#9c9ede","#637939","#8ca252","#b5cf6b","#cedb9c","#8c6d31","#bd9e39","#e7ba52","#e7cb94","#843c39","#ad494a","#d6616b","#e7969c","#7b4173","#a55194","#ce6dbd","#de9ed6"],bH=["#3182bd","#6baed6","#9ecae1","#c6dbef","#e6550d","#fd8d3c","#fdae6b","#fdd0a2","#31a354","#74c476","#a1d99b","#c7e9c0","#756bb1","#9e9ac8","#bcbddc","#dadaeb","#636363","#969696","#bdbdbd","#d9d9d9"];d3.scale.quantile=function(){return bI([],[])},d3.scale.quantize=function(){return bJ(0,1,[0,1])},d3.svg={},d3.svg.arc=function(){function e(){var e=a.apply(this,arguments),f=b.apply(this,arguments),g=c.apply(this,arguments)+bK,h=d.apply(this,arguments)+bK,i=(h<g&&(i=g,g=h,h=i),h-g),j=i<Math.PI?"0":"1",k=Math.cos(g),l=Math.sin(g),m=Math.cos(h),n=Math.sin(h);return i>=bL?e?"M0,"+f+"A"+f+","+f+" 0 1,1 0,"+ -f+"A"+f+","+f+" 0 1,1 0,"+f+"M0,"+e+"A"+e+","+e+" 0 1,1 0,"+ -e+"A"+e+","+e+" 0 1,1 0,"+e+"Z":"M0,"+f+"A"+f+","+f+" 0 1,1 0,"+ -f+"A"+f+","+f+" 0 1,1 0,"+f+"Z":e?"M"+f*k+","+f*l+"A"+f+","+f+" 0 "+j+",1 "+f*m+","+f*n+"L"+e*m+","+e*n+"A"+e+","+e+" 0 "+j+",0 "+e*k+","+e*l+"Z":"M"+f*k+","+f*l+"A"+f+","+f+" 0 "+j+",1 "+f*m+","+f*n+"L0,0"+"Z"}var a=bM,b=bN,c=bO,d=bP;e.innerRadius=function(b){if(!arguments.length)return a;a=d3.functor(b);return e},e.outerRadius=function(a){if(!arguments.length)return b;b=d3.functor(a);return e},e.startAngle=function(a){if(!arguments.length)return c;c=d3.functor(a);return e},e.endAngle=function(a){if(!arguments.length)return d;d=d3.functor(a);return e},e.centroid=function(){var e=(a.apply(this,arguments)+b.apply(this,arguments))/2,f=(c.apply(this,arguments)+d.apply(this,arguments))/2+bK;return[Math.cos(f)*e,Math.sin(f)*e]};return e};var bK=-Math.PI/2,bL=2*Math.PI-1e-6;d3.svg.line=function(){return bQ(Object)};var bU={linear:bV,"step-before":bW,"step-after":bX,basis:cb,"basis-open":cc,"basis-closed":cd,bundle:ce,cardinal:b$,"cardinal-open":bY,"cardinal-closed":bZ,monotone:cn},cg=[0,2/3,1/3,0],ch=[0,1/3,2/3,0],ci=[0,1/6,2/3,1/6];d3.svg.line.radial=function(){var a=bQ(co);a.radius=a.x,delete a.x,a.angle=a.y,delete a.y;return a},d3.svg.area=function(){return cp(Object)},d3.svg.area.radial=function(){var a=cp(co);a.radius=a.x,delete a.x,a.innerRadius=a.x0,delete a.x0,a.outerRadius=a.x1,delete a.x1,a.angle=a.y,delete a.y,a.startAngle=a.y0,delete a.y0,a.endAngle=a.y1,delete a.y1;return a},d3.svg.chord=function(){function j(a,b,c,d){return"Q 0,0 "+d}function i(a,b){return"A"+a+","+a+" 0 0,1 "+b}function h(a,b){return a.a0==b.a0&&a.a1==b.a1}function g(a,b,f,g){var h=b.call(a,f,g),i=c.call(a,h,g),j=d.call(a,h,g)+bK,k=e.call(a,h,g)+bK;return{r:i,a0:j,a1:k,p0:[i*Math.cos(j),i*Math.sin(j)],p1:[i*Math.cos(k),i*Math.sin(k)]}}function f(c,d){var e=g(this,a,c,d),f=g(this,b,c,d);return"M"+e.p0+i(e.r,e.p1)+(h(e,f)?j(e.r,e.p1,e.r,e.p0):j(e.r,e.p1,f.r,f.p0)+i(f.r,f.p1)+j(f.r,f.p1,e.r,e.p0))+"Z"}var a=cs,b=ct,c=cu,d=bO,e=bP;f.radius=function(a){if(!arguments.length)return c;c=d3.functor(a);return f},f.source=function(b){if(!arguments.length)return a;a=d3.functor(b);return f},f.target=function(a){if(!arguments.length)return b;b=d3.functor(a);return f},f.startAngle=function(a){if(!arguments.length)return d;d=d3.functor(a);return f},f.endAngle=function(a){if(!arguments.length)return e;e=d3.functor(a);return f};return f},d3.svg.diagonal=function(){function d(d,e){var f=a.call(this,d,e),g=b.call(this,d,e),h=(f.y+g.y)/2,i=[f,{x:f.x,y:h},{x:g.x,y:h},g];i=i.map(c);return"M"+i[0]+"C"+i[1]+" "+i[2]+" "+i[3]}var a=cs,b=ct,c=cx;d.source=function(b){if(!arguments.length)return a;a=d3.functor(b);return d},d.target=function(a){if(!arguments.length)return b;b=d3.functor(a);return d},d.projection=function(a){if(!arguments.length)return c;c=a;return d};return d},d3.svg.diagonal.radial=function(){var a=d3.svg.diagonal(),b=cx,c=a.projection;a.projection=function(a){return arguments.length?c(cy(b=a)):b};return a},d3.svg.mouse=function(a){return cA(a,d3.event)};var cz=/WebKit/.test(navigator.userAgent)?-1:0;d3.svg.touches=function(a){var b=d3.event.touches;return b?Array.prototype.map.call(b,function(b){var c=cA(a,b);c.identifier=b.identifier;return c}):[]},d3.svg.symbol=function(){function c(c,d){return(cD[a.call(this,c,d)]||cD.circle)(b.call(this,c,d))}var a=cC,b=cB;c.type=function(b){if(!arguments.length)return a;a=d3.functor(b);return c},c.size=function(a){if(!arguments.length)return b;b=d3.functor(a);return c};return c};var cD={circle:function(a){var b=Math.sqrt(a/Math.PI);return"M0,"+b+"A"+b+","+b+" 0 1,1 0,"+ -b+"A"+b+","+b+" 0 1,1 0,"+b+"Z"},cross:function(a){var b=Math.sqrt(a/5)/2;return"M"+ -3*b+","+ -b+"H"+ -b+"V"+ -3*b+"H"+b+"V"+ -b+"H"+3*b+"V"+b+"H"+b+"V"+3*b+"H"+ -b+"V"+b+"H"+ -3*b+"Z"},diamond:function(a){var b=Math.sqrt(a/(2*cF)),c=b*cF;return"M0,"+ -b+"L"+c+",0"+" 0,"+b+" "+ -c+",0"+"Z"},square:function(a){var b=Math.sqrt(a)/2;return"M"+ -b+","+ -b+"L"+b+","+ -b+" "+b+","+b+" "+ -b+","+b+"Z"},"triangle-down":function(a){var b=Math.sqrt(a/cE),c=b*cE/2;return"M0,"+c+"L"+b+","+ -c+" "+ -b+","+ -c+"Z"},"triangle-up":function(a){var b=Math.sqrt(a/cE),c=b*cE/2;return"M0,"+ -c+"L"+b+","+c+" "+ -b+","+c+"Z"}};d3.svg.symbolTypes=d3.keys(cD);var cE=Math.sqrt(3),cF=Math.tan(30*Math.PI/180);d3.svg.axis=function(){function j(j){j.each(function(k,l,m){function F(a){return j.delay?a.transition().delay(j[m][l].delay).duration(j[m][l].duration).ease(j.ease()):a}var n=d3.select(this),o=a.ticks.apply(a,g),p=h==null?a.tickFormat.apply(a,g):h,q=cI(a,o,i),r=n.selectAll(".minor").data(q,String),s=r.enter().insert("svg:line","g").attr("class","tick minor").style("opacity",1e-6),t=F(r.exit()).style("opacity",1e-6).remove(),u=F(r).style("opacity",1),v=n.selectAll("g").data(o,String),w=v.enter().insert("svg:g","path").style("opacity",1e-6),x=F(v.exit()).style("opacity",1e-6).remove(),y=F(v).style("opacity",1),z,A=bm(a.range()),B=n.selectAll(".domain").data([]),C=B.enter().append("svg:path").attr("class","domain"),D=F(B),E=this.__chart__||a;this.__chart__=a.copy(),w.append("svg:line").attr("class","tick"),w.append("svg:text"),y.select("text").text(p);switch(b){case"bottom":z=cG,u.attr("y2",d),w.select("text").attr("dy",".71em").attr("text-anchor","middle"),y.select("line").attr("y2",c),y.select("text").attr("y",Math.max(c,0)+f),D.attr("d","M"+A[0]+","+e+"V0H"+A[1]+"V"+e);break;case"top":z=cG,u.attr("y2",-d),w.select("text").attr("text-anchor","middle"),y.select("line").attr("y2",-c),y.select("text").attr("y",-(Math.max(c,0)+f)),D.attr("d","M"+A[0]+","+ -e+"V0H"+A[1]+"V"+ -e);break;case"left":z=cH,u.attr("x2",-d),w.select("text").attr("dy",".32em").attr("text-anchor","end"),y.select("line").attr("x2",-c),y.select("text").attr("x",-(Math.max(c,0)+f)),D.attr("d","M"+ -e+","+A[0]+"H0V"+A[1]+"H"+ -e);break;case"right":z=cH,u.attr("x2",d),w.select("text").attr("dy",".32em"),y.select("line").attr("x2",c),y.select("text").attr("x",Math.max(c,0)+f),D.attr("d","M"+e+","+A[0]+"H0V"+A[1]+"H"+e)}w.call(z,E),y.call(z,a),x.call(z,a),s.call(z,E),u.call(z,a),t.call(z,a)})}var a=d3.scale.linear(),b="bottom",c=6,d=6,e=6,f=3,g=[10],h,i=0;j.scale=function(b){if(!arguments.length)return a;a=b;return j},j.orient=function(a){if(!arguments.length)return b;b=a;return j},j.ticks=function(){if(!arguments.length)return g;g=arguments;return j},j.tickFormat=function(a){if(!arguments.length)return h;h=a;return j},j.tickSize=function(a,b,f){if(!arguments.length)return c;var g=arguments.length-1;c=+a,d=g>1?+b:c,e=g>0?+arguments[g]:c;return j},j.tickPadding=function(a){if(!arguments.length)return f;f=+a;return j},j.tickSubdivide=function(a){if(!arguments.length)return i;i=+a;return j};return j},d3.behavior={},d3.behavior.drag=function(){function d(){c.apply(this,arguments),cP("dragstart")}function c(){cJ=a,cM=cQ((cK=this).parentNode),cN=0,cL=arguments}function b(){this.on("mousedown.drag",d).on("touchstart.drag",d),d3.select(window).on("mousemove.drag",cR).on("touchmove.drag",cR).on("mouseup.drag",cS,!0).on("touchend.drag",cS,!0).on("click.drag",cT,!0)}var a=d3.dispatch("drag","dragstart","dragend");b.on=function(c,d){a[c].add(d);return b};return b};var cJ,cK,cL,cM,cN,cO;d3.behavior.zoom=function(){function h(){d.apply(this,arguments);var b=dg(),c,e=Date.now();b.length===1&&e-cZ<300&&dl(1+Math.floor(a[2]),c=b[0],cY[c.identifier]),cZ=e}function g(){d.apply(this,arguments);var b=d3.svg.mouse(da);dl(d3.event.shiftKey?Math.ceil(a[2]-1):Math.floor(a[2]+1),b,de(b))}function f(){d.apply(this,arguments),cX||(cX=de(d3.svg.mouse(da))),dl(df()+a[2],d3.svg.mouse(da),cX)}function e(){d.apply(this,arguments),cW=de(d3.svg.mouse(da)),dc=!1,d3.event.preventDefault(),window.focus()}function d(){c$=a,c_=b.zoom.dispatch,da=this,db=arguments}function c(){this.on("mousedown.zoom",e).on("mousewheel.zoom",f).on("DOMMouseScroll.zoom",f).on("dblclick.zoom",g).on("touchstart.zoom",h),d3.select(window).on("mousemove.zoom",di).on("mouseup.zoom",dj).on("touchmove.zoom",dh).on("touchend.zoom",dg).on("click.zoom",dk,!0)}var a=[0,0,0],b=d3.dispatch("zoom");c.on=function(a,d){b[a].add(d);return c};return c};var cV,cW,cX,cY={},cZ=0,c$,c_,da,db,dc,dd})() <ide>\ No newline at end of file <ide><path>src/core/transition.js <ide> function d3_transition(groups, id) { <ide> <ide> delay <= elapsed ? start() : d3.timer(start, delay, then); <ide> <del> function start() { <add> function start(elapsed) { <ide> if (lock.active > id) return stop(); <ide> lock.active = id; <ide> <ide> function d3_transition(groups, id) { <ide> } <ide> <ide> event.start.dispatch.call(node, d, i); <del> d3.timer(tick, 0, then); <add> if (!tick(elapsed)) d3.timer(tick, 0, then); <ide> return 1; <ide> } <ide>
3
PHP
PHP
add tests for uri object being correct
1dae2c13947cd226d896eaa889ee7ee7b8cc4463
<ide><path>tests/TestCase/Network/RequestTest.php <ide> public function testEnvironmentDetection($name, $env, $expected) <ide> $this->_loadEnvironment($env); <ide> <ide> $request = Request::createFromGlobals(); <del> $this->assertEquals($expected['url'], $request->url, "url error"); <del> $this->assertEquals($expected['base'], $request->base, "base error"); <add> $uri = $request->getUri(); <add> <add> $this->assertEquals($expected['url'], $request->url, "URL is incorrect"); <add> $this->assertEquals('/' . $expected['url'], $uri->getPath(), 'Uri->getPath() is incorrect'); <add> <add> $this->assertEquals($expected['base'], $request->base, "base is incorrect"); <add> $this->assertEquals($expected['base'], $request->getAttribute('base'), "base is incorrect"); <add> <ide> $this->assertEquals($expected['webroot'], $request->webroot, "webroot error"); <add> $this->assertEquals($expected['webroot'], $request->getAttribute('webroot'), "webroot is incorrect"); <add> <ide> if (isset($expected['urlParams'])) { <ide> $this->assertEquals($expected['urlParams'], $request->query, "GET param mismatch"); <ide> }
1
Python
Python
remove references to airflow.contrib in tests
6486abc31f5c35f17b0e816aa4e5803282b10f30
<ide><path>tests/providers/google/cloud/hooks/test_natural_language.py <ide> class TestCloudNaturalLanguageHook(unittest.TestCase): <ide> def setUp(self): <ide> with mock.patch( <del> "airflow.contrib.hooks." "gcp_api_base_hook.CloudBaseHook.__init__", <add> "airflow.providers.google.cloud.hooks.base.CloudBaseHook.__init__", <ide> new=mock_base_gcp_hook_no_default_project_id, <ide> ): <ide> self.hook = CloudNaturalLanguageHook(gcp_conn_id="test") <ide><path>tests/providers/google/marketing_platform/hooks/test_display_video.py <ide> class TestGoogleDisplayVideo360Hook(TestCase): <ide> def setUp(self): <ide> with mock.patch( <del> "airflow.contrib.hooks.gcp_api_base_hook.GoogleCloudBaseHook.__init__", <add> "airflow.providers.google.cloud.hooks.base.CloudBaseHook.__init__", <ide> new=mock_base_gcp_hook_default_project_id, <ide> ): <ide> self.hook = GoogleDisplayVideo360Hook(gcp_conn_id=GCP_CONN_ID) <ide><path>tests/providers/google/marketing_platform/hooks/test_search_ads.py <ide> class TestSearchAdsHook(TestCase): <ide> def setUp(self): <ide> with mock.patch( <del> "airflow.contrib.hooks.gcp_api_base_hook.GoogleCloudBaseHook.__init__", <add> "airflow.providers.google.marketing_platform.hooks.search_ads.CloudBaseHook.__init__", <ide> new=mock_base_gcp_hook_default_project_id, <ide> ): <ide> self.hook = GoogleSearchAdsHook(gcp_conn_id=GCP_CONN_ID)
3
Javascript
Javascript
fix intermittent blank page on fast zoom
d85e38d629cf740a3bd2ad978f1a832f47d2bfeb
<ide><path>src/api.js <ide> var InternalRenderTask = (function InternalRenderTaskClosure() { <ide> cancel: function InternalRenderTask_cancel() { <ide> this.running = false; <ide> this.cancelled = true; <del> this.callback(); <add> this.callback('cancelled'); <ide> }, <ide> <ide> operatorListChanged: function InternalRenderTask_operatorListChanged() { <ide><path>web/viewer.js <ide> var PageView = function pageView(container, id, scale, <ide> this.update = function pageViewUpdate(scale, rotation) { <ide> if (this.renderTask) { <ide> this.renderTask.cancel(); <del> this.renderTask = null; <ide> } <ide> this.resume = null; <ide> this.renderingState = RenderingStates.INITIAL; <ide> var PageView = function pageView(container, id, scale, <ide> <ide> var self = this; <ide> function pageViewDrawCallback(error) { <add> // The renderTask may have been replaced by a new one, so only remove the <add> // reference to the renderTask if it matches the one that is triggering <add> // this callback. <add> if (renderTask === self.renderTask) { <add> self.renderTask = null; <add> } <add> <add> if (error === 'cancelled') { <add> return; <add> } <add> <ide> self.renderingState = RenderingStates.FINISHED; <del> self.renderTask = null; <ide> <ide> if (self.loadingIconDiv) { <ide> div.removeChild(self.loadingIconDiv); <ide> var PageView = function pageView(container, id, scale, <ide> cont(); <ide> } <ide> }; <del> this.renderTask = this.pdfPage.render(renderContext); <add> var renderTask = this.renderTask = this.pdfPage.render(renderContext); <ide> <ide> this.renderTask.then( <ide> function pdfPageRenderCallback() {
2
Java
Java
use the annotation meta data in problem reporting
1a7ec7daf29e15a45c9bf5382ca4c080c53b5af8
<ide><path>org.springframework.context/src/main/java/org/springframework/context/annotation/ConfigurationClass.java <ide> private class FinalConfigurationProblem extends Problem { <ide> <ide> public FinalConfigurationProblem() { <ide> super(String.format("@Configuration class '%s' may not be final. Remove the final modifier to continue.", <del> getSimpleName()), new Location(getResource(), ConfigurationClass.this)); <add> getSimpleName()), new Location(getResource(), getMetadata())); <ide> } <ide> } <ide> <ide> private class OverloadedMethodProblem extends Problem { <ide> public OverloadedMethodProblem(String methodName, int count) { <ide> super(String.format("@Configuration class '%s' has %s overloaded factory methods of name '%s'. " + <ide> "Only one factory method of the same name allowed.", <del> getSimpleName(), count, methodName), new Location(getResource(), ConfigurationClass.this)); <add> getSimpleName(), count, methodName), new Location(getResource(), getMetadata())); <ide> } <ide> } <ide>
1
Ruby
Ruby
find inverse associations with plural names
1c7275a0ba05aaa27e5999eaa10b698d890fa157
<ide><path>activerecord/lib/active_record/reflection.rb <ide> def inverse_name <ide> <ide> # returns either +nil+ or the inverse association name that it finds. <ide> def automatic_inverse_of <del> if can_find_inverse_of_automatically?(self) <del> inverse_name = ActiveSupport::Inflector.underscore(options[:as] || active_record.name.demodulize).to_sym <add> return unless can_find_inverse_of_automatically?(self) <ide> <add> inverse_name_candidates = <add> if options[:as] <add> [options[:as]] <add> else <add> active_record_name = active_record.name.demodulize <add> [active_record_name, ActiveSupport::Inflector.pluralize(active_record_name)] <add> end <add> <add> inverse_name_candidates.map! do |candidate| <add> ActiveSupport::Inflector.underscore(candidate).to_sym <add> end <add> <add> inverse_name_candidates.detect do |inverse_name| <ide> begin <ide> reflection = klass._reflect_on_association(inverse_name) <ide> rescue NameError <ide> def automatic_inverse_of <ide> reflection = false <ide> end <ide> <del> if valid_inverse_reflection?(reflection) <del> return inverse_name <del> end <add> valid_inverse_reflection?(reflection) <ide> end <ide> end <ide> <ide><path>activerecord/test/cases/associations/inverse_associations_test.rb <ide> require "models/project" <ide> require "models/author" <ide> require "models/post" <add>require "models/department" <ide> <ide> class AutomaticInverseFindingTests < ActiveRecord::TestCase <ide> fixtures :ratings, :comments, :cars <ide> def test_trying_to_set_polymorphic_inverses_that_dont_exist_on_the_instance_bein <ide> # fails because Interest does have the correct inverse_of <ide> assert_raise(ActiveRecord::InverseOfAssociationNotFoundError) { Face.first.polymorphic_man = Interest.first } <ide> end <add> <add> def test_favors_has_one_associations_for_inverse_of <add> inverse_name = Post.reflect_on_association(:author).inverse_of.name <add> assert_equal :post, inverse_name <add> end <add> <add> def test_finds_inverse_of_for_plural_associations <add> inverse_name = Department.reflect_on_association(:hotel).inverse_of.name <add> assert_equal :departments, inverse_name <add> end <ide> end <ide> <ide> # NOTE - these tests might not be meaningful, ripped as they were from the parental_control plugin
2
Text
Text
update changelog to fix wrong extension
aa9b64790be6b367b07858f0d5dd2b22da011350
<ide><path>activerecord/CHANGELOG.md <ide> <ide> 3) boot rails. <ide> RAILS_ENV=production bundle exec rails server <del> => use db/schema_cache.db <add> => use db/schema_cache.dump <ide> <ide> 4) If you remove clear dumped cache, execute rake task. <ide> RAILS_ENV=production bundle exec rake db:schema:cache:clear
1
Text
Text
fix typo in path.md
0fd73696a5bc324adcddad6953ab8984b3d30937
<ide><path>doc/api/path.md <ide> On Windows systems only, returns an equivalent [namespace-prefixed path][] for <ide> the given `path`. If `path` is not a string, `path` will be returned without <ide> modifications. <ide> <del>This method is meaningful only on Windows system. On POSIX systems, the <add>This method is meaningful only on Windows systems. On POSIX systems, the <ide> method is non-operational and always returns `path` without modifications. <ide> <ide> ## `path.win32`
1
PHP
PHP
fix empty morph to relationship
7dca817417ef3db4812814b61e480563bb45cf0d
<ide><path>src/Illuminate/Database/Eloquent/Relations/MorphTo.php <ide> public function __construct(Builder $query, Model $parent, $foreignKey, $otherKe <ide> parent::__construct($query, $parent, $foreignKey, $otherKey, $relation); <ide> } <ide> <add> /** <add> * Get the results of the relationship. <add> * <add> * @return mixed <add> */ <add> public function getResults() <add> { <add> if ( ! $this->otherKey) return; <add> <add> return $this->query->first(); <add> } <add> <ide> /** <ide> * Set the constraints for an eager load of the relation. <ide> * <ide><path>tests/Database/DatabaseEloquentIntegrationTest.php <ide> public function testBasicMorphManyRelationship() <ide> } <ide> <ide> <add> public function testEmptyMorphToRelationship() <add> { <add> $photo = EloquentTestPhoto::create(['name' => 'Avatar 1']); <add> <add> $this->assertNull($photo->imageable); <add> } <add> <add> <ide> public function testMultiInsertsWithDifferentValues() <ide> { <ide> $date = '1970-01-01';
2
Python
Python
fix transfoxlmodel loading
e7cfc46fc1150535b8248c4584c24cccfc73c9e0
<ide><path>pytorch_pretrained_bert/modeling_transfo_xl.py <ide> def load(module, prefix=''): <ide> for name, child in module._modules.items(): <ide> if child is not None: <ide> load(child, prefix + name + '.') <del> load(model, prefix='') <add> <add> start_prefix = '' <add> if not hasattr(model, 'transformer') and any(s.startswith('transformer.') for s in state_dict.keys()): <add> start_prefix = 'transformer.' <add> load(model, prefix=start_prefix) <add> <ide> if len(missing_keys) > 0: <ide> logger.info("Weights of {} not initialized from pretrained model: {}".format( <ide> model.__class__.__name__, missing_keys))
1
Javascript
Javascript
curse ye, linter
067ba9812e5c8554ce9291ccd37011d7dd948cf8
<ide><path>script/lib/run-apm-install.js <ide> module.exports = function (packagePath, stderrOnly) { <ide> childProcess.execFileSync( <ide> CONFIG.getApmBinPath(), <ide> ['--loglevel=error', 'install'], <del> {env: installEnv, cwd: packagePath, stdio: ['inherit', stderrOnly ? 'pipe' : 'inherit', 'inherit'] } <add> {env: installEnv, cwd: packagePath, stdio: ['inherit', stderrOnly ? 'pipe' : 'inherit', 'inherit']} <ide> ) <ide> }
1
Ruby
Ruby
specify channel name as an attribute
792fe4b29ce76089672c0741370b10d03a7f076a
<ide><path>lib/action_cable/channel/base.rb <ide> class Base <ide> <ide> attr_reader :params <ide> <add> class_attribute :channel_name <add> <ide> class << self <ide> def matches?(identifier) <ide> raise "Please implement #{name}#matches? method" <ide><path>lib/action_cable/server.rb <ide> def subscribe_channel(data) <ide> id_key = data['identifier'] <ide> id_options = ActiveSupport::JSON.decode(id_key).with_indifferent_access <ide> <del> if subscription = registered_channels.detect { |channel_klass| channel_klass.matches?(id_options) } <del> @subscriptions[id_key] = subscription.new(self, id_key, id_options) <add> subscription_klass = registered_channels.detect do |channel_klass| <add> channel_klass.channel_name == id_options[:channel] && channel_klass.matches?(id_options) <add> end <add> <add> if subscription_klass <add> @subscriptions[id_key] = subscription_klass.new(self, id_key, id_options) <ide> @subscriptions[id_key].subscribe <ide> else <ide> # No channel found
2
Text
Text
update broken link in 'why react' article
14cb99c9aa6cdd8748d16690b13a89dece2a041f
<ide><path>docs/_posts/2013-06-05-why-react.md <ide> to render views, which we see as an advantage over templates for a few reasons: <ide> **no manual string concatenation** and therefore less surface area for XSS <ide> vulnerabilities. <ide> <del>We've also created [JSX](http://facebook.github.io/react/docs/syntax.html), an optional <del>syntax extension, in case you prefer the readability of HTML to raw JavaScript. <add>We've also created [JSX](/react/docs/jsx-in-depth.html), an optional syntax <add>extension, in case you prefer the readability of HTML to raw JavaScript. <ide> <ide> ## Reactive updates are dead simple. <ide>
1
Ruby
Ruby
handle tab in token authentication header
d5a0d71037921320210ab719921c9ba621b98ec2
<ide><path>actionpack/lib/action_controller/metal/http_authentication.rb <ide> def opaque(secret_key) <ide> # <ide> # RewriteRule ^(.*)$ dispatch.fcgi [E=X-HTTP_AUTHORIZATION:%{HTTP:Authorization},QSA,L] <ide> module Token <del> TOKEN_REGEX = /^Token / <add> TOKEN_REGEX = /^Token\s+/ <ide> AUTHN_PAIR_DELIMITERS = /(?:,|;|\t+)/ <ide> extend self <ide> <ide><path>actionpack/test/controller/http_token_authentication_test.rb <ide> def authenticate_long_credentials <ide> assert_equal "HTTP Token: Access denied.\n", @response.body, "Authentication header was not properly parsed" <ide> end <ide> <add> test "authentication request with tab in header" do <add> @request.env['HTTP_AUTHORIZATION'] = "Token\ttoken=\"lifo\"" <add> get :index <add> <add> assert_response :success <add> assert_equal 'Hello Secret', @response.body <add> end <add> <ide> test "authentication request without credential" do <ide> get :display <ide>
2
Ruby
Ruby
fix frozen string bug
c6cb20a768eba296396b8c7879434cde3916cdef
<ide><path>Library/Homebrew/exceptions.rb <ide> def initialize(flags, bottled: true) <ide> require_text = "requires" <ide> end <ide> <del> message = <<~EOS <add> message = +<<~EOS <ide> The following #{flag_text}: <ide> #{flags.join(", ")} <ide> #{require_text} building tools, but none are installed. <ide><path>Library/Homebrew/test/exceptions_spec.rb <ide> class Baz < Formula; end <ide> <ide> its(:to_s) { is_expected.to match(/This bottle does not contain the formula file/) } <ide> end <add> <add>describe BuildFlagsError do <add> subject { described_class.new(["-s"]) } <add> <add> its(:to_s) { is_expected.to match(/flag:\s+-s\nrequires building tools/) } <add>end
2
Text
Text
update releaser list in readme.md
ac08249971d9cbb2c9afb6375e10882aa421efc7
<ide><path>README.md <ide> GPG keys used to sign Node.js releases: <ide> `4ED778F539E3634C779C87C6D7062848A1AB005C` <ide> * **Colin Ihrig** &lt;cjihrig@gmail.com&gt; <ide> `94AE36675C464D64BAFA68DD7434390BDBE9B9C5` <del>* **Evan Lucas** &lt;evanlucas@me.com&gt; <del>`B9AE9905FFD7803F25714661B63B535A4C206CA9` <del>* **Gibson Fahnestock** &lt;gibfahn@gmail.com&gt; <del>`77984A986EBC2AA786BC0F66B01FBB92821C587A` <ide> * **James M Snell** &lt;jasnell@keybase.io&gt; <ide> `71DCFD284A79C3B38668286BC97EC7A07EDE3FC1` <ide> * **Michaël Zasso** &lt;targos@protonmail.com&gt; <ide> To import the full set of trusted release keys: <ide> <ide> ```shell <ide> gpg --keyserver pool.sks-keyservers.net --recv-keys 4ED778F539E3634C779C87C6D7062848A1AB005C <del>gpg --keyserver pool.sks-keyservers.net --recv-keys B9E2F5981AA6E0CD28160D9FF13993A75599653C <ide> gpg --keyserver pool.sks-keyservers.net --recv-keys 94AE36675C464D64BAFA68DD7434390BDBE9B9C5 <del>gpg --keyserver pool.sks-keyservers.net --recv-keys B9AE9905FFD7803F25714661B63B535A4C206CA9 <del>gpg --keyserver pool.sks-keyservers.net --recv-keys 77984A986EBC2AA786BC0F66B01FBB92821C587A <ide> gpg --keyserver pool.sks-keyservers.net --recv-keys 71DCFD284A79C3B38668286BC97EC7A07EDE3FC1 <ide> gpg --keyserver pool.sks-keyservers.net --recv-keys 8FCCA13FEF1D0C2E91008E09770F7A9A5AE15600 <ide> gpg --keyserver pool.sks-keyservers.net --recv-keys C4F0DFFF4E8C1A8236409D08E73BC641CC11F4C8 <ide> gpg --keyserver pool.sks-keyservers.net --recv-keys DD8F2338BAE7501E3DD5AC78C273792F7D83545D <ide> gpg --keyserver pool.sks-keyservers.net --recv-keys A48C2BEE680E841632CD4E44F07496B3EB3C1762 <add>gpg --keyserver pool.sks-keyservers.net --recv-keys B9E2F5981AA6E0CD28160D9FF13993A75599653C <ide> ``` <ide> <ide> See the section above on [Verifying Binaries](#verifying-binaries) for how to <ide> use these keys to verify a downloaded file. <ide> <ide> Other keys used to sign some previous releases: <ide> <del>* **Jeremiah Senkpiel** &lt;fishrock@keybase.io&gt; <del>`FD3A5288F042B6850C66B31F09FE44734EB7990E` <ide> * **Chris Dickinson** &lt;christopher.s.dickinson@gmail.com&gt; <ide> `9554F04D7259F04124DE6B476D5A82AC7E37093B` <add>* **Evan Lucas** &lt;evanlucas@me.com&gt; <add>`B9AE9905FFD7803F25714661B63B535A4C206CA9` <add>* **Gibson Fahnestock** &lt;gibfahn@gmail.com&gt; <add>`77984A986EBC2AA786BC0F66B01FBB92821C587A` <ide> * **Isaac Z. Schlueter** &lt;i@izs.me&gt; <ide> `93C7E9E91B49E432C2F75674B0A78B0A6C481CF6` <ide> * **Italo A. Casas** &lt;me@italoacasas.com&gt; <ide> `56730D5401028683275BD23C23EFEFE93C4CFFFE` <add>* **Jeremiah Senkpiel** &lt;fishrock@keybase.io&gt; <add>`FD3A5288F042B6850C66B31F09FE44734EB7990E` <ide> * **Julien Gilli** &lt;jgilli@fastmail.fm&gt; <ide> `114F43EE0176B71C7BC219DD50A3051F888C628D` <ide> * **Timothy J Fontaine** &lt;tjfontaine@gmail.com&gt;
1
PHP
PHP
add missing call to guard for pusher
4d9e85fc4f320fce3c7c386368e00405efb46d3e
<ide><path>src/Illuminate/Broadcasting/Broadcasters/PusherBroadcaster.php <ide> public function auth($request) <ide> * @param mixed $result <ide> * @return mixed <ide> */ <del> public function validAuthenticationResponse($request, $result) <add> public function validAuthenticationResponse($request, $result, $options = []) <ide> { <ide> if (Str::startsWith($request->channel_name, 'private')) { <ide> return $this->decodePusherResponse( <ide> public function validAuthenticationResponse($request, $result) <ide> $request, <ide> $this->pusher->presence_auth( <ide> $request->channel_name, $request->socket_id, <del> $request->user()->getAuthIdentifier(), $result <add> $request->user($options['guard'] ?? null)->getAuthIdentifier(), $result <ide> ) <ide> ); <ide> }
1
PHP
PHP
add option to configure mailgun transporter scheme
4ecd97bcf7e996e35b7672c69e3974b8e233bb1b
<ide><path>config/services.php <ide> 'domain' => env('MAILGUN_DOMAIN'), <ide> 'secret' => env('MAILGUN_SECRET'), <ide> 'endpoint' => env('MAILGUN_ENDPOINT', 'api.mailgun.net'), <add> 'scheme' => 'https', <ide> ], <ide> <ide> 'postmark' => [
1
Python
Python
remove unused import
a8e88bc4c8e06754dec7d3a1711a5c85853ad07c
<ide><path>t/unit/app/test_defaults.py <ide> import sys <ide> from importlib import import_module <ide> <del>from case import mock <del> <ide> from celery.app.defaults import (_OLD_DEFAULTS, _OLD_SETTING_KEYS, <ide> _TO_NEW_KEY, _TO_OLD_KEY, DEFAULTS, <ide> NAMESPACES, SETTING_KEYS)
1
Javascript
Javascript
return empty string for non-numbers
4b1913c5ecac75e60e7a0de831100b6961d5d294
<ide><path>src/filters.js <ide> angularFilter.currency = function(amount, currencySymbol){ <ide> var DECIMAL_SEP = '.'; <ide> <ide> angularFilter.number = function(number, fractionSize) { <del> if (isNaN(number) || !isFinite(number)) return ''; <ide> var formats = this.$service('$locale').NUMBER_FORMATS; <ide> return formatNumber(number, formats.PATTERNS[0], formats.GROUP_SEP, <ide> formats.DECIMAL_SEP, fractionSize); <ide> } <ide> <ide> function formatNumber(number, pattern, groupSep, decimalSep, fractionSize) { <add> if (isNaN(number) || !isFinite(number)) return ''; <add> <ide> var isNegative = number < 0; <ide> number = Math.abs(number); <ide> var numStr = number + '', <ide><path>test/FiltersSpec.js <ide> describe('filter', function() { <ide> }); <ide> <ide> describe('currency', function() { <del> it('should do basic currency filtering', function() { <del> var html = jqLite('<span/>'); <del> var context = createScope(); <add> var currency, html, context; <add> <add> beforeEach(function() { <add> html = jqLite('<span></span>'); <add> context = createScope(); <ide> context.$element = html; <del> var currency = bind(context, filter.currency); <add> currency = bind(context, filter.currency); <add> }); <ide> <add> afterEach(function() { <add> dealoc(context); <add> }); <add> <add> it('should do basic currency filtering', function() { <ide> expect(currency(0)).toEqual('$0.00'); <ide> expect(html.hasClass('ng-format-negative')).toBeFalsy(); <ide> expect(currency(-999)).toEqual('($999.00)'); <ide> expect(html.hasClass('ng-format-negative')).toBeTruthy(); <ide> expect(currency(1234.5678, "USD$")).toEqual('USD$1,234.57'); <ide> expect(html.hasClass('ng-format-negative')).toBeFalsy(); <add> }); <ide> <del> dealoc(context); <add> it('should return empty string for non-numbers', function() { <add> expect(currency()).toBe(''); <add> expect(html.hasClass('ng-format-negative')).toBeFalsy(); <add> expect(currency('abc')).toBe(''); <add> expect(html.hasClass('ng-format-negative')).toBeFalsy(); <ide> }); <ide> }); <ide>
2
Text
Text
edit stability text for clarity and style
3d7ada34e4ad0f87e9b46209b6749e7304001ca0
<ide><path>doc/api/documentation.md <ide> is a high priority, and will not be broken unless absolutely necessary. <ide> <ide> ```txt <ide> Stability: 3 - Locked <del>Only fixes related to security, performance, or bug fixes will be accepted. <add>Only bug fixes, security fixes, and performance improvements will be accepted. <ide> Please do not suggest API changes in this area; they will be refused. <ide> ``` <ide>
1
PHP
PHP
use define syntax
9a6c3df7a03a1382e2878919b9d1523dfe3ae5e3
<ide><path>database/factories/ModelFactory.php <ide> | <ide> */ <ide> <del>$factory['App\User'] = function ($faker) { <add>$factory->define('App\User', function ($faker) { <ide> return [ <ide> 'name' => $faker->name, <ide> 'email' => $faker->email, <ide> 'password' => str_random(10), <ide> 'remember_token' => str_random(10), <ide> ]; <del>}; <add>});
1
Ruby
Ruby
extract formats_regexp as a method
6c8ea8338584da0891ab29e0c35b5ed22e526ee2
<ide><path>actionpack/lib/action_view/renderer/abstract_renderer.rb <ide> def render <ide> # the lookup context to take this new format into account. <ide> def wrap_formats(value) <ide> return yield unless value.is_a?(String) <del> @@formats_regexp ||= /\.(#{Mime::SET.symbols.join('|')})$/ <ide> <del> if value.sub!(@@formats_regexp, "") <add> if value.sub!(formats_regexp, "") <ide> update_details(:formats => [$1.to_sym]){ yield } <ide> else <ide> yield <ide> end <ide> end <ide> <add> def formats_regexp <add> @@formats_regexp ||= /\.(#{Mime::SET.symbols.join('|')})$/ <add> end <add> <ide> protected <ide> <ide> def instrument(name, options={})
1
Text
Text
modify link for hub and registry
aedf95e640fe362bbf59516ffa77d8bc1629d507
<ide><path>docs/reference/api/hub_registry_spec.md <ide> parent="smn_hub_ref" <ide> # The Docker Hub and the Registry v1 <ide> <ide> This API is deprecated as of 1.7. To view the old version, see the [go <del>here](hub_registry_spec.md) in <add>here](https://docs.docker.com/v1.7/docker/reference/api/hub_registry_spec/) in <ide> the 1.7 documentation. If you want an overview of the current features in <ide> Docker Hub or other image management features see the [image management <ide> overview](../../userguide/eng-image/image_management.md) in the current documentation set.
1
Ruby
Ruby
fix bottle reference
c5bfc932a6f74adcf303e66d88cf814d176318c7
<ide><path>Library/Homebrew/cleanup.rb <ide> def self.cleanup_cache <ide> f.version > version <ide> end <ide> <del> if file_is_stale || ARGV.switch?("s") && !f.installed? || bottle_file_outdated?(f, file) <add> if file_is_stale || ARGV.switch?("s") && !f.installed? || Utils::Bottles::file_outdated?(f, file) <ide> cleanup_path(file) { file.unlink } <ide> end <ide> end
1
PHP
PHP
support closures as values
b3b6f5b1f0797f6c2b43502dda5837e7f245cd54
<ide><path>src/Illuminate/Foundation/Console/AboutCommand.php <ide> protected function displayDetail($data) <ide> foreach ($data as $detail) { <ide> [$label, $value] = $detail; <ide> <del> $this->components->twoColumnDetail($label, $value); <add> $this->components->twoColumnDetail($label, value($value)); <ide> } <ide> }); <ide> } <ide> protected function displayDetail($data) <ide> protected function displayJson($data) <ide> { <ide> $output = $data->flatMap(function ($data, $section) { <del> return [(string) Str::of($section)->snake() => collect($data)->mapWithKeys(fn ($item, $key) => [(string) Str::of($item[0])->lower()->snake() => $item[1]])]; <add> return [(string) Str::of($section)->snake() => collect($data)->mapWithKeys(fn ($item, $key) => [(string) Str::of($item[0])->lower()->snake() => value($item[1])])]; <ide> }); <ide> <ide> $this->output->writeln(strip_tags(json_encode($output)));
1
Java
Java
fix jetty websocket test failures
48875dc44fc019350a3b02bd9d04ade583021523
<ide><path>spring-websocket/src/main/java/org/springframework/web/socket/server/jetty/JettyRequestUpgradeStrategy.java <ide> <ide> package org.springframework.web.socket.server.jetty; <ide> <del>import java.lang.reflect.Method; <ide> import java.lang.reflect.UndeclaredThrowableException; <ide> import java.security.Principal; <ide> import java.util.Collections; <ide> import jakarta.servlet.ServletContext; <ide> import jakarta.servlet.http.HttpServletRequest; <ide> import jakarta.servlet.http.HttpServletResponse; <del>import org.aopalliance.intercept.MethodInterceptor; <del>import org.aopalliance.intercept.MethodInvocation; <add>import org.eclipse.jetty.websocket.server.JettyWebSocketCreator; <add>import org.eclipse.jetty.websocket.server.JettyWebSocketServerContainer; <ide> <del>import org.springframework.aop.framework.ProxyFactory; <del>import org.springframework.aop.target.EmptyTargetSource; <ide> import org.springframework.http.server.ServerHttpRequest; <ide> import org.springframework.http.server.ServerHttpResponse; <ide> import org.springframework.http.server.ServletServerHttpRequest; <ide> import org.springframework.http.server.ServletServerHttpResponse; <del>import org.springframework.lang.NonNull; <ide> import org.springframework.lang.Nullable; <ide> import org.springframework.util.Assert; <del>import org.springframework.util.ReflectionUtils; <ide> import org.springframework.web.socket.WebSocketExtension; <ide> import org.springframework.web.socket.WebSocketHandler; <ide> import org.springframework.web.socket.adapter.jetty.JettyWebSocketHandlerAdapter; <ide> public class JettyRequestUpgradeStrategy implements RequestUpgradeStrategy { <ide> <ide> private static final String[] SUPPORTED_VERSIONS = new String[] { String.valueOf(13) }; <ide> <del> private static final Class<?> webSocketCreatorClass; <del> <del> private static final Method getContainerMethod; <del> <del> private static final Method upgradeMethod; <del> <del> private static final Method setAcceptedSubProtocol; <del> <del> static { <del> // TODO: can switch to non-reflective implementation now <del> <del> ClassLoader loader = JettyRequestUpgradeStrategy.class.getClassLoader(); <del> try { <del> webSocketCreatorClass = loader.loadClass("org.eclipse.jetty.websocket.server.JettyWebSocketCreator"); <del> <del> Class<?> type = loader.loadClass("org.eclipse.jetty.websocket.server.JettyWebSocketServerContainer"); <del> getContainerMethod = type.getMethod("getContainer", ServletContext.class); <del> Method upgrade = ReflectionUtils.findMethod(type, "upgrade", (Class<?>[]) null); <del> Assert.state(upgrade != null, "Upgrade method not found"); <del> upgradeMethod = upgrade; <del> <del> type = loader.loadClass("org.eclipse.jetty.websocket.server.JettyServerUpgradeResponse"); <del> setAcceptedSubProtocol = type.getMethod("setAcceptedSubProtocol", String.class); <del> } <del> catch (Exception ex) { <del> throw new IllegalStateException("No compatible Jetty version found", ex); <del> } <del> } <del> <ide> <ide> @Override <ide> public String[] getSupportedVersions() { <ide> public void upgrade(ServerHttpRequest request, ServerHttpResponse response, <ide> JettyWebSocketSession session = new JettyWebSocketSession(attributes, user); <ide> JettyWebSocketHandlerAdapter handlerAdapter = new JettyWebSocketHandlerAdapter(handler, session); <ide> <add> JettyWebSocketCreator webSocketCreator = (upgradeRequest, upgradeResponse) -> { <add> if (selectedProtocol != null) { <add> upgradeResponse.setAcceptedSubProtocol(selectedProtocol); <add> } <add> return handlerAdapter; <add> }; <add> <add> JettyWebSocketServerContainer container = JettyWebSocketServerContainer.getContainer(servletContext); <add> <ide> try { <del> Object creator = createJettyWebSocketCreator(handlerAdapter, selectedProtocol); <del> Object container = ReflectionUtils.invokeMethod(getContainerMethod, null, servletContext); <del> ReflectionUtils.invokeMethod(upgradeMethod, container, creator, servletRequest, servletResponse); <add> container.upgrade(webSocketCreator, servletRequest, servletResponse); <ide> } <ide> catch (UndeclaredThrowableException ex) { <ide> throw new HandshakeFailureException("Failed to upgrade", ex.getUndeclaredThrowable()); <ide> public void upgrade(ServerHttpRequest request, ServerHttpResponse response, <ide> } <ide> } <ide> <del> private static Object createJettyWebSocketCreator( <del> JettyWebSocketHandlerAdapter adapter, @Nullable String protocol) { <del> <del> ProxyFactory factory = new ProxyFactory(EmptyTargetSource.INSTANCE); <del> factory.addInterface(webSocketCreatorClass); <del> factory.addAdvice(new WebSocketCreatorInterceptor(adapter, protocol)); <del> return factory.getProxy(); <del> } <del> <del> <del> /** <del> * Proxy for a JettyWebSocketCreator to supply the WebSocket handler and set the sub-protocol. <del> */ <del> private static class WebSocketCreatorInterceptor implements MethodInterceptor { <del> <del> private final JettyWebSocketHandlerAdapter adapter; <del> <del> @Nullable <del> private final String protocol; <del> <del> public WebSocketCreatorInterceptor(JettyWebSocketHandlerAdapter adapter, @Nullable String protocol) { <del> this.adapter = adapter; <del> this.protocol = protocol; <del> } <del> <del> @Nullable <del> @Override <del> public Object invoke(@NonNull MethodInvocation invocation) { <del> if (this.protocol != null) { <del> ReflectionUtils.invokeMethod( <del> setAcceptedSubProtocol, invocation.getArguments()[2], this.protocol); <del> } <del> return this.adapter; <del> } <del> } <ide> <ide> } <ide><path>spring-websocket/src/test/java/org/springframework/web/socket/JettyWebSocketTestServer.java <ide> import org.eclipse.jetty.servlet.FilterHolder; <ide> import org.eclipse.jetty.servlet.ServletContextHandler; <ide> import org.eclipse.jetty.servlet.ServletHolder; <add>import org.eclipse.jetty.websocket.server.config.JettyWebSocketServletContainerInitializer; <ide> <ide> import org.springframework.web.context.WebApplicationContext; <ide> import org.springframework.web.servlet.DispatcherServlet; <ide> public void deployConfig(WebApplicationContext wac, Filter... filters) { <ide> ServletHolder servletHolder = new ServletHolder(new DispatcherServlet(wac)); <ide> this.contextHandler = new ServletContextHandler(); <ide> this.contextHandler.addServlet(servletHolder, "/"); <add> this.contextHandler.addServletContainerInitializer(new JettyWebSocketServletContainerInitializer()); <ide> for (Filter filter : filters) { <ide> this.contextHandler.addFilter(new FilterHolder(filter), "/*", getDispatcherTypes()); <ide> }
2
Ruby
Ruby
give respond_to? a symbol
e6f9468e221999e5ea8342f8e72578e1f0a0ec09
<ide><path>activesupport/lib/active_support/number_helper/number_to_currency_converter.rb <ide> def is_negative?(number) <ide> end <ide> <ide> def absolute_value(number) <del> number.respond_to?("abs") ? number.abs : number.sub(/\A-/, '') <add> number.respond_to?(:abs) ? number.abs : number.sub(/\A-/, '') <ide> end <ide> <ide> def options
1
Ruby
Ruby
make `deprecate` work for non-exists methods
59ff1ba30d9f4d34b4d478104cc3f453e553c67a
<ide><path>activesupport/lib/active_support/deprecation/method_wrappers.rb <ide> def deprecate_methods(target_module, *method_names) <ide> options = method_names.extract_options! <ide> deprecator = options.delete(:deprecator) || self <ide> method_names += options.keys <add> mod = Module.new <ide> <ide> method_names.each do |method_name| <del> aliased_method, punctuation = method_name.to_s.sub(/([?!=])$/, ""), $1 <del> with_method = "#{aliased_method}_with_deprecation#{punctuation}" <del> without_method = "#{aliased_method}_without_deprecation#{punctuation}" <add> if target_module.method_defined?(method_name) || target_module.private_method_defined?(method_name) <add> aliased_method, punctuation = method_name.to_s.sub(/([?!=])$/, ""), $1 <add> with_method = "#{aliased_method}_with_deprecation#{punctuation}" <add> without_method = "#{aliased_method}_without_deprecation#{punctuation}" <ide> <del> target_module.send(:define_method, with_method) do |*args, &block| <del> deprecator.deprecation_warning(method_name, options[method_name]) <del> send(without_method, *args, &block) <del> end <add> target_module.send(:define_method, with_method) do |*args, &block| <add> deprecator.deprecation_warning(method_name, options[method_name]) <add> send(without_method, *args, &block) <add> end <ide> <del> target_module.send(:alias_method, without_method, method_name) <del> target_module.send(:alias_method, method_name, with_method) <add> target_module.send(:alias_method, without_method, method_name) <add> target_module.send(:alias_method, method_name, with_method) <ide> <del> case <del> when target_module.protected_method_defined?(without_method) <del> target_module.send(:protected, method_name) <del> when target_module.private_method_defined?(without_method) <del> target_module.send(:private, method_name) <add> case <add> when target_module.protected_method_defined?(without_method) <add> target_module.send(:protected, method_name) <add> when target_module.private_method_defined?(without_method) <add> target_module.send(:private, method_name) <add> end <add> else <add> mod.send(:define_method, method_name) do |*args, &block| <add> deprecator.deprecation_warning(method_name, options[method_name]) <add> super(*args, &block) <add> end <ide> end <ide> end <add> <add> target_module.prepend(mod) unless mod.instance_methods(false).empty? <ide> end <ide> end <ide> end <ide><path>activesupport/test/deprecation_test.rb <ide> def e; end <ide> def f=(v); end <ide> deprecate :f= <ide> <add> deprecate :g <add> def g ;end <add> <ide> module B <ide> C = 1 <ide> end <ide> def test_custom_gem_name <ide> end <ide> end <ide> <add> def test_deprecate_work_before_define_method <add> assert_deprecated { @dtc.g } <add> end <add> <ide> private <ide> def deprecator_with_messages <ide> klass = Class.new(ActiveSupport::Deprecation)
2
Java
Java
ignore path parameters in request mappings
5b1165b1029263ff0020562da95bd30380f303e4
<ide><path>spring-web/src/main/java/org/springframework/web/util/UrlPathHelper.java <ide> protected String determineEncoding(HttpServletRequest request) { <ide> * @return the updated URI string <ide> */ <ide> public String removeSemicolonContent(String requestUri) { <del> if (this.removeSemicolonContent) { <del> return removeSemicolonContentInternal(requestUri); <del> } <del> return removeJsessionid(requestUri); <add> return this.removeSemicolonContent ? <add> removeSemicolonContentInternal(requestUri) : removeJsessionid(requestUri); <ide> } <ide> <ide> private String removeSemicolonContentInternal(String requestUri) { <ide><path>spring-webmvc/src/main/java/org/springframework/web/servlet/config/AnnotationDrivenBeanDefinitionParser.java <ide> public BeanDefinition parse(Element element, ParserContext parserContext) { <ide> handlerMappingDef.setSource(source); <ide> handlerMappingDef.setRole(BeanDefinition.ROLE_INFRASTRUCTURE); <ide> handlerMappingDef.getPropertyValues().add("order", 0); <del> handlerMappingDef.getPropertyValues().add("removeSemicolonContent", false); <ide> handlerMappingDef.getPropertyValues().add("contentNegotiationManager", contentNegotiationManager); <ide> String methodMappingName = parserContext.getReaderContext().registerWithGeneratedName(handlerMappingDef); <ide> <ide><path>spring-webmvc/src/main/java/org/springframework/web/servlet/config/annotation/WebMvcConfigurationSupport.java <ide> public void setApplicationContext(ApplicationContext applicationContext) throws <ide> public RequestMappingHandlerMapping requestMappingHandlerMapping() { <ide> RequestMappingHandlerMapping handlerMapping = new RequestMappingHandlerMapping(); <ide> handlerMapping.setOrder(0); <del> handlerMapping.setRemoveSemicolonContent(false); <ide> handlerMapping.setInterceptors(getInterceptors()); <ide> handlerMapping.setContentNegotiationManager(mvcContentNegotiationManager()); <ide> return handlerMapping; <ide><path>spring-webmvc/src/main/java/org/springframework/web/servlet/handler/AbstractHandlerMapping.java <ide> public void setUrlDecode(boolean urlDecode) { <ide> <ide> /** <ide> * Set if ";" (semicolon) content should be stripped from the request URI. <add> * <p>The default value is {@code false}. <ide> * @see org.springframework.web.util.UrlPathHelper#setRemoveSemicolonContent(boolean) <ide> */ <ide> public void setRemoveSemicolonContent(boolean removeSemicolonContent) { <ide><path>spring-webmvc/src/main/java/org/springframework/web/servlet/handler/AbstractHandlerMethodMapping.java <ide> import org.springframework.web.method.HandlerMethod; <ide> import org.springframework.web.method.HandlerMethodSelector; <ide> import org.springframework.web.servlet.HandlerMapping; <add>import org.springframework.web.util.UrlPathHelper; <ide> <ide> /** <ide> * Abstract base class for {@link HandlerMapping} implementations that define a <ide> private final MultiValueMap<String, T> urlMap = new LinkedMultiValueMap<String, T>(); <ide> <ide> <add> public AbstractHandlerMethodMapping() { <add> UrlPathHelper pathHelper = new UrlPathHelper(); <add> pathHelper.setRemoveSemicolonContent(false); <add> setUrlPathHelper(pathHelper); <add> } <add> <ide> /** <ide> * Whether to detect handler methods in beans in ancestor ApplicationContexts. <ide> * <p>Default is "false": Only beans in the current ApplicationContext are <ide><path>spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/condition/PatternsRequestCondition.java <ide> */ <ide> public final class PatternsRequestCondition extends AbstractRequestCondition<PatternsRequestCondition> { <ide> <add> private static UrlPathHelper pathHelperNoSemicolonContent; <add> <add> static { <add> pathHelperNoSemicolonContent = new UrlPathHelper(); <add> pathHelperNoSemicolonContent.setRemoveSemicolonContent(true); <add> } <add> <ide> private final Set<String> patterns; <ide> <del> private final UrlPathHelper urlPathHelper; <add> private final UrlPathHelper pathHelper; <ide> <ide> private final PathMatcher pathMatcher; <ide> <ide> private PatternsRequestCondition(Collection<String> patterns, UrlPathHelper urlP <ide> List<String> fileExtensions) { <ide> <ide> this.patterns = Collections.unmodifiableSet(prependLeadingSlash(patterns)); <del> this.urlPathHelper = urlPathHelper != null ? urlPathHelper : new UrlPathHelper(); <add> this.pathHelper = urlPathHelper != null ? urlPathHelper : new UrlPathHelper(); <ide> this.pathMatcher = pathMatcher != null ? pathMatcher : new AntPathMatcher(); <ide> this.useSuffixPatternMatch = useSuffixPatternMatch; <ide> this.useTrailingSlashMatch = useTrailingSlashMatch; <ide> else if (!other.patterns.isEmpty()) { <ide> else { <ide> result.add(""); <ide> } <del> return new PatternsRequestCondition(result, this.urlPathHelper, this.pathMatcher, this.useSuffixPatternMatch, <add> return new PatternsRequestCondition(result, this.pathHelper, this.pathMatcher, this.useSuffixPatternMatch, <ide> this.useTrailingSlashMatch, this.fileExtensions); <ide> } <ide> <ide> public PatternsRequestCondition getMatchingCondition(HttpServletRequest request) <ide> if (this.patterns.isEmpty()) { <ide> return this; <ide> } <del> String lookupPath = this.urlPathHelper.getLookupPathForRequest(request); <add> <add> String lookupPath = this.pathHelper.getLookupPathForRequest(request); <add> String lookupPathNoSemicolonContent = (lookupPath.indexOf(';') != -1) ? <add> pathHelperNoSemicolonContent.getLookupPathForRequest(request) : null; <add> <ide> List<String> matches = new ArrayList<String>(); <ide> for (String pattern : patterns) { <ide> String match = getMatchingPattern(pattern, lookupPath); <add> if (match == null && lookupPathNoSemicolonContent != null) { <add> match = getMatchingPattern(pattern, lookupPathNoSemicolonContent); <add> } <ide> if (match != null) { <ide> matches.add(match); <ide> } <ide> } <ide> Collections.sort(matches, this.pathMatcher.getPatternComparator(lookupPath)); <ide> return matches.isEmpty() ? null : <del> new PatternsRequestCondition(matches, this.urlPathHelper, this.pathMatcher, this.useSuffixPatternMatch, <add> new PatternsRequestCondition(matches, this.pathHelper, this.pathMatcher, this.useSuffixPatternMatch, <ide> this.useTrailingSlashMatch, this.fileExtensions); <ide> } <ide> <ide> private String getMatchingPattern(String pattern, String lookupPath) { <ide> return pattern; <ide> } <ide> if (this.useSuffixPatternMatch) { <del> if (useSmartSuffixPatternMatch(pattern, lookupPath)) { <add> if (!this.fileExtensions.isEmpty() && lookupPath.indexOf('.') != -1) { <ide> for (String extension : this.fileExtensions) { <ide> if (this.pathMatcher.match(pattern + extension, lookupPath)) { <ide> return pattern + extension; <ide> private String getMatchingPattern(String pattern, String lookupPath) { <ide> return null; <ide> } <ide> <del> /** <del> * Whether to match by known file extensions. Return "true" if file extensions <del> * are configured, and the lookup path has a suffix. <del> */ <del> private boolean useSmartSuffixPatternMatch(String pattern, String lookupPath) { <del> return (!this.fileExtensions.isEmpty() && lookupPath.indexOf('.') != -1) ; <del> } <del> <ide> /** <ide> * Compare the two conditions based on the URL patterns they contain. <ide> * Patterns are compared one at a time, from top to bottom via <ide> private boolean useSmartSuffixPatternMatch(String pattern, String lookupPath) { <ide> * the best matches on top. <ide> */ <ide> public int compareTo(PatternsRequestCondition other, HttpServletRequest request) { <del> String lookupPath = this.urlPathHelper.getLookupPathForRequest(request); <add> String lookupPath = this.pathHelper.getLookupPathForRequest(request); <ide> Comparator<String> patternComparator = this.pathMatcher.getPatternComparator(lookupPath); <ide> <ide> Iterator<String> iterator = patterns.iterator(); <ide><path>spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/condition/PatternsRequestConditionTests.java <ide> <ide> import org.junit.Test; <ide> import org.springframework.mock.web.test.MockHttpServletRequest; <add>import org.springframework.web.util.UrlPathHelper; <ide> <ide> /** <ide> * @author Rossen Stoyanchev <ide> public void matchPatternContainsExtension() { <ide> assertNull(match); <ide> } <ide> <add> @Test <add> public void matchIgnorePathParams() { <add> UrlPathHelper pathHelper = new UrlPathHelper(); <add> pathHelper.setRemoveSemicolonContent(false); <add> PatternsRequestCondition condition = new PatternsRequestCondition(new String[] {"/foo/bar"}, pathHelper, null, true, true); <add> PatternsRequestCondition match = condition.getMatchingCondition(new MockHttpServletRequest("GET", "/foo;q=1/bar;s=1")); <add> <add> assertNotNull(match); <add> } <add> <ide> @Test <ide> public void compareEqualPatterns() { <ide> PatternsRequestCondition c1 = new PatternsRequestCondition("/foo*"); <ide><path>spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/RequestMappingInfoHandlerMappingTests.java <ide> public void setUp() throws Exception { <ide> <ide> this.handlerMapping = new TestRequestMappingInfoHandlerMapping(); <ide> this.handlerMapping.registerHandler(testController); <del> this.handlerMapping.setRemoveSemicolonContent(false); <ide> } <ide> <ide> @Test
8
Javascript
Javascript
add tests for progress
70d68bcd0af923fdbae4cbacfaf1878adb1597b7
<ide><path>test/ProgressPlugin.test.js <ide> const captureStdio = require("./helpers/captureStdio"); <ide> <ide> let webpack; <ide> <add>const createMultiCompiler = (progressOptions, configOptions) => { <add> const compiler = webpack( <add> Object.assign( <add> [ <add> { <add> context: path.join(__dirname, "fixtures"), <add> entry: "./a.js" <add> }, <add> { <add> context: path.join(__dirname, "fixtures"), <add> entry: "./b.js" <add> } <add> ], <add> configOptions <add> ) <add> ); <add> compiler.outputFileSystem = createFsFromVolume(new Volume()); <add> <add> new webpack.ProgressPlugin(progressOptions).apply(compiler); <add> <add> return compiler; <add>}; <add> <add>const createSimpleCompiler = progressOptions => { <add> const compiler = webpack({ <add> context: path.join(__dirname, "fixtures"), <add> entry: "./a.js", <add> infrastructureLogging: { <add> debug: /Progress/ <add> } <add> }); <add> <add> compiler.outputFileSystem = createFsFromVolume(new Volume()); <add> <add> new webpack.ProgressPlugin({ <add> activeModules: true, <add> ...progressOptions <add> }).apply(compiler); <add> <add> return compiler; <add>}; <add> <add>const createSimpleCompilerWithCustomHandler = options => { <add> const compiler = webpack({ <add> context: path.join(__dirname, "fixtures"), <add> entry: "./a.js" <add> }); <add> <add> compiler.outputFileSystem = createFsFromVolume(new Volume()); <add> const logger = compiler.getInfrastructureLogger("custom test logger"); <add> new webpack.ProgressPlugin({ <add> activeModules: true, <add> ...options, <add> handler: (...args) => logger.status(args) <add> }).apply(compiler); <add> <add> return compiler; <add>}; <add> <add>const getLogs = logsStr => logsStr.split(/\r/).filter(v => !(v === " ")); <add> <add>const RunCompilerAsync = compiler => <add> new Promise((resolve, reject) => { <add> compiler.run(err => { <add> if (err) { <add> reject(err); <add> } else { <add> resolve(); <add> } <add> }); <add> }); <add> <ide> describe("ProgressPlugin", function () { <ide> let stderr; <ide> let stdout; <ide> describe("ProgressPlugin", function () { <ide> stdout && stdout.restore(); <ide> }); <ide> <del> it("should not contain NaN as a percentage when it is applied to MultiCompiler", () => { <del> const compiler = createMultiCompiler(); <add> const nanTest = createCompiler => () => { <add> const compiler = createCompiler(); <ide> <ide> return RunCompilerAsync(compiler).then(() => { <ide> expect(stderr.toString()).toContain("%"); <ide> expect(stderr.toString()).not.toContain("NaN"); <ide> }); <del> }); <add> }; <add> <add> it( <add> "should not contain NaN as a percentage when it is applied to Compiler", <add> nanTest(createSimpleCompiler) <add> ); <add> it( <add> "should not contain NaN as a percentage when it is applied to MultiCompiler", <add> nanTest(createMultiCompiler) <add> ); <add> it( <add> "should not contain NaN as a percentage when it is applied to MultiCompiler (paralellism: 1)", <add> nanTest(() => createMultiCompiler(undefined, { parallelism: 1 })) <add> ); <ide> <ide> it("should print profile information", () => { <ide> const compiler = createSimpleCompiler({ <ide> describe("ProgressPlugin", function () { <ide> }); <ide> }); <ide> <del> it("should have monotonic increasing progress", () => { <add> const monotonicTest = createCompiler => () => { <ide> const handlerCalls = []; <del> const compiler = createSimpleCompiler({ <add> const compiler = createCompiler({ <ide> handler: (p, ...args) => { <ide> handlerCalls.push({ value: p, text: `${p}% ${args.join(" ")}` }); <ide> } <ide> describe("ProgressPlugin", function () { <ide> lastLine = line; <ide> } <ide> }); <del> }); <add> }; <add> <add> it( <add> "should have monotonic increasing progress", <add> monotonicTest(createSimpleCompiler) <add> ); <add> it( <add> "should have monotonic increasing progress (multi compiler)", <add> monotonicTest(createMultiCompiler) <add> ); <add> it( <add> "should have monotonic increasing progress (multi compiler, parallelism)", <add> monotonicTest(o => createMultiCompiler(o, { parallelism: 1 })) <add> ); <ide> <ide> it("should not print lines longer than stderr.columns", () => { <ide> const compiler = createSimpleCompiler(); <ide> describe("ProgressPlugin", function () { <ide> }); <ide> }); <ide> }); <del> <del>const createMultiCompiler = () => { <del> const compiler = webpack([ <del> { <del> context: path.join(__dirname, "fixtures"), <del> entry: "./a.js" <del> }, <del> { <del> context: path.join(__dirname, "fixtures"), <del> entry: "./b.js" <del> } <del> ]); <del> compiler.outputFileSystem = createFsFromVolume(new Volume()); <del> <del> new webpack.ProgressPlugin().apply(compiler); <del> <del> return compiler; <del>}; <del> <del>const createSimpleCompiler = progressOptions => { <del> const compiler = webpack({ <del> context: path.join(__dirname, "fixtures"), <del> entry: "./a.js", <del> infrastructureLogging: { <del> debug: /Progress/ <del> } <del> }); <del> <del> compiler.outputFileSystem = createFsFromVolume(new Volume()); <del> <del> new webpack.ProgressPlugin({ <del> activeModules: true, <del> ...progressOptions <del> }).apply(compiler); <del> <del> return compiler; <del>}; <del> <del>const createSimpleCompilerWithCustomHandler = options => { <del> const compiler = webpack({ <del> context: path.join(__dirname, "fixtures"), <del> entry: "./a.js" <del> }); <del> <del> compiler.outputFileSystem = createFsFromVolume(new Volume()); <del> const logger = compiler.getInfrastructureLogger("custom test logger"); <del> new webpack.ProgressPlugin({ <del> activeModules: true, <del> ...options, <del> handler: (...args) => logger.status(args) <del> }).apply(compiler); <del> <del> return compiler; <del>}; <del> <del>const getLogs = logsStr => logsStr.split(/\r/).filter(v => !(v === " ")); <del> <del>const RunCompilerAsync = compiler => <del> new Promise((resolve, reject) => { <del> compiler.run(err => { <del> if (err) { <del> reject(err); <del> } else { <del> resolve(); <del> } <del> }); <del> });
1
Ruby
Ruby
replace regexp global in #url_for
19e9e67f95aa2f173e73ba11b22370c31b922103
<ide><path>actionpack/lib/action_dispatch/http/url.rb <ide> def url_for(options = {}) <ide> params.reject! { |_,v| v.to_param.nil? } <ide> <ide> result = build_host_url(options) <del> if options[:trailing_slash] && !path.ends_with?('/') <del> result << path.sub(/(\?|\z)/) { "/" + $& } <add> if options[:trailing_slash] <add> if path.include?('?') <add> result << path.sub(/\?/, '/\&') <add> else <add> result << path.sub(/[^\/]\z|\A\z/, '\&/') <add> end <ide> else <ide> result << path <ide> end <ide><path>actionpack/test/dispatch/request_test.rb <ide> def url_for(options = {}) <ide> <ide> assert_equal '/books', url_for(:only_path => true, :path => '/books') <ide> <add> assert_equal 'http://www.example.com/books/?q=code', url_for(trailing_slash: true, path: '/books?q=code') <add> assert_equal 'http://www.example.com/books/?spareslashes=////', url_for(trailing_slash: true, path: '/books?spareslashes=////') <add> <ide> assert_equal 'http://www.example.com', url_for <ide> assert_equal 'http://api.example.com', url_for(:subdomain => 'api') <ide> assert_equal 'http://example.com', url_for(:subdomain => false)
2
Text
Text
add example of using paginator in a view
dae6d093988ef2830e715d17ad6a0b9f715bfeba
<ide><path>docs/api-guide/pagination.md <ide> We can do this using the `object_serializer_class` attribute on the inner `Meta` <ide> class Meta: <ide> object_serializer_class = UserSerializer <ide> <del> queryset = User.objects.all() <del> paginator = Paginator(queryset, 20) <del> page = paginator.page(1) <del> serializer = PaginatedUserSerializer(instance=page) <del> serializer.data <del> # {'count': 1, 'next': None, 'previous': None, 'results': [{'username': u'admin', 'email': u'admin@example.com'}]} <add>We could now use our pagination serializer in a view like this. <add> <add> @api_view('GET') <add> def user_list(request): <add> queryset = User.objects.all() <add> paginator = Paginator(queryset, 20) <add> <add> page = request.QUERY_PARAMS.get('page') <add> try: <add> users = paginator.page(page) <add> except PageNotAnInteger: <add> # If page is not an integer, deliver first page. <add> users = paginator.page(1) <add> except EmptyPage: <add> # If page is out of range (e.g. 9999), deliver last page of results. <add> users = paginator.page(paginator.num_pages) <add> <add> serializer_context = {'request': request} <add> serializer = PaginatedUserSerializer(instance=users, <add> context=serializer_context) <add> return Response(serializer.data) <ide> <ide> ## Pagination in the generic views <ide> <ide> The generic class based views `ListAPIView` and `ListCreateAPIView` provide pagination of the returned querysets by default. You can customise this behaviour by altering the pagination style, by modifying the default number of results, or by turning pagination off completely. <ide> <del>## Setting the default pagination style <del> <ide> The default pagination style may be set globally, using the `PAGINATION_SERIALIZER` and `PAGINATE_BY` settings. For example. <ide> <ide> REST_FRAMEWORK = {
1
PHP
PHP
remove coding standards ignores
4a9186829c972a4245d7c45bf69b4be9261b2501
<ide><path>src/View/Helper/UrlHelper.php <ide> public function assetTimestamp($path) <ide> ); <ide> $webrootPath = WWW_ROOT . str_replace('/', DIRECTORY_SEPARATOR, $filepath); <ide> if (file_exists($webrootPath)) { <del> //@codingStandardsIgnoreStart <ide> return $path . '?' . filemtime($webrootPath); <del> //@codingStandardsIgnoreEnd <ide> } <ide> $segments = explode('/', ltrim($filepath, '/')); <ide> $plugin = Inflector::camelize($segments[0]); <ide> if (Plugin::loaded($plugin)) { <ide> unset($segments[0]); <ide> $pluginPath = Plugin::path($plugin) . 'webroot' . DIRECTORY_SEPARATOR . implode(DIRECTORY_SEPARATOR, $segments); <ide> if (file_exists($pluginPath)) { <del> //@codingStandardsIgnoreStart <ide> return $path . '?' . filemtime($pluginPath); <del> //@codingStandardsIgnoreEnd4 <ide> } <ide> } <ide> }
1
Python
Python
fix openstack v3 authentication
eb497fa92287623fcc81413ae4775543b7ff8e71
<ide><path>libcloud/common/openstack.py <ide> class OpenStackBaseConnection(ConnectionUserAndKey): <ide> ex_force_base_url must also be provided. <ide> :type ex_force_auth_token: ``str`` <ide> <add> :param token_scope: Whether to scope a token to a "project", a <add> "domain" or "unscoped". <add> :type token_scope: ``str`` <add> <add> :param ex_domain_name: When authenticating, provide this domain name to <add> the identity service. A scoped token will be <add> returned. Some cloud providers require the domain <add> name to be provided at authentication time. Others <add> will use a default domain if none is provided. <add> :type ex_domain_name: ``str`` <add> <ide> :param ex_tenant_name: When authenticating, provide this tenant name to the <ide> identity service. A scoped token will be returned. <ide> Some cloud providers require the tenant name to be <ide> def __init__(self, user_id, key, secure=True, <ide> ex_force_auth_url=None, <ide> ex_force_auth_version=None, <ide> ex_force_auth_token=None, <add> ex_token_scope=None, <add> ex_domain_name=None, <ide> ex_tenant_name=None, <ide> ex_force_service_type=None, <ide> ex_force_service_name=None, <ide> def __init__(self, user_id, key, secure=True, <ide> self._ex_force_base_url = ex_force_base_url <ide> self._ex_force_auth_url = ex_force_auth_url <ide> self._ex_force_auth_token = ex_force_auth_token <add> self._ex_token_scope = ex_token_scope <add> self._ex_domain_name = ex_domain_name <ide> self._ex_tenant_name = ex_tenant_name <ide> self._ex_force_service_type = ex_force_service_type <ide> self._ex_force_service_name = ex_force_service_name <ide> def get_auth_class(self): <ide> user_id=self.user_id, <ide> key=self.key, <ide> tenant_name=self._ex_tenant_name, <add> domain_name=self._ex_domain_name, <add> token_scope=self._ex_token_scope, <ide> timeout=self.timeout, <ide> parent_conn=self) <ide> <ide> def __init__(self, *args, **kwargs): <ide> self._ex_force_auth_url = kwargs.get('ex_force_auth_url', None) <ide> self._ex_force_auth_version = kwargs.get('ex_force_auth_version', None) <ide> self._ex_force_auth_token = kwargs.get('ex_force_auth_token', None) <add> self._ex_token_scope = kwargs.get('ex_token_scope', None) <add> self._ex_domain_name = kwargs.get('ex_domain_name', None) <ide> self._ex_tenant_name = kwargs.get('ex_tenant_name', None) <ide> self._ex_force_service_type = kwargs.get('ex_force_service_type', None) <ide> self._ex_force_service_name = kwargs.get('ex_force_service_name', None) <ide> def openstack_connection_kwargs(self): <ide> rv['ex_force_auth_url'] = self._ex_force_auth_url <ide> if self._ex_force_auth_version: <ide> rv['ex_force_auth_version'] = self._ex_force_auth_version <add> if self._ex_token_scope: <add> rv['ex_token_scope'] = self._ex_token_scope <add> if self._ex_domain_name: <add> rv['ex_domain_name'] = self._ex_domain_name <ide> if self._ex_tenant_name: <ide> rv['ex_tenant_name'] = self._ex_tenant_name <ide> if self._ex_force_service_type: <ide><path>libcloud/common/openstack_identity.py <ide> class OpenStackIdentityConnection(ConnectionUserAndKey): <ide> auth_version = None <ide> <ide> def __init__(self, auth_url, user_id, key, tenant_name=None, <add> domain_name=None, token_scope=None, <ide> timeout=None, parent_conn=None): <ide> super(OpenStackIdentityConnection, self).__init__(user_id=user_id, <ide> key=key, <ide> url=auth_url, <ide> timeout=timeout) <ide> <del> self.auth_url = auth_url <del> self.tenant_name = tenant_name <ide> self.parent_conn = parent_conn <ide> <ide> # enable tests to use the same mock connection classes. <ide> def __init__(self, auth_url, user_id, key, tenant_name=None, <ide> <ide> self.auth_url = auth_url <ide> self.tenant_name = tenant_name <add> self.domain_name = domain_name if domain_name is not None else \ <add> 'Default' <add> self.token_scope = token_scope if token_scope is not None else \ <add> OpenStackIdentityTokenScope.PROJECT <ide> self.timeout = timeout <ide> <ide> self.urls = {} <ide> class OpenStackIdentity_3_0_Connection(OpenStackIdentityConnection): <ide> ] <ide> <ide> def __init__(self, auth_url, user_id, key, tenant_name=None, <del> domain_name='Default', <del> token_scope=OpenStackIdentityTokenScope.PROJECT, <add> domain_name=None, token_scope=None, <ide> timeout=None, parent_conn=None): <ide> """ <ide> :param tenant_name: Name of the project this user belongs to. Note: <ide> def __init__(self, auth_url, user_id, key, tenant_name=None, <ide> domain to scope the token to. <ide> :type domain_name: ``str`` <ide> <del> :param token_scope: Whether to scope a token to a "project" or a <del> "domain" <add> :param token_scope: Whether to scope a token to a "project", a <add> "domain" or "unscoped" <ide> :type token_scope: ``str`` <ide> """ <ide> super(OpenStackIdentity_3_0_Connection, <ide> self).__init__(auth_url=auth_url, <ide> user_id=user_id, <ide> key=key, <ide> tenant_name=tenant_name, <add> domain_name=domain_name, <add> token_scope=token_scope, <ide> timeout=timeout, <ide> parent_conn=parent_conn) <del> if token_scope not in self.VALID_TOKEN_SCOPES: <add> <add> if self.token_scope not in self.VALID_TOKEN_SCOPES: <ide> raise ValueError('Invalid value for "token_scope" argument: %s' % <del> (token_scope)) <add> (self.token_scope)) <ide> <del> if (token_scope == OpenStackIdentityTokenScope.PROJECT and <del> (not tenant_name or not domain_name)): <add> if (self.token_scope == OpenStackIdentityTokenScope.PROJECT and <add> (not self.tenant_name or not self.domain_name)): <ide> raise ValueError('Must provide tenant_name and domain_name ' <ide> 'argument') <del> elif (token_scope == OpenStackIdentityTokenScope.DOMAIN and <del> not domain_name): <del> raise ValueError('Must provide domain_name argument') <ide> <del> self.tenant_name = tenant_name <del> self.domain_name = domain_name <del> self.token_scope = token_scope <ide> self.auth_user_roles = None <ide> <ide> def authenticate(self, force=False): <ide><path>libcloud/test/common/test_openstack_identity.py <ide> def test_token_scope_argument(self): <ide> key='test', <ide> token_scope='project') <ide> <del> # Missing domain_name <del> expected_msg = 'Must provide domain_name argument' <del> self.assertRaisesRegexp(ValueError, expected_msg, <del> OpenStackIdentity_3_0_Connection, <del> auth_url='http://none', <del> user_id='test', <del> key='test', <del> token_scope='domain', <del> domain_name=None) <del> <ide> # Scope to project all ok <ide> OpenStackIdentity_3_0_Connection(auth_url='http://none', <ide> user_id='test', <ide> def test_token_scope_argument(self): <ide> tenant_name=None, <ide> domain_name='Default') <ide> <add> def test_authenticate(self): <add> auth = OpenStackIdentity_3_0_Connection(auth_url='http://none', <add> user_id='test_user_id', <add> key='test_key', <add> token_scope='project', <add> tenant_name="test_tenant", <add> domain_name='test_domain') <add> auth.authenticate() <add> <ide> def test_list_supported_versions(self): <ide> OpenStackIdentity_3_0_MockHttp.type = 'v3' <ide> <ide> def _v3_projects(self, method, url, body, headers): <ide> return (httplib.OK, body, self.json_content_headers, httplib.responses[httplib.OK]) <ide> raise NotImplementedError() <ide> <add> def _v3_auth_tokens(self, method, url, body, headers): <add> if method == 'POST': <add> status = httplib.OK <add> data = json.loads(body) <add> if data['auth']['identity']['password']['user']['domain']['name'] != 'test_domain' or \ <add> data['auth']['scope']['project']['domain']['name'] != 'test_domain': <add> status = httplib.UNAUTHORIZED <add> <add> body = ComputeFileFixtures('openstack').load('_v3__auth.json') <add> headers = self.json_content_headers.copy() <add> headers['x-subject-token'] = '00000000000000000000000000000000' <add> return (status, body, headers, httplib.responses[httplib.OK]) <add> raise NotImplementedError() <add> <ide> def _v3_users(self, method, url, body, headers): <ide> if method == 'GET': <ide> # list users
3
Python
Python
fix doc of seterrcall. issue
f304b48296f679e5605210fc19f36fa43e569927
<ide><path>numpy/core/numeric.py <ide> def seterrcall(func): <ide> Function to call upon floating-point errors ('call'-mode) or <ide> object whose 'write' method is used to log such message ('log'-mode). <ide> <del> The call function takes two arguments. The first is the <del> type of error (one of "divide", "over", "under", or "invalid"), <del> and the second is the status flag. The flag is a byte, whose <del> least-significant bits indicate the status:: <add> The call function takes two arguments. The first is a string describing the <add> type of error (such as "divide by zero", "overflow", "underflow", or "invalid value"), <add> and the second is the status flag. The flag is a byte, whose four <add> least-significant bits indicate the type of error, one of "divide", "over", <add> "under", "invalid":: <ide> <del> [0 0 0 0 invalid over under invalid] <add> [0 0 0 0 divide over under invalid] <ide> <ide> In other words, ``flags = divide + 2*over + 4*under + 8*invalid``. <ide>
1
PHP
PHP
add "logs" driver to the `about` command
c9483ef91971b366003a4d3ee48c9dd6d35f5d4e
<ide><path>src/Illuminate/Foundation/Console/AboutCommand.php <ide> protected function gatherApplicationInformation() <ide> 'Views' => $this->hasPhpFiles($this->laravel->storagePath('framework/views')) ? '<fg=green;options=bold>CACHED</>' : '<fg=yellow;options=bold>NOT CACHED</>', <ide> ]); <ide> <add> $logChannel = config('logging.default'); <add> $logChannelDriver = config('logging.channels.'.$logChannel.'.driver'); <add> <add> if ($logChannelDriver === 'stack') { <add> $secondary = collect(config('logging.channels.'.$logChannel.'.channels')) <add> ->implode(', '); <add> <add> $logs = '<fg=yellow;options=bold>'.$logChannel.'</> <fg=gray;options=bold>/</> '.$secondary; <add> } else { <add> $logs = $logChannel; <add> } <add> <ide> static::add('Drivers', array_filter([ <ide> 'Broadcasting' => config('broadcasting.default'), <ide> 'Cache' => config('cache.default'), <ide> 'Database' => config('database.default'), <add> 'Logs' => $logs, <ide> 'Mail' => config('mail.default'), <ide> 'Octane' => config('octane.server'), <ide> 'Queue' => config('queue.default'),
1
Javascript
Javascript
fix links for open in colab
06bc347c9795149b89b803e4909cce9a803b3907
<ide><path>docs/source/_static/js/custom.js <ide> function addColabLink() { <ide> const pageName = parts[parts.length - 1].split(".")[0]; <ide> <ide> if (hasNotebook.includes(pageName)) { <add> const baseURL = "https://colab.research.google.com/github/huggingface/notebooks/blob/master/transformers_doc/" <ide> const linksColab = ` <ide> <div class="colab-dropdown"> <ide> <img alt="Open In Colab" src="https://colab.research.google.com/assets/colab-badge.svg"> <ide> <div class="colab-dropdown-content"> <del> <button onclick=" window.open('https://colab.research.google.com/github/sgugger/test_nbs/blob/master/${pageName}.ipynb')">Mixed</button> <del> <button onclick=" window.open('https://colab.research.google.com/github/sgugger/test_nbs/blob/master/pytorch/${pageName}.ipynb')">PyTorch</button> <del> <button onclick=" window.open('https://colab.research.google.com/github/sgugger/test_nbs/blob/master/tensorflow/${pageName}.ipynb')">TensorFlow</button> <add> <button onclick=" window.open('${baseURL}${pageName}.ipynb')">Mixed</button> <add> <button onclick=" window.open('${baseURL}pytorch/${pageName}.ipynb')">PyTorch</button> <add> <button onclick=" window.open('${baseURL}tensorflow/${pageName}.ipynb')">TensorFlow</button> <ide> </div> <ide> </div>` <ide> const leftMenu = document.querySelector(".wy-breadcrumbs-aside")
1
Ruby
Ruby
fix various bugs with console arguments
cdd6d9b53ad68ac9de0a5d9293aa9ab445a901b2
<ide><path>railties/lib/rails/commands.rb <ide> <ide> when 'console' <ide> require 'rails/commands/console' <add> options = Rails::Console.parse_arguments(ARGV) <add> <add> # RAILS_ENV needs to be set before config/application is required <add> ENV['RAILS_ENV'] = options[:environment] if options[:environment] <add> <add> # shift ARGV so IRB doesn't freak <add> ARGV.shift if ARGV.first && ARGV.first[0] != '-' <add> <ide> require APP_PATH <ide> Rails.application.require_environment! <del> Rails::Console.start(Rails.application) <add> Rails::Console.start(Rails.application, options) <ide> <ide> when 'server' <ide> # Change to the application's path if there is no config.ru file in current dir. <ide><path>railties/lib/rails/commands/console.rb <ide> <ide> module Rails <ide> class Console <del> attr_reader :options, :app, :console, :arguments <del> <del> def self.start(*args) <del> new(*args).start <del> end <del> <del> def initialize(app, arguments = ARGV) <del> @app = app <del> @arguments = arguments <del> app.load_console <del> @console = app.config.console || IRB <del> end <add> class << self <add> def start(*args) <add> new(*args).start <add> end <ide> <del> def options <del> @options ||= begin <add> def parse_arguments(arguments) <ide> options = {} <ide> <ide> OptionParser.new do |opt| <ide> def options <ide> opt.parse!(arguments) <ide> end <ide> <add> if arguments.first && arguments.first[0] != '-' <add> env = arguments.first <add> options[:environment] = %w(production development test).detect {|e| e =~ /^#{env}/} || env <add> end <add> <ide> options <ide> end <ide> end <ide> <add> attr_reader :options, :app, :console <add> <add> def initialize(app, options={}) <add> @app = app <add> @options = options <add> app.load_console <add> @console = app.config.console || IRB <add> end <add> <ide> def sandbox? <ide> options[:sandbox] <ide> end <ide> <add> def environment <add> options[:environment] ||= ENV['RAILS_ENV'] || 'development' <add> end <add> <ide> def environment? <del> options[:environment] <add> environment <ide> end <ide> <ide> def set_environment! <del> Rails.env = options[:environment] <add> Rails.env = environment <ide> end <ide> <ide> def debugger? <ide> def debugger? <ide> <ide> def start <ide> app.sandbox = sandbox? <del> <ide> require_debugger if debugger? <del> <ide> set_environment! if environment? <ide> <ide> if sandbox? <ide> def require_debugger <ide> end <ide> end <ide> end <del> <del># Has to set the RAILS_ENV before config/application is required <del>if ARGV.first && !ARGV.first.index("-") && env = ARGV.shift # has to shift the env ARGV so IRB doesn't freak <del> ENV['RAILS_ENV'] = %w(production development test).detect {|e| e =~ /^#{env}/} || env <del>end <ide><path>railties/lib/rails/commands/dbconsole.rb <ide> <ide> module Rails <ide> class DBConsole <del> attr_reader :arguments, :config <del> <add> attr_reader :config, :arguments <add> <ide> def self.start <del> new(config).start <add> new.start <ide> end <ide> <del> def self.config <del> config = begin <del> YAML.load(ERB.new(IO.read("config/database.yml")).result) <del> rescue SyntaxError, StandardError <del> require APP_PATH <del> Rails.application.config.database_configuration <del> end <del> <del> unless config[env] <del> abort "No database is configured for the environment '#{env}'" <del> end <del> <del> config[env] <del> end <del> <del> def self.env <del> if Rails.respond_to?(:env) <del> Rails.env <del> else <del> ENV["RAILS_ENV"] || ENV["RACK_ENV"] || "development" <del> end <del> end <del> <del> def initialize(config, arguments = ARGV) <del> @config, @arguments = config, arguments <add> def initialize(arguments = ARGV) <add> @arguments = arguments <ide> end <ide> <ide> def start <del> include_password = false <del> options = {} <del> OptionParser.new do |opt| <del> opt.banner = "Usage: rails dbconsole [environment] [options]" <del> opt.on("-p", "--include-password", "Automatically provide the password from database.yml") do |v| <del> include_password = true <del> end <del> <del> opt.on("--mode [MODE]", ['html', 'list', 'line', 'column'], <del> "Automatically put the sqlite3 database in the specified mode (html, list, line, column).") do |mode| <del> options['mode'] = mode <del> end <del> <del> opt.on("--header") do |h| <del> options['header'] = h <del> end <del> <del> opt.on("-h", "--help", "Show this help message.") do <del> puts opt <del> exit <del> end <del> <del> opt.parse!(arguments) <del> abort opt.to_s unless (0..1).include?(arguments.size) <del> end <del> <add> options = parse_arguments(arguments) <add> ENV['RAILS_ENV'] = options[:environment] || environment <ide> <ide> case config["adapter"] <ide> when /^mysql/ <ide> def start <ide> 'encoding' => '--default-character-set' <ide> }.map { |opt, arg| "#{arg}=#{config[opt]}" if config[opt] }.compact <ide> <del> if config['password'] && include_password <add> if config['password'] && options['include_password'] <ide> args << "--password=#{config['password']}" <ide> elsif config['password'] && !config['password'].to_s.empty? <ide> args << "-p" <ide> def start <ide> ENV['PGUSER'] = config["username"] if config["username"] <ide> ENV['PGHOST'] = config["host"] if config["host"] <ide> ENV['PGPORT'] = config["port"].to_s if config["port"] <del> ENV['PGPASSWORD'] = config["password"].to_s if config["password"] && include_password <add> ENV['PGPASSWORD'] = config["password"].to_s if config["password"] && options['include_password'] <ide> find_cmd_and_exec('psql', config["database"]) <ide> <ide> when "sqlite" <ide> def start <ide> <ide> if config['username'] <ide> logon = config['username'] <del> logon << "/#{config['password']}" if config['password'] && include_password <add> logon << "/#{config['password']}" if config['password'] && options['include_password'] <ide> logon << "@#{config['database']}" if config['database'] <ide> end <ide> <ide> def start <ide> end <ide> end <ide> <add> def config <add> @config ||= begin <add> cfg = begin <add> cfg = YAML.load(ERB.new(IO.read("config/database.yml")).result) <add> rescue SyntaxError, StandardError <add> require APP_PATH <add> Rails.application.config.database_configuration <add> end <add> <add> unless cfg[environment] <add> abort "No database is configured for the environment '#{environment}'" <add> end <add> <add> cfg[environment] <add> end <add> end <add> <add> def environment <add> if Rails.respond_to?(:env) <add> Rails.env <add> else <add> ENV["RAILS_ENV"] || ENV["RACK_ENV"] || "development" <add> end <add> end <add> <ide> protected <ide> <add> def parse_arguments(arguments) <add> options = {} <add> <add> OptionParser.new do |opt| <add> opt.banner = "Usage: rails dbconsole [environment] [options]" <add> opt.on("-p", "--include-password", "Automatically provide the password from database.yml") do |v| <add> options['include_password'] = true <add> end <add> <add> opt.on("--mode [MODE]", ['html', 'list', 'line', 'column'], <add> "Automatically put the sqlite3 database in the specified mode (html, list, line, column).") do |mode| <add> options['mode'] = mode <add> end <add> <add> opt.on("--header") do |h| <add> options['header'] = h <add> end <add> <add> opt.on("-h", "--help", "Show this help message.") do <add> puts opt <add> exit <add> end <add> <add> opt.on("-e", "--environment=name", String, <add> "Specifies the environment to run this console under (test/development/production).", <add> "Default: development" <add> ) { |v| options[:environment] = v.strip } <add> <add> opt.parse!(arguments) <add> abort opt.to_s unless (0..1).include?(arguments.size) <add> end <add> <add> if arguments.first && arguments.first[0] != '-' <add> env = arguments.first <add> options[:environment] = %w(production development test).detect {|e| e =~ /^#{env}/} || env <add> end <add> <add> options <add> end <add> <ide> def find_cmd_and_exec(commands, *args) <ide> commands = Array(commands) <ide> <ide> def find_cmd_and_exec(commands, *args) <ide> end <ide> end <ide> end <del> <del># Has to set the RAILS_ENV before config/application is required <del>if ARGV.first && !ARGV.first.index("-") && env = ARGV.first <del> ENV['RAILS_ENV'] = %w(production development test).detect {|e| e =~ /^#{env}/} || env <del>end <ide><path>railties/test/commands/console_test.rb <ide> <ide> class Rails::ConsoleTest < ActiveSupport::TestCase <ide> class FakeConsole <add> def self.start; end <ide> end <ide> <ide> def setup <ide> end <ide> <ide> def test_sandbox_option <del> console = Rails::Console.new(app, ["--sandbox"]) <add> console = Rails::Console.new(app, parse_arguments(["--sandbox"])) <ide> assert console.sandbox? <ide> end <ide> <ide> def test_short_version_of_sandbox_option <del> console = Rails::Console.new(app, ["-s"]) <add> console = Rails::Console.new(app, parse_arguments(["-s"])) <ide> assert console.sandbox? <ide> end <ide> <ide> def test_debugger_option <del> console = Rails::Console.new(app, ["--debugger"]) <add> console = Rails::Console.new(app, parse_arguments(["--debugger"])) <ide> assert console.debugger? <ide> end <ide> <ide> def test_no_options <del> console = Rails::Console.new(app, []) <add> console = Rails::Console.new(app, parse_arguments([])) <ide> assert !console.debugger? <ide> assert !console.sandbox? <ide> end <ide> <ide> def test_start <del> app.expects(:sandbox=).with(nil) <ide> FakeConsole.expects(:start) <del> <ide> start <del> <ide> assert_match(/Loading \w+ environment \(Rails/, output) <ide> end <ide> <ide> def test_start_with_debugger <del> app.expects(:sandbox=).with(nil) <add> rails_console = Rails::Console.new(app, parse_arguments(["--debugger"])) <ide> rails_console.expects(:require_debugger).returns(nil) <del> FakeConsole.expects(:start) <ide> <del> start ["--debugger"] <add> silence_stream(STDOUT) { rails_console.start } <ide> end <ide> <ide> def test_start_with_sandbox <ide> def test_start_with_sandbox <ide> end <ide> <ide> def test_console_with_environment <del> app.expects(:sandbox=).with(nil) <del> FakeConsole.expects(:start) <del> <ide> start ["-e production"] <add> assert_match(/\sproduction\s/, output) <add> end <add> <add> def test_console_defaults_to_IRB <add> config = mock("config", :console => nil) <add> app = mock("app", :config => config) <add> app.expects(:load_console).returns(nil) <ide> <del> assert_match(/production/, output) <add> assert_equal IRB, Rails::Console.new(app).console <ide> end <ide> <del> def test_console_with_rails_environment <del> app.expects(:sandbox=).with(nil) <del> FakeConsole.expects(:start) <add> def test_default_environment_with_no_rails_env <add> with_rails_env nil do <add> start <add> assert_match /\sdevelopment\s/, output <add> end <add> end <ide> <del> start ["RAILS_ENV=production"] <add> def test_default_environment_with_rails_env <add> with_rails_env 'special-production' do <add> start <add> assert_match /\sspecial-production\s/, output <add> end <add> end <add> <add> def test_e_option <add> start ['-e', 'special-production'] <add> assert_match /\sspecial-production\s/, output <add> end <ide> <del> assert_match(/production/, output) <add> def test_environment_option <add> start ['--environment=special-production'] <add> assert_match /\sspecial-production\s/, output <ide> end <ide> <add> def test_rails_env_is_production_when_first_argument_is_p <add> start ['p'] <add> assert_match /\sproduction\s/, output <add> end <ide> <del> def test_console_defaults_to_IRB <del> config = mock("config", :console => nil) <del> app = mock("app", :config => config) <del> app.expects(:load_console).returns(nil) <add> def test_rails_env_is_test_when_first_argument_is_t <add> start ['t'] <add> assert_match /\stest\s/, output <add> end <ide> <del> assert_equal IRB, Rails::Console.new(app).console <add> def test_rails_env_is_development_when_argument_is_d <add> start ['d'] <add> assert_match /\sdevelopment\s/, output <ide> end <ide> <ide> private <ide> <ide> attr_reader :output <ide> <del> def rails_console <del> @rails_console ||= Rails::Console.new(app) <del> end <del> <ide> def start(argv = []) <del> rails_console.stubs(:arguments => argv) <add> rails_console = Rails::Console.new(app, parse_arguments(argv)) <ide> @output = output = capture(:stdout) { rails_console.start } <ide> end <ide> <ide> def app <ide> @app ||= begin <ide> config = mock("config", :console => FakeConsole) <ide> app = mock("app", :config => config) <add> app.stubs(:sandbox=).returns(nil) <ide> app.expects(:load_console) <ide> app <ide> end <ide> end <add> <add> def parse_arguments(args) <add> Rails::Console.parse_arguments(args) <add> end <add> <add> def with_rails_env(env) <add> original_rails_env = ENV['RAILS_ENV'] <add> ENV['RAILS_ENV'] = env <add> yield <add> ensure <add> ENV['RAILS_ENV'] = original_rails_env <add> end <ide> end <ide><path>railties/test/commands/dbconsole_test.rb <ide> def test_config <ide> Rails::DBConsole.const_set(:APP_PATH, "erb") <ide> <ide> app_config({}) <del> capture_abort { Rails::DBConsole.config } <add> capture_abort { Rails::DBConsole.new.config } <ide> assert aborted <ide> assert_match(/No database is configured for the environment '\w+'/, output) <ide> <ide> app_config(test: "with_init") <del> assert_equal Rails::DBConsole.config, "with_init" <add> assert_equal Rails::DBConsole.new.config, "with_init" <ide> <ide> app_db_file("test:\n without_init") <del> assert_equal Rails::DBConsole.config, "without_init" <add> assert_equal Rails::DBConsole.new.config, "without_init" <ide> <ide> app_db_file("test:\n <%= Rails.something_app_specific %>") <del> assert_equal Rails::DBConsole.config, "with_init" <add> assert_equal Rails::DBConsole.new.config, "with_init" <ide> <ide> app_db_file("test:\n\ninvalid") <del> assert_equal Rails::DBConsole.config, "with_init" <add> assert_equal Rails::DBConsole.new.config, "with_init" <ide> end <ide> <ide> def test_env <del> assert_equal Rails::DBConsole.env, "test" <add> assert_equal Rails::DBConsole.new.environment, "test" <add> <add> ENV['RAILS_ENV'] = nil <ide> <ide> Rails.stubs(:respond_to?).with(:env).returns(false) <del> assert_equal Rails::DBConsole.env, "test" <add> assert_equal Rails::DBConsole.new.environment, "development" <ide> <del> ENV['RAILS_ENV'] = nil <ide> ENV['RACK_ENV'] = "rack_env" <del> assert_equal Rails::DBConsole.env, "rack_env" <add> assert_equal Rails::DBConsole.new.environment, "rack_env" <ide> <ide> ENV['RAILS_ENV'] = "rails_env" <del> assert_equal Rails::DBConsole.env, "rails_env" <add> assert_equal Rails::DBConsole.new.environment, "rails_env" <ide> ensure <ide> ENV['RAILS_ENV'] = "test" <ide> end
5
Text
Text
add "designing state" section
3e6efd5fce0d06f18ec2b1cfc601baa3f7ccf39e
<ide><path>docs/tutorials/fundamentals/part-3-state-reducers-actions.md <ide> import { DetailedExplanation } from '../../components/DetailedExplanation' <ide> <ide> # Redux Fundamentals, Part 3: State, Reducers, and Actions <ide> <del>**TODO** Write this <add>:::tip What You'll Learn <add> <add>- How to define state values that contain your app's data <add>- How to define action objects that describe what happens in your app <add>- How to write reducer functions that calculate updated state based on existing state and actions <add> <add>::: <add> <add>:::info Prerequisites <add> <add>- Familiarity with key Redux terms and concepts like "actions", "reducers", "store", and "dispatching". (See **[Part 2](./part-2-concepts-data-flow.md)** for explanations of these terms.) <add> <add>::: <add> <add>## Introduction <add> <add>In [Part 2: Redux Concepts and Data Flow](./part-2-concepts-data-flow.md), we looked at how Redux can help us build maintainable apps by giving us a single central place to put global app state. We also talked about core Redux concepts like dispatching action objects and using reducer functions that return new state values. <add> <add>Now that you have some idea of what these pieces are, it's time to put that knowledge into practice. We're going to build a small example app to see how these pieces actually work together. <add> <add>:::caution <add> <add>The example app is not meant as a complete production-ready project. The goal is to help you learn core Redux APIs and usage patterns, and point you in the right direction using some limited examples. Also, some of the early pieces we build will be updated later on to show better ways to do things. Please read through the whole tutorial to see all the concepts in use. <add> <add>::: <add> <add>### Project Setup <add> <add>For this tutorial, we've created a pre-configured starter project that already has React and Redux set up, includes some default styling, and has a fake REST API that will allow us to write actual API requests in our app. You'll use this as the basis for writing the actual application code. <add> <add>To get started, you can open and fork this CodeSandbox: <add> <add>**TODO** Create actual example app, repo, and CodeSandbox <add> <add><!-- <add><iframe <add> class="codesandbox" <add> src="https://codesandbox.io/embed/github/reduxjs/redux-essentials-example-app/tree/master/?fontsize=14&hidenavigation=1&theme=dark" <add> title="redux-quick-start-example-app" <add> allow="geolocation; microphone; camera; midi; vr; accelerometer; gyroscope; payment; ambient-light-sensor; encrypted-media; usb" <add> sandbox="allow-modals allow-forms allow-popups allow-scripts allow-same-origin" <add>></iframe> <add>--> <add> <add>You can also [clone the same project from this Github repo **TODO CREATE NEW EXAMPLE REPO**](.). After cloning the repo, you can install the tools for the project with `npm install`, and start it with `npm start`. <add> <add><!-- <add> <add>If you'd like to see the final version of what we're going to build, you can check out [the **`tutorial-steps` branch**](https://github.com/reduxjs/redux-essentials-example-app/tree/tutorial-steps), or [look at the final version in this CodeSandbox](https://codesandbox.io/s/github/reduxjs/redux-essentials-example-app/tree/tutorial-steps). <add> <add>--> <add> <add>#### Creating a New Redux + React Project <add> <add>Once you've finished this tutorial, you'll probably want to try working on your own projects. **We recommend using the [Redux templates for Create-React-App](https://github.com/reduxjs/cra-template-redux) as the fastest way to create a new Redux + React project**. It comes with Redux Toolkit and React-Redux already configured, using [a modernized version of the "counter" app example you saw in Part 1](./part-1-overview.md). This lets you jump right into writing your actual application code without having to add the Redux packages and set up the store. <add> <add>If you want to know specific details on how to add Redux to a project, see this explanation: <add> <add><DetailedExplanation title="Detailed Explanation: Adding Redux to a React Project"> <add> <add>The Redux template for CRA comes with Redux Toolkit and React-Redux already configured. If you're setting up a new project from scratch without that template, follow these steps: <add> <add>- Add the `@reduxjs/toolkit` and `react-redux` packages <add>- Create a Redux store using RTK's `configureStore` API, and pass in at least one reducer function <add>- Import the Redux store into your application's entry point file (such as `src/index.js`) <add>- Wrap your root React component with the `<Provider>` component from React-Redux, like: <add> <add>```jsx <add>ReactDOM.render( <add> <Provider store={store}> <add> <App /> <add> </Provider>, <add> document.getElementById('root') <add>) <add>``` <add> <add></DetailedExplanation> <add> <add>#### Exploring the Initial Project <add> <add>This initial project is based on [the standard Create-React-App](https://create-react-app.dev/docs/getting-started) project template, with some modifications. <add> <add>Let's take a quick look at what the initial project contains: <add> <add>- `/src` <add> - `index.js`: the entry point file for the application. It renders the main `<App>` component. <add> - `App.js`: the main application component. <add> - `index.css`: styles for the complete application <add> - `/api` <add> - `client.js`: a small AJAX request client that allows us to make GET and POST requests <add> - `server.js`: provides a fake REST API for our data. Our app will fetch data from these fake endpoints later. <add> <add>If you load the app now, you should see a welcome message, but the rest of the app is otherwise empty. <add> <add>With that, let's get started! <add> <add>## Starting the Todo Example App <add> <add>Our example application will be a small "todo" application. You've probably seen todo app examples before - they make <add>good examples because they let us show how to do things like tracking a list of items, handling user input, and updating <add>the UI when that data changes, which are all things that happen in a normal application. <add> <add>### Defining Requirements <add> <add>Let's start by figuring out the initial business requirements for this application: <add> <add>- The UI should consist of three main sections: <add> - An input box to let the user type in the text of a new todo item <add> - A list of all the existing todo items <add> - A footer section that shows the number of non-completed todos, and shows filtering options <add>- Todo list items should have a checkbox that toggles their "completed" status. We should also be able to add a color-coded <add> category tag for a predefined list of colors. <add>- The counter should pluralize the number of active todos: "0 items", "1 item", "3 items", etc <add>- There should be buttons to mark all todos as completed, and to clear all completed todos by removing them <add>- There should be to ways to filter the displayed todos in the list: <add> - Filtering based on showing "All", "Active", and "Completed" todos <add> - Filtering based on selecting one or more colors, and showing any todos whose tag that match those colors <add> <add>We'll add some more requirements later on, but this is enough to get us started. <add> <add>### Designing the State Values <add> <add>One of the core principles of React and Redux is that your UI should be based on your state. It's also a very good idea <add>to try to describe your UI using as few state values as possible, so there's less data you need to keep track of <add>and update. <add> <add>Conceptually, there are two main aspects of this application: <add> <add>- The actual list of current todo items <add>- The current filtering options <add> <add>We'll also need to keep track of the data the user is typing into the "Add Todo" input box, but that's less important <add>and we'll handle that later. <add> <add>For each todo item, we need to store a few pieces of information: <add> <add>- The text the user entered <add>- The boolean flag saying if it's completed or not <add>- A unique ID value <add>- A color category, if selected <add> <add>Our filtering behavior can probably be described with some enumerated values: <add> <add>- Completed status: "All", "Active", and "Completed" <add>- Colors: "Red", "Yellow", "Green", "Blue", "Orange", "Purple" <add> <add>### Designing the State Structure <add> <add>With Redux, \*\*our application state is always kept in plain JavaScript objects and arrays". That means you may not put <add>other things into the Redux state - no class instances, built-in JS types like `Map`s / `Set`s `Promise`s / `Date`s, functions, or anything else that is not plain JS data. <add> <add>**The root Redux state value is almost always a plain JS object**, with other data nested inside of it. <add> <add>Based on this information, we should now be able to describe the kinds of values we need to have inside our Redux state: <add> <add>- First, we need an array of todo item objects. Each item should have these fields: <add> - `id`: a unique number <add> - `text`: the text the user typed in <add> - `completed`: a boolean flag <add> - `color`: An optional color category <add>- Then, we need to describe our filtering options. We need to have: <add> - The current "completed" filter value <add> - An array of the currently selected color categories <add> <add>So, here's what an example of our app's state might look like: <add> <add>```js <add>const todoAppState = { <add> todos: [ <add> { id: 0, text: 'Learn React', completed: true }, <add> { id: 1, text: 'Learn Redux', completed: false, color: 'purple' }, <add> { id: 2, text: 'Build something fun!', completed: false, color: 'blue' } <add> ], <add> filters: { <add> status: 'Active', <add> colors: ['red', 'blue'] <add> } <add>} <add>```
1
PHP
PHP
add empty string if remote_addr not exists
ccbd3ac25d22c3de0ab0446fb8e613a3769497c0
<ide><path>src/Http/ServerRequest.php <ide> public function clientIp() <ide> } <ide> } <ide> <del> return $this->getEnv('REMOTE_ADDR'); <add> return $this->getEnv('REMOTE_ADDR', ''); <ide> } <ide> <ide> /**
1
Go
Go
increase the coverage of pkg/streamformatter
956c5b61cea9e476847b9d2231ac66d3ec85f018
<ide><path>pkg/streamformatter/streamformatter_test.go <ide> package streamformatter <ide> <ide> import ( <add> "bytes" <ide> "encoding/json" <ide> "errors" <ide> "strings" <ide> func TestRawProgressFormatterFormatStatus(t *testing.T) { <ide> <ide> func TestRawProgressFormatterFormatProgress(t *testing.T) { <ide> sf := rawProgressFormatter{} <del> progress := &jsonmessage.JSONProgress{ <add> jsonProgress := &jsonmessage.JSONProgress{ <ide> Current: 15, <ide> Total: 30, <ide> Start: 1, <ide> } <del> res := sf.formatProgress("id", "action", progress, nil) <add> res := sf.formatProgress("id", "action", jsonProgress, nil) <ide> out := string(res) <ide> assert.True(t, strings.HasPrefix(out, "action [====")) <ide> assert.Contains(t, out, "15B/30B") <ide> func TestFormatJSONError(t *testing.T) { <ide> <ide> func TestJsonProgressFormatterFormatProgress(t *testing.T) { <ide> sf := &jsonProgressFormatter{} <del> progress := &jsonmessage.JSONProgress{ <add> jsonProgress := &jsonmessage.JSONProgress{ <ide> Current: 15, <ide> Total: 30, <ide> Start: 1, <ide> } <del> res := sf.formatProgress("id", "action", progress, nil) <add> res := sf.formatProgress("id", "action", jsonProgress, &AuxFormatter{Writer: &bytes.Buffer{}}) <ide> msg := &jsonmessage.JSONMessage{} <add> <ide> require.NoError(t, json.Unmarshal(res, msg)) <ide> assert.Equal(t, "id", msg.ID) <ide> assert.Equal(t, "action", msg.Status) <ide> <del> // The progress will always be in the format of: <add> // jsonProgress will always be in the format of: <ide> // [=========================> ] 15B/30B 412910h51m30s <ide> // The last entry '404933h7m11s' is the timeLeftBox. <del> // However, the timeLeftBox field may change as progress.String() depends on time.Now(). <add> // However, the timeLeftBox field may change as jsonProgress.String() depends on time.Now(). <ide> // Therefore, we have to strip the timeLeftBox from the strings to do the comparison. <ide> <del> // Compare the progress strings before the timeLeftBox <add> // Compare the jsonProgress strings before the timeLeftBox <ide> expectedProgress := "[=========================> ] 15B/30B" <ide> // if terminal column is <= 110, expectedProgressShort is expected. <ide> expectedProgressShort := " 15B/30B" <ide> func TestJsonProgressFormatterFormatProgress(t *testing.T) { <ide> expectedProgress, expectedProgressShort, msg.ProgressMessage) <ide> } <ide> <del> assert.Equal(t, progress, msg.Progress) <add> assert.Equal(t, jsonProgress, msg.Progress) <add>} <add> <add>func TestJsonProgressFormatterFormatStatus(t *testing.T) { <add> sf := jsonProgressFormatter{} <add> res := sf.formatStatus("ID", "%s%d", "a", 1) <add> assert.Equal(t, `{"status":"a1","id":"ID"}`+streamNewline, string(res)) <add>} <add> <add>func TestNewJSONProgressOutput(t *testing.T) { <add> b := bytes.Buffer{} <add> b.Write(FormatStatus("id", "Downloading")) <add> _ = NewJSONProgressOutput(&b, false) <add> assert.Equal(t, `{"status":"Downloading","id":"id"}`+streamNewline, b.String()) <add>} <add> <add>func TestAuxFormatterEmit(t *testing.T) { <add> b := bytes.Buffer{} <add> aux := &AuxFormatter{Writer: &b} <add> sampleAux := &struct { <add> Data string <add> }{"Additional data"} <add> err := aux.Emit(sampleAux) <add> require.NoError(t, err) <add> assert.Equal(t, `{"aux":{"Data":"Additional data"}}`+streamNewline, b.String()) <ide> }
1
Java
Java
add error propagation now that we use throwable
87e308ad16e0e9649efa773f5056f373c7b95336
<ide><path>rxjava-core/src/main/java/rx/util/Exceptions.java <ide> private Exceptions() { <ide> } <ide> <ide> public static RuntimeException propagate(Throwable t) { <add> /** <add> * The return type of RuntimeException is a trick for code to be like this: <add> * <add> * throw Exceptions.propagate(e); <add> * <add> * Even though nothing will return and throw via that 'throw', it allows the code to look like it <add> * so it's easy to read and understand that it will always result in a throw. <add> */ <ide> if (t instanceof RuntimeException) { <ide> throw (RuntimeException) t; <add> } else if (t instanceof Error) { <add> throw (Error) t; <ide> } else { <ide> throw new RuntimeException(t); <ide> }
1