content_type
stringclasses 8
values | main_lang
stringclasses 7
values | message
stringlengths 1
50
| sha
stringlengths 40
40
| patch
stringlengths 52
962k
| file_count
int64 1
300
|
---|---|---|---|---|---|
Python | Python | clarify skiprows in loadtxt | eac2334d2e51a4960b82cc2ed9e47e10f5d767c6 | <ide><path>numpy/lib/npyio.py
<ide> def loadtxt(fname, dtype=float, comments='#', delimiter=None,
<ide> `genfromtxt`): ``converters = {3: lambda s: float(s.strip() or 0)}``.
<ide> Default: None.
<ide> skiprows : int, optional
<del> Skip the first `skiprows` lines; default: 0.
<add> Skip the first `skiprows` lines, including comments; default: 0.
<ide> usecols : int or sequence, optional
<ide> Which columns to read, with 0 being the first. For example,
<ide> ``usecols = (1,4,5)`` will extract the 2nd, 5th and 6th columns. | 1 |
Ruby | Ruby | remove bad symlink if it already exists | eb23a397013622025dc3b64dda782a9a9cdea4cf | <ide><path>Library/Homebrew/utils.rb
<ide> def migrate_legacy_keg_symlinks_if_necessary
<ide> end
<ide> end
<ide> dst = HOMEBREW_LINKED_KEGS/name
<add> dst.unlink if dst.exist?
<ide> FileUtils.ln_sf(src.relative_path_from(dst.parent), dst)
<ide> end
<ide> FileUtils.rm_rf legacy_linked_kegs | 1 |
Javascript | Javascript | use focused eslint disabling in util.js | 6cda5a98fd1aaedb23d39644a0c95ce1e52e1223 | <ide><path>lib/util.js
<ide> const errorToString = Error.prototype.toString;
<ide> let CIRCULAR_ERROR_MESSAGE;
<ide> let internalDeepEqual;
<ide>
<del>/* eslint-disable */
<add>/* eslint-disable no-control-regex */
<ide> const strEscapeSequencesRegExp = /[\x00-\x1f\x27\x5c]/;
<ide> const strEscapeSequencesReplacer = /[\x00-\x1f\x27\x5c]/g;
<del>/* eslint-enable */
<add>/* eslint-enable no-control-regex */
<add>
<ide> const keyStrRegExp = /^[a-zA-Z_][a-zA-Z_0-9]*$/;
<ide> const numberRegExp = /^(0|[1-9][0-9]*)$/;
<ide> | 1 |
Javascript | Javascript | add coverage for execfilesync() errors | a5080000933108ff6d16bfb8705f18a8879fa138 | <ide><path>test/sequential/test-child-process-execsync.js
<ide> assert.strictEqual(ret, msg + '\n',
<ide> execSync('exit -1', {stdio: 'ignore'});
<ide> }, /Command failed: exit -1/);
<ide> }
<add>
<add>// Verify the execFileSync() behavior when the child exits with a non-zero code.
<add>{
<add> const args = ['-e', 'process.exit(1)'];
<add>
<add> assert.throws(() => {
<add> execFileSync(process.execPath, args);
<add> }, (err) => {
<add> const msg = `Command failed: ${process.execPath} ${args.join(' ')}`;
<add>
<add> assert(err instanceof Error);
<add> assert.strictEqual(err.message.trim(), msg);
<add> assert.strictEqual(err.status, 1);
<add> return true;
<add> });
<add>} | 1 |
Javascript | Javascript | fix import spacing as requested in | 0ed66f033eb830d1bce2ddd460842aa6b2b5a615 | <ide><path>test/unit/src/geometries/ShapeGeometry.tests.js
<ide> import {
<ide> ShapeBufferGeometry
<ide> } from '../../../../src/geometries/ShapeGeometry';
<ide>
<del>import {Shape} from '../../../../src/extras/core/Shape';
<add>import { Shape } from '../../../../src/extras/core/Shape';
<ide>
<ide> export default QUnit.module( 'Geometries', () => {
<ide>
<ide><path>test/unit/src/geometries/TubeGeometry.tests.js
<ide> import {
<ide> TubeBufferGeometry
<ide> } from '../../../../src/geometries/TubeGeometry';
<ide>
<del>import {LineCurve3} from '../../../../src/extras/curves/LineCurve3'
<del>import {Vector3} from '../../../../src/math/Vector3'
<add>import { LineCurve3 } from '../../../../src/extras/curves/LineCurve3'
<add>import { Vector3 } from '../../../../src/math/Vector3'
<ide>
<ide> export default QUnit.module( 'Geometries', () => {
<ide> | 2 |
Python | Python | fix typo in docstring for post_delete hook | c436725dd65c78d2dc5f46fe2246516a5fcf231e | <ide><path>rest_framework/generics.py
<ide> def pre_delete(self, obj):
<ide>
<ide> def post_delete(self, obj):
<ide> """
<del> Placeholder method for calling after saving an object.
<add> Placeholder method for calling after deleting an object.
<ide> """
<ide> pass
<ide> | 1 |
Go | Go | remove the container initializers per platform | 060f4ae6179b10aeafa883670826159fdae8204a | <ide><path>daemon/container.go
<ide> type CommonContainer struct {
<ide> logCopier *logger.Copier
<ide> }
<ide>
<add>// newBaseContainer creates a new container with its
<add>// basic configuration.
<add>func newBaseContainer(id, root string) *Container {
<add> return &Container{
<add> CommonContainer: CommonContainer{
<add> ID: id,
<add> State: NewState(),
<add> execCommands: newExecStore(),
<add> root: root,
<add> MountPoints: make(map[string]*volume.MountPoint),
<add> },
<add> }
<add>}
<add>
<ide> func (container *Container) fromDisk() error {
<ide> pth, err := container.jsonPath()
<ide> if err != nil {
<ide><path>daemon/container_unix.go
<ide> type Container struct {
<ide> ShmPath string
<ide> MqueuePath string
<ide> ResolvConfPath string
<del>
<del> Volumes map[string]string // Deprecated since 1.7, kept for backwards compatibility
<del> VolumesRW map[string]bool // Deprecated since 1.7, kept for backwards compatibility
<ide> }
<ide>
<ide> func killProcessDirectly(container *Container) error {
<ide><path>daemon/daemon.go
<ide> func (daemon *Daemon) Register(container *Container) error {
<ide> }
<ide> }
<ide>
<del> if err := daemon.verifyVolumesInfo(container); err != nil {
<del> return err
<del> }
<del>
<ide> if err := daemon.prepareMountPoints(container); err != nil {
<ide> return err
<ide> }
<ide> func (daemon *Daemon) getNetworkStats(c *Container) ([]*libcontainer.NetworkInte
<ide> return list, nil
<ide> }
<ide>
<add>// newBaseContainer creates a new container with its initial
<add>// configuration based on the root storage from the daemon.
<add>func (daemon *Daemon) newBaseContainer(id string) *Container {
<add> return newBaseContainer(id, daemon.containerRoot(id))
<add>}
<add>
<ide> func convertLnNetworkStats(name string, stats *lntypes.InterfaceStatistics) *libcontainer.NetworkInterface {
<ide> n := &libcontainer.NetworkInterface{Name: name}
<ide> n.RxBytes = stats.RxBytes
<ide><path>daemon/daemon_test.go
<ide> package daemon
<ide>
<ide> import (
<del> "fmt"
<del> "io/ioutil"
<ide> "os"
<ide> "path"
<del> "path/filepath"
<ide> "testing"
<ide>
<ide> "github.com/docker/docker/pkg/graphdb"
<del> "github.com/docker/docker/pkg/stringid"
<ide> "github.com/docker/docker/pkg/truncindex"
<ide> "github.com/docker/docker/runconfig"
<del> "github.com/docker/docker/volume"
<ide> volumedrivers "github.com/docker/docker/volume/drivers"
<ide> "github.com/docker/docker/volume/local"
<ide> "github.com/docker/docker/volume/store"
<ide> func TestGet(t *testing.T) {
<ide> os.Remove(daemonTestDbPath)
<ide> }
<ide>
<del>func TestLoadWithVolume(t *testing.T) {
<del> tmp, err := ioutil.TempDir("", "docker-daemon-test-")
<del> if err != nil {
<del> t.Fatal(err)
<del> }
<del> defer os.RemoveAll(tmp)
<del>
<del> containerID := "d59df5276e7b219d510fe70565e0404bc06350e0d4b43fe961f22f339980170e"
<del> containerPath := filepath.Join(tmp, containerID)
<del> if err := os.MkdirAll(containerPath, 0755); err != nil {
<del> t.Fatal(err)
<del> }
<del>
<del> hostVolumeID := stringid.GenerateNonCryptoID()
<del> vfsPath := filepath.Join(tmp, "vfs", "dir", hostVolumeID)
<del> volumePath := filepath.Join(tmp, "volumes", hostVolumeID)
<del>
<del> if err := os.MkdirAll(vfsPath, 0755); err != nil {
<del> t.Fatal(err)
<del> }
<del> if err := os.MkdirAll(volumePath, 0755); err != nil {
<del> t.Fatal(err)
<del> }
<del>
<del> content := filepath.Join(vfsPath, "helo")
<del> if err := ioutil.WriteFile(content, []byte("HELO"), 0644); err != nil {
<del> t.Fatal(err)
<del> }
<del>
<del> config := `{"State":{"Running":true,"Paused":false,"Restarting":false,"OOMKilled":false,"Dead":false,"Pid":2464,"ExitCode":0,
<del>"Error":"","StartedAt":"2015-05-26T16:48:53.869308965Z","FinishedAt":"0001-01-01T00:00:00Z"},
<del>"ID":"d59df5276e7b219d510fe70565e0404bc06350e0d4b43fe961f22f339980170e","Created":"2015-05-26T16:48:53.7987917Z","Path":"top",
<del>"Args":[],"Config":{"Hostname":"d59df5276e7b","Domainname":"","User":"","Memory":0,"MemorySwap":0,"CpuShares":0,"Cpuset":"",
<del>"AttachStdin":false,"AttachStdout":false,"AttachStderr":false,"PortSpecs":null,"ExposedPorts":null,"Tty":true,"OpenStdin":true,
<del>"StdinOnce":false,"Env":null,"Cmd":["top"],"Image":"ubuntu:latest","Volumes":null,"WorkingDir":"","Entrypoint":null,
<del>"NetworkDisabled":false,"MacAddress":"","OnBuild":null,"Labels":{}},"Image":"07f8e8c5e66084bef8f848877857537ffe1c47edd01a93af27e7161672ad0e95",
<del>"NetworkSettings":{"IPAddress":"172.17.0.1","IPPrefixLen":16,"MacAddress":"02:42:ac:11:00:01","LinkLocalIPv6Address":"fe80::42:acff:fe11:1",
<del>"LinkLocalIPv6PrefixLen":64,"GlobalIPv6Address":"","GlobalIPv6PrefixLen":0,"Gateway":"172.17.42.1","IPv6Gateway":"","Bridge":"docker0","Ports":{}},
<del>"ResolvConfPath":"/var/lib/docker/containers/d59df5276e7b219d510fe70565e0404bc06350e0d4b43fe961f22f339980170e/resolv.conf",
<del>"HostnamePath":"/var/lib/docker/containers/d59df5276e7b219d510fe70565e0404bc06350e0d4b43fe961f22f339980170e/hostname",
<del>"HostsPath":"/var/lib/docker/containers/d59df5276e7b219d510fe70565e0404bc06350e0d4b43fe961f22f339980170e/hosts",
<del>"LogPath":"/var/lib/docker/containers/d59df5276e7b219d510fe70565e0404bc06350e0d4b43fe961f22f339980170e/d59df5276e7b219d510fe70565e0404bc06350e0d4b43fe961f22f339980170e-json.log",
<del>"Name":"/ubuntu","Driver":"aufs","MountLabel":"","ProcessLabel":"","AppArmorProfile":"","RestartCount":0,
<del>"UpdateDns":false,"Volumes":{"/vol1":"%s"},"VolumesRW":{"/vol1":true},"AppliedVolumesFrom":null}`
<del>
<del> cfg := fmt.Sprintf(config, vfsPath)
<del> if err = ioutil.WriteFile(filepath.Join(containerPath, "config.json"), []byte(cfg), 0644); err != nil {
<del> t.Fatal(err)
<del> }
<del>
<del> hostConfig := `{"Binds":[],"ContainerIDFile":"","Memory":0,"MemorySwap":0,"CpuShares":0,"CpusetCpus":"",
<del>"Privileged":false,"PortBindings":{},"Links":null,"PublishAllPorts":false,"Dns":null,"DnsOptions":null,"DnsSearch":null,"ExtraHosts":null,"VolumesFrom":null,
<del>"Devices":[],"NetworkMode":"bridge","IpcMode":"","PidMode":"","CapAdd":null,"CapDrop":null,"RestartPolicy":{"Name":"no","MaximumRetryCount":0},
<del>"SecurityOpt":null,"ReadonlyRootfs":false,"Ulimits":null,"LogConfig":{"Type":"","Config":null},"CgroupParent":""}`
<del> if err = ioutil.WriteFile(filepath.Join(containerPath, "hostconfig.json"), []byte(hostConfig), 0644); err != nil {
<del> t.Fatal(err)
<del> }
<del>
<del> daemon, err := initDaemonWithVolumeStore(tmp)
<del> if err != nil {
<del> t.Fatal(err)
<del> }
<del> defer volumedrivers.Unregister(volume.DefaultDriverName)
<del>
<del> c, err := daemon.load(containerID)
<del> if err != nil {
<del> t.Fatal(err)
<del> }
<del>
<del> err = daemon.verifyVolumesInfo(c)
<del> if err != nil {
<del> t.Fatal(err)
<del> }
<del>
<del> if len(c.MountPoints) != 1 {
<del> t.Fatalf("Expected 1 volume mounted, was 0\n")
<del> }
<del>
<del> m := c.MountPoints["/vol1"]
<del> if m.Name != hostVolumeID {
<del> t.Fatalf("Expected mount name to be %s, was %s\n", hostVolumeID, m.Name)
<del> }
<del>
<del> if m.Destination != "/vol1" {
<del> t.Fatalf("Expected mount destination /vol1, was %s\n", m.Destination)
<del> }
<del>
<del> if !m.RW {
<del> t.Fatalf("Expected mount point to be RW but it was not\n")
<del> }
<del>
<del> if m.Driver != volume.DefaultDriverName {
<del> t.Fatalf("Expected mount driver local, was %s\n", m.Driver)
<del> }
<del>
<del> newVolumeContent := filepath.Join(volumePath, local.VolumeDataPathName, "helo")
<del> b, err := ioutil.ReadFile(newVolumeContent)
<del> if err != nil {
<del> t.Fatal(err)
<del> }
<del> if string(b) != "HELO" {
<del> t.Fatalf("Expected HELO, was %s\n", string(b))
<del> }
<del>}
<del>
<del>func TestLoadWithBindMount(t *testing.T) {
<del> tmp, err := ioutil.TempDir("", "docker-daemon-test-")
<del> if err != nil {
<del> t.Fatal(err)
<del> }
<del> defer os.RemoveAll(tmp)
<del>
<del> containerID := "d59df5276e7b219d510fe70565e0404bc06350e0d4b43fe961f22f339980170e"
<del> containerPath := filepath.Join(tmp, containerID)
<del> if err = os.MkdirAll(containerPath, 0755); err != nil {
<del> t.Fatal(err)
<del> }
<del>
<del> config := `{"State":{"Running":true,"Paused":false,"Restarting":false,"OOMKilled":false,"Dead":false,"Pid":2464,"ExitCode":0,
<del>"Error":"","StartedAt":"2015-05-26T16:48:53.869308965Z","FinishedAt":"0001-01-01T00:00:00Z"},
<del>"ID":"d59df5276e7b219d510fe70565e0404bc06350e0d4b43fe961f22f339980170e","Created":"2015-05-26T16:48:53.7987917Z","Path":"top",
<del>"Args":[],"Config":{"Hostname":"d59df5276e7b","Domainname":"","User":"","Memory":0,"MemorySwap":0,"CpuShares":0,"Cpuset":"",
<del>"AttachStdin":false,"AttachStdout":false,"AttachStderr":false,"PortSpecs":null,"ExposedPorts":null,"Tty":true,"OpenStdin":true,
<del>"StdinOnce":false,"Env":null,"Cmd":["top"],"Image":"ubuntu:latest","Volumes":null,"WorkingDir":"","Entrypoint":null,
<del>"NetworkDisabled":false,"MacAddress":"","OnBuild":null,"Labels":{}},"Image":"07f8e8c5e66084bef8f848877857537ffe1c47edd01a93af27e7161672ad0e95",
<del>"NetworkSettings":{"IPAddress":"172.17.0.1","IPPrefixLen":16,"MacAddress":"02:42:ac:11:00:01","LinkLocalIPv6Address":"fe80::42:acff:fe11:1",
<del>"LinkLocalIPv6PrefixLen":64,"GlobalIPv6Address":"","GlobalIPv6PrefixLen":0,"Gateway":"172.17.42.1","IPv6Gateway":"","Bridge":"docker0","Ports":{}},
<del>"ResolvConfPath":"/var/lib/docker/containers/d59df5276e7b219d510fe70565e0404bc06350e0d4b43fe961f22f339980170e/resolv.conf",
<del>"HostnamePath":"/var/lib/docker/containers/d59df5276e7b219d510fe70565e0404bc06350e0d4b43fe961f22f339980170e/hostname",
<del>"HostsPath":"/var/lib/docker/containers/d59df5276e7b219d510fe70565e0404bc06350e0d4b43fe961f22f339980170e/hosts",
<del>"LogPath":"/var/lib/docker/containers/d59df5276e7b219d510fe70565e0404bc06350e0d4b43fe961f22f339980170e/d59df5276e7b219d510fe70565e0404bc06350e0d4b43fe961f22f339980170e-json.log",
<del>"Name":"/ubuntu","Driver":"aufs","MountLabel":"","ProcessLabel":"","AppArmorProfile":"","RestartCount":0,
<del>"UpdateDns":false,"Volumes":{"/vol1": "/vol1"},"VolumesRW":{"/vol1":true},"AppliedVolumesFrom":null}`
<del>
<del> if err = ioutil.WriteFile(filepath.Join(containerPath, "config.json"), []byte(config), 0644); err != nil {
<del> t.Fatal(err)
<del> }
<del>
<del> hostConfig := `{"Binds":["/vol1:/vol1"],"ContainerIDFile":"","Memory":0,"MemorySwap":0,"CpuShares":0,"CpusetCpus":"",
<del>"Privileged":false,"PortBindings":{},"Links":null,"PublishAllPorts":false,"Dns":null,"DnsOptions":null,"DnsSearch":null,"ExtraHosts":null,"VolumesFrom":null,
<del>"Devices":[],"NetworkMode":"bridge","IpcMode":"","PidMode":"","CapAdd":null,"CapDrop":null,"RestartPolicy":{"Name":"no","MaximumRetryCount":0},
<del>"SecurityOpt":null,"ReadonlyRootfs":false,"Ulimits":null,"LogConfig":{"Type":"","Config":null},"CgroupParent":""}`
<del> if err = ioutil.WriteFile(filepath.Join(containerPath, "hostconfig.json"), []byte(hostConfig), 0644); err != nil {
<del> t.Fatal(err)
<del> }
<del>
<del> daemon, err := initDaemonWithVolumeStore(tmp)
<del> if err != nil {
<del> t.Fatal(err)
<del> }
<del> defer volumedrivers.Unregister(volume.DefaultDriverName)
<del>
<del> c, err := daemon.load(containerID)
<del> if err != nil {
<del> t.Fatal(err)
<del> }
<del>
<del> err = daemon.verifyVolumesInfo(c)
<del> if err != nil {
<del> t.Fatal(err)
<del> }
<del>
<del> if len(c.MountPoints) != 1 {
<del> t.Fatalf("Expected 1 volume mounted, was 0\n")
<del> }
<del>
<del> m := c.MountPoints["/vol1"]
<del> if m.Name != "" {
<del> t.Fatalf("Expected empty mount name, was %s\n", m.Name)
<del> }
<del>
<del> if m.Source != "/vol1" {
<del> t.Fatalf("Expected mount source /vol1, was %s\n", m.Source)
<del> }
<del>
<del> if m.Destination != "/vol1" {
<del> t.Fatalf("Expected mount destination /vol1, was %s\n", m.Destination)
<del> }
<del>
<del> if !m.RW {
<del> t.Fatalf("Expected mount point to be RW but it was not\n")
<del> }
<del>}
<del>
<del>func TestLoadWithVolume17RC(t *testing.T) {
<del> tmp, err := ioutil.TempDir("", "docker-daemon-test-")
<del> if err != nil {
<del> t.Fatal(err)
<del> }
<del> defer os.RemoveAll(tmp)
<del>
<del> containerID := "d59df5276e7b219d510fe70565e0404bc06350e0d4b43fe961f22f339980170e"
<del> containerPath := filepath.Join(tmp, containerID)
<del> if err := os.MkdirAll(containerPath, 0755); err != nil {
<del> t.Fatal(err)
<del> }
<del>
<del> hostVolumeID := "6a3c03fc4a4e588561a543cc3bdd50089e27bd11bbb0e551e19bf735e2514101"
<del> volumePath := filepath.Join(tmp, "volumes", hostVolumeID)
<del>
<del> if err := os.MkdirAll(volumePath, 0755); err != nil {
<del> t.Fatal(err)
<del> }
<del>
<del> content := filepath.Join(volumePath, "helo")
<del> if err := ioutil.WriteFile(content, []byte("HELO"), 0644); err != nil {
<del> t.Fatal(err)
<del> }
<del>
<del> config := `{"State":{"Running":true,"Paused":false,"Restarting":false,"OOMKilled":false,"Dead":false,"Pid":2464,"ExitCode":0,
<del>"Error":"","StartedAt":"2015-05-26T16:48:53.869308965Z","FinishedAt":"0001-01-01T00:00:00Z"},
<del>"ID":"d59df5276e7b219d510fe70565e0404bc06350e0d4b43fe961f22f339980170e","Created":"2015-05-26T16:48:53.7987917Z","Path":"top",
<del>"Args":[],"Config":{"Hostname":"d59df5276e7b","Domainname":"","User":"","Memory":0,"MemorySwap":0,"CpuShares":0,"Cpuset":"",
<del>"AttachStdin":false,"AttachStdout":false,"AttachStderr":false,"PortSpecs":null,"ExposedPorts":null,"Tty":true,"OpenStdin":true,
<del>"StdinOnce":false,"Env":null,"Cmd":["top"],"Image":"ubuntu:latest","Volumes":null,"WorkingDir":"","Entrypoint":null,
<del>"NetworkDisabled":false,"MacAddress":"","OnBuild":null,"Labels":{}},"Image":"07f8e8c5e66084bef8f848877857537ffe1c47edd01a93af27e7161672ad0e95",
<del>"NetworkSettings":{"IPAddress":"172.17.0.1","IPPrefixLen":16,"MacAddress":"02:42:ac:11:00:01","LinkLocalIPv6Address":"fe80::42:acff:fe11:1",
<del>"LinkLocalIPv6PrefixLen":64,"GlobalIPv6Address":"","GlobalIPv6PrefixLen":0,"Gateway":"172.17.42.1","IPv6Gateway":"","Bridge":"docker0","Ports":{}},
<del>"ResolvConfPath":"/var/lib/docker/containers/d59df5276e7b219d510fe70565e0404bc06350e0d4b43fe961f22f339980170e/resolv.conf",
<del>"HostnamePath":"/var/lib/docker/containers/d59df5276e7b219d510fe70565e0404bc06350e0d4b43fe961f22f339980170e/hostname",
<del>"HostsPath":"/var/lib/docker/containers/d59df5276e7b219d510fe70565e0404bc06350e0d4b43fe961f22f339980170e/hosts",
<del>"LogPath":"/var/lib/docker/containers/d59df5276e7b219d510fe70565e0404bc06350e0d4b43fe961f22f339980170e/d59df5276e7b219d510fe70565e0404bc06350e0d4b43fe961f22f339980170e-json.log",
<del>"Name":"/ubuntu","Driver":"aufs","MountLabel":"","ProcessLabel":"","AppArmorProfile":"","RestartCount":0,
<del>"UpdateDns":false,"MountPoints":{"/vol1":{"Name":"6a3c03fc4a4e588561a543cc3bdd50089e27bd11bbb0e551e19bf735e2514101","Destination":"/vol1","Driver":"local","RW":true,"Source":"","Relabel":""}},"AppliedVolumesFrom":null}`
<del>
<del> if err = ioutil.WriteFile(filepath.Join(containerPath, "config.json"), []byte(config), 0644); err != nil {
<del> t.Fatal(err)
<del> }
<del>
<del> hostConfig := `{"Binds":[],"ContainerIDFile":"","Memory":0,"MemorySwap":0,"CpuShares":0,"CpusetCpus":"",
<del>"Privileged":false,"PortBindings":{},"Links":null,"PublishAllPorts":false,"Dns":null,"DnsOptions":null,"DnsSearch":null,"ExtraHosts":null,"VolumesFrom":null,
<del>"Devices":[],"NetworkMode":"bridge","IpcMode":"","PidMode":"","CapAdd":null,"CapDrop":null,"RestartPolicy":{"Name":"no","MaximumRetryCount":0},
<del>"SecurityOpt":null,"ReadonlyRootfs":false,"Ulimits":null,"LogConfig":{"Type":"","Config":null},"CgroupParent":""}`
<del> if err = ioutil.WriteFile(filepath.Join(containerPath, "hostconfig.json"), []byte(hostConfig), 0644); err != nil {
<del> t.Fatal(err)
<del> }
<del>
<del> daemon, err := initDaemonWithVolumeStore(tmp)
<del> if err != nil {
<del> t.Fatal(err)
<del> }
<del> defer volumedrivers.Unregister(volume.DefaultDriverName)
<del>
<del> c, err := daemon.load(containerID)
<del> if err != nil {
<del> t.Fatal(err)
<del> }
<del>
<del> err = daemon.verifyVolumesInfo(c)
<del> if err != nil {
<del> t.Fatal(err)
<del> }
<del>
<del> if len(c.MountPoints) != 1 {
<del> t.Fatalf("Expected 1 volume mounted, was 0\n")
<del> }
<del>
<del> m := c.MountPoints["/vol1"]
<del> if m.Name != hostVolumeID {
<del> t.Fatalf("Expected mount name to be %s, was %s\n", hostVolumeID, m.Name)
<del> }
<del>
<del> if m.Destination != "/vol1" {
<del> t.Fatalf("Expected mount destination /vol1, was %s\n", m.Destination)
<del> }
<del>
<del> if !m.RW {
<del> t.Fatalf("Expected mount point to be RW but it was not\n")
<del> }
<del>
<del> if m.Driver != volume.DefaultDriverName {
<del> t.Fatalf("Expected mount driver local, was %s\n", m.Driver)
<del> }
<del>
<del> newVolumeContent := filepath.Join(volumePath, local.VolumeDataPathName, "helo")
<del> b, err := ioutil.ReadFile(newVolumeContent)
<del> if err != nil {
<del> t.Fatal(err)
<del> }
<del> if string(b) != "HELO" {
<del> t.Fatalf("Expected HELO, was %s\n", string(b))
<del> }
<del>}
<del>
<del>func TestRemoveLocalVolumesFollowingSymlinks(t *testing.T) {
<del> tmp, err := ioutil.TempDir("", "docker-daemon-test-")
<del> if err != nil {
<del> t.Fatal(err)
<del> }
<del> defer os.RemoveAll(tmp)
<del>
<del> containerID := "d59df5276e7b219d510fe70565e0404bc06350e0d4b43fe961f22f339980170e"
<del> containerPath := filepath.Join(tmp, containerID)
<del> if err := os.MkdirAll(containerPath, 0755); err != nil {
<del> t.Fatal(err)
<del> }
<del>
<del> hostVolumeID := stringid.GenerateNonCryptoID()
<del> vfsPath := filepath.Join(tmp, "vfs", "dir", hostVolumeID)
<del> volumePath := filepath.Join(tmp, "volumes", hostVolumeID)
<del>
<del> if err := os.MkdirAll(vfsPath, 0755); err != nil {
<del> t.Fatal(err)
<del> }
<del> if err := os.MkdirAll(volumePath, 0755); err != nil {
<del> t.Fatal(err)
<del> }
<del>
<del> content := filepath.Join(vfsPath, "helo")
<del> if err := ioutil.WriteFile(content, []byte("HELO"), 0644); err != nil {
<del> t.Fatal(err)
<del> }
<del>
<del> config := `{"State":{"Running":true,"Paused":false,"Restarting":false,"OOMKilled":false,"Dead":false,"Pid":2464,"ExitCode":0,
<del>"Error":"","StartedAt":"2015-05-26T16:48:53.869308965Z","FinishedAt":"0001-01-01T00:00:00Z"},
<del>"ID":"d59df5276e7b219d510fe70565e0404bc06350e0d4b43fe961f22f339980170e","Created":"2015-05-26T16:48:53.7987917Z","Path":"top",
<del>"Args":[],"Config":{"Hostname":"d59df5276e7b","Domainname":"","User":"","Memory":0,"MemorySwap":0,"CpuShares":0,"Cpuset":"",
<del>"AttachStdin":false,"AttachStdout":false,"AttachStderr":false,"PortSpecs":null,"ExposedPorts":null,"Tty":true,"OpenStdin":true,
<del>"StdinOnce":false,"Env":null,"Cmd":["top"],"Image":"ubuntu:latest","Volumes":null,"WorkingDir":"","Entrypoint":null,
<del>"NetworkDisabled":false,"MacAddress":"","OnBuild":null,"Labels":{}},"Image":"07f8e8c5e66084bef8f848877857537ffe1c47edd01a93af27e7161672ad0e95",
<del>"NetworkSettings":{"IPAddress":"172.17.0.1","IPPrefixLen":16,"MacAddress":"02:42:ac:11:00:01","LinkLocalIPv6Address":"fe80::42:acff:fe11:1",
<del>"LinkLocalIPv6PrefixLen":64,"GlobalIPv6Address":"","GlobalIPv6PrefixLen":0,"Gateway":"172.17.42.1","IPv6Gateway":"","Bridge":"docker0","Ports":{}},
<del>"ResolvConfPath":"/var/lib/docker/containers/d59df5276e7b219d510fe70565e0404bc06350e0d4b43fe961f22f339980170e/resolv.conf",
<del>"HostnamePath":"/var/lib/docker/containers/d59df5276e7b219d510fe70565e0404bc06350e0d4b43fe961f22f339980170e/hostname",
<del>"HostsPath":"/var/lib/docker/containers/d59df5276e7b219d510fe70565e0404bc06350e0d4b43fe961f22f339980170e/hosts",
<del>"LogPath":"/var/lib/docker/containers/d59df5276e7b219d510fe70565e0404bc06350e0d4b43fe961f22f339980170e/d59df5276e7b219d510fe70565e0404bc06350e0d4b43fe961f22f339980170e-json.log",
<del>"Name":"/ubuntu","Driver":"aufs","MountLabel":"","ProcessLabel":"","AppArmorProfile":"","RestartCount":0,
<del>"UpdateDns":false,"Volumes":{"/vol1":"%s"},"VolumesRW":{"/vol1":true},"AppliedVolumesFrom":null}`
<del>
<del> cfg := fmt.Sprintf(config, vfsPath)
<del> if err = ioutil.WriteFile(filepath.Join(containerPath, "config.json"), []byte(cfg), 0644); err != nil {
<del> t.Fatal(err)
<del> }
<del>
<del> hostConfig := `{"Binds":[],"ContainerIDFile":"","Memory":0,"MemorySwap":0,"CpuShares":0,"CpusetCpus":"",
<del>"Privileged":false,"PortBindings":{},"Links":null,"PublishAllPorts":false,"Dns":null,"DnsOptions":null,"DnsSearch":null,"ExtraHosts":null,"VolumesFrom":null,
<del>"Devices":[],"NetworkMode":"bridge","IpcMode":"","PidMode":"","CapAdd":null,"CapDrop":null,"RestartPolicy":{"Name":"no","MaximumRetryCount":0},
<del>"SecurityOpt":null,"ReadonlyRootfs":false,"Ulimits":null,"LogConfig":{"Type":"","Config":null},"CgroupParent":""}`
<del> if err = ioutil.WriteFile(filepath.Join(containerPath, "hostconfig.json"), []byte(hostConfig), 0644); err != nil {
<del> t.Fatal(err)
<del> }
<del>
<del> daemon, err := initDaemonWithVolumeStore(tmp)
<del> if err != nil {
<del> t.Fatal(err)
<del> }
<del> defer volumedrivers.Unregister(volume.DefaultDriverName)
<del>
<del> c, err := daemon.load(containerID)
<del> if err != nil {
<del> t.Fatal(err)
<del> }
<del>
<del> err = daemon.verifyVolumesInfo(c)
<del> if err != nil {
<del> t.Fatal(err)
<del> }
<del>
<del> if len(c.MountPoints) != 1 {
<del> t.Fatalf("Expected 1 volume mounted, was 0\n")
<del> }
<del>
<del> m := c.MountPoints["/vol1"]
<del> _, err = daemon.VolumeCreate(m.Name, m.Driver, nil)
<del> if err != nil {
<del> t.Fatal(err)
<del> }
<del>
<del> if err := daemon.VolumeRm(m.Name); err != nil {
<del> t.Fatal(err)
<del> }
<del>
<del> fi, err := os.Stat(vfsPath)
<del> if err == nil || !os.IsNotExist(err) {
<del> t.Fatalf("Expected vfs path to not exist: %v - %v\n", fi, err)
<del> }
<del>}
<del>
<ide> func initDaemonWithVolumeStore(tmp string) (*Daemon, error) {
<ide> daemon := &Daemon{
<ide> repository: tmp,
<ide><path>daemon/daemon_unix.go
<ide> import (
<ide> "github.com/docker/docker/pkg/parsers/kernel"
<ide> "github.com/docker/docker/pkg/sysinfo"
<ide> "github.com/docker/docker/runconfig"
<del> "github.com/docker/docker/volume"
<ide> "github.com/docker/libnetwork"
<ide> nwconfig "github.com/docker/libnetwork/config"
<ide> "github.com/docker/libnetwork/drivers/bridge"
<ide> func (daemon *Daemon) registerLinks(container *Container, hostConfig *runconfig.
<ide> return nil
<ide> }
<ide>
<del>func (daemon *Daemon) newBaseContainer(id string) *Container {
<del> return &Container{
<del> CommonContainer: CommonContainer{
<del> ID: id,
<del> State: NewState(),
<del> execCommands: newExecStore(),
<del> root: daemon.containerRoot(id),
<del> MountPoints: make(map[string]*volume.MountPoint),
<del> },
<del> Volumes: make(map[string]string),
<del> VolumesRW: make(map[string]bool),
<del> }
<del>}
<del>
<ide> // conditionalMountOnStart is a platform specific helper function during the
<ide> // container start to call mount.
<ide> func (daemon *Daemon) conditionalMountOnStart(container *Container) error {
<ide><path>daemon/daemon_windows.go
<ide> func (daemon *Daemon) registerLinks(container *Container, hostConfig *runconfig.
<ide> return nil
<ide> }
<ide>
<del>func (daemon *Daemon) newBaseContainer(id string) *Container {
<del> return &Container{
<del> CommonContainer: CommonContainer{
<del> ID: id,
<del> State: NewState(),
<del> execCommands: newExecStore(),
<del> root: daemon.containerRoot(id),
<del> },
<del> }
<del>}
<del>
<ide> func (daemon *Daemon) cleanupMounts() error {
<ide> return nil
<ide> }
<ide><path>daemon/volumes.go
<ide> func (m mounts) parts(i int) int {
<ide> // 1. Select the previously configured mount points for the containers, if any.
<ide> // 2. Select the volumes mounted from another containers. Overrides previously configured mount point destination.
<ide> // 3. Select the bind mounts set by the client. Overrides previously configured mount point destinations.
<add>// 4. Cleanup old volumes that are about to be reasigned.
<ide> func (daemon *Daemon) registerMountPoints(container *Container, hostConfig *runconfig.HostConfig) error {
<ide> binds := map[string]bool{}
<ide> mountPoints := map[string]*volume.MountPoint{}
<ide> func (daemon *Daemon) registerMountPoints(container *Container, hostConfig *runc
<ide> mountPoints[bind.Destination] = bind
<ide> }
<ide>
<del> bcVolumes, bcVolumesRW := configureBackCompatStructures(daemon, container, mountPoints)
<del>
<ide> container.Lock()
<add>
<add> // 4. Cleanup old volumes that are about to be reasigned.
<add> for _, m := range mountPoints {
<add> if m.BackwardsCompatible() {
<add> if mp, exists := container.MountPoints[m.Destination]; exists && mp.Volume != nil {
<add> daemon.volumes.Decrement(mp.Volume)
<add> }
<add> }
<add> }
<ide> container.MountPoints = mountPoints
<del> setBackCompatStructures(container, bcVolumes, bcVolumesRW)
<ide>
<ide> container.Unlock()
<ide>
<ide><path>daemon/volumes_unix.go
<ide> package daemon
<ide> import (
<ide> "io/ioutil"
<ide> "os"
<del> "path/filepath"
<ide> "sort"
<del> "strings"
<ide>
<del> "github.com/Sirupsen/logrus"
<ide> "github.com/docker/docker/daemon/execdriver"
<ide> "github.com/docker/docker/pkg/chrootarchive"
<ide> "github.com/docker/docker/pkg/system"
<ide> func validVolumeLayout(files []os.FileInfo) bool {
<ide> return true
<ide> }
<ide>
<del>// verifyVolumesInfo ports volumes configured for the containers pre docker 1.7.
<del>// It reads the container configuration and creates valid mount points for the old volumes.
<del>func (daemon *Daemon) verifyVolumesInfo(container *Container) error {
<del> // Inspect old structures only when we're upgrading from old versions
<del> // to versions >= 1.7 and the MountPoints has not been populated with volumes data.
<del> if len(container.MountPoints) == 0 && len(container.Volumes) > 0 {
<del> for destination, hostPath := range container.Volumes {
<del> vfsPath := filepath.Join(daemon.root, "vfs", "dir")
<del> rw := container.VolumesRW != nil && container.VolumesRW[destination]
<del>
<del> if strings.HasPrefix(hostPath, vfsPath) {
<del> id := filepath.Base(hostPath)
<del> if err := migrateVolume(id, hostPath); err != nil {
<del> return err
<del> }
<del> container.addLocalMountPoint(id, destination, rw)
<del> } else { // Bind mount
<del> id, source := volume.ParseVolumeSource(hostPath)
<del> container.addBindMountPoint(id, source, destination, rw)
<del> }
<del> }
<del> } else if len(container.MountPoints) > 0 {
<del> // Volumes created with a Docker version >= 1.7. We verify integrity in case of data created
<del> // with Docker 1.7 RC versions that put the information in
<del> // DOCKER_ROOT/volumes/VOLUME_ID rather than DOCKER_ROOT/volumes/VOLUME_ID/_container_data.
<del> l, err := volumedrivers.Lookup(volume.DefaultDriverName)
<del> if err != nil {
<del> return err
<del> }
<del>
<del> for _, m := range container.MountPoints {
<del> if m.Driver != volume.DefaultDriverName {
<del> continue
<del> }
<del> dataPath := l.(*local.Root).DataPath(m.Name)
<del> volumePath := filepath.Dir(dataPath)
<del>
<del> d, err := ioutil.ReadDir(volumePath)
<del> if err != nil {
<del> // If the volume directory doesn't exist yet it will be recreated,
<del> // so we only return the error when there is a different issue.
<del> if !os.IsNotExist(err) {
<del> return err
<del> }
<del> // Do not check when the volume directory does not exist.
<del> continue
<del> }
<del> if validVolumeLayout(d) {
<del> continue
<del> }
<del>
<del> if err := os.Mkdir(dataPath, 0755); err != nil {
<del> return err
<del> }
<del>
<del> // Move data inside the data directory
<del> for _, f := range d {
<del> oldp := filepath.Join(volumePath, f.Name())
<del> newp := filepath.Join(dataPath, f.Name())
<del> if err := os.Rename(oldp, newp); err != nil {
<del> logrus.Errorf("Unable to move %s to %s\n", oldp, newp)
<del> }
<del> }
<del> }
<del>
<del> return container.toDiskLocking()
<del> }
<del>
<del> return nil
<del>}
<del>
<ide> // setBindModeIfNull is platform specific processing to ensure the
<ide> // shared mode is set to 'z' if it is null. This is called in the case
<ide> // of processing a named volume and not a typical bind.
<ide> func setBindModeIfNull(bind *volume.MountPoint) *volume.MountPoint {
<ide> }
<ide> return bind
<ide> }
<del>
<del>// configureBackCompatStructures is platform specific processing for
<del>// registering mount points to populate old structures.
<del>func configureBackCompatStructures(daemon *Daemon, container *Container, mountPoints map[string]*volume.MountPoint) (map[string]string, map[string]bool) {
<del> // Keep backwards compatible structures
<del> bcVolumes := map[string]string{}
<del> bcVolumesRW := map[string]bool{}
<del> for _, m := range mountPoints {
<del> if m.BackwardsCompatible() {
<del> bcVolumes[m.Destination] = m.Path()
<del> bcVolumesRW[m.Destination] = m.RW
<del>
<del> // This mountpoint is replacing an existing one, so the count needs to be decremented
<del> if mp, exists := container.MountPoints[m.Destination]; exists && mp.Volume != nil {
<del> daemon.volumes.Decrement(mp.Volume)
<del> }
<del> }
<del> }
<del> return bcVolumes, bcVolumesRW
<del>}
<del>
<del>// setBackCompatStructures is a platform specific helper function to set
<del>// backwards compatible structures in the container when registering volumes.
<del>func setBackCompatStructures(container *Container, bcVolumes map[string]string, bcVolumesRW map[string]bool) {
<del> container.Volumes = bcVolumes
<del> container.VolumesRW = bcVolumesRW
<del>}
<ide><path>daemon/volumes_windows.go
<ide> func (daemon *Daemon) setupMounts(container *Container) ([]execdriver.Mount, err
<ide> return mnts, nil
<ide> }
<ide>
<del>// verifyVolumesInfo ports volumes configured for the containers pre docker 1.7.
<del>// As the Windows daemon was not supported before 1.7, this is a no-op
<del>func (daemon *Daemon) verifyVolumesInfo(container *Container) error {
<del> return nil
<del>}
<del>
<ide> // setBindModeIfNull is platform specific processing which is a no-op on
<ide> // Windows.
<ide> func setBindModeIfNull(bind *volume.MountPoint) *volume.MountPoint {
<ide> return bind
<ide> }
<del>
<del>// configureBackCompatStructures is platform specific processing for
<del>// registering mount points to populate old structures. This is a no-op on Windows.
<del>func configureBackCompatStructures(*Daemon, *Container, map[string]*volume.MountPoint) (map[string]string, map[string]bool) {
<del> return nil, nil
<del>}
<del>
<del>// setBackCompatStructures is a platform specific helper function to set
<del>// backwards compatible structures in the container when registering volumes.
<del>// This is a no-op on Windows.
<del>func setBackCompatStructures(*Container, map[string]string, map[string]bool) {
<del>}
<ide><path>volume/volume_windows.go
<ide> const (
<ide> //
<ide> )
<ide>
<add>// BackwardsCompatible decides whether this mount point can be
<add>// used in old versions of Docker or not.
<add>// Windows volumes are never backwards compatible.
<add>func (m *MountPoint) BackwardsCompatible() bool {
<add> return false
<add>}
<add>
<ide> // ParseMountSpec validates the configuration of mount information is valid.
<ide> func ParseMountSpec(spec string, volumeDriver string) (*MountPoint, error) {
<ide> var specExp = regexp.MustCompile(`^` + RXSource + RXDestination + RXMode + `$`) | 10 |
PHP | PHP | fix relative path resolution in view | 31ed8c3eea630153bcd30885aeeb08de852909a8 | <ide><path>src/View/View.php
<ide> protected function _getViewFileName($name = null) {
<ide> }
<ide> $name = trim($name, DS);
<ide> } elseif ($name[0] === '.') {
<del> $name = substr($name, 3);
<add> $name = $this->viewPath . DS . $subDir . $name;
<ide> } elseif (!$plugin || $this->viewPath !== $this->name) {
<ide> $name = $this->viewPath . DS . $subDir . $name;
<ide> }
<ide><path>tests/TestCase/View/ViewTest.php
<ide> public function testGetViewFileNames() {
<ide> $result = $View->getViewFileName('/Posts/index');
<ide> $this->assertPathEquals($expected, $result);
<ide>
<del> $expected = TEST_APP . 'TestApp' . DS . 'Template' . DS . 'Posts' . DS . 'index.ctp';
<add> $expected = TEST_APP . 'TestApp' . DS . 'Template' . DS . 'Pages' . DS . '..' . DS . 'Posts' . DS . 'index.ctp';
<ide> $result = $View->getViewFileName('../Posts/index');
<ide> $this->assertPathEquals($expected, $result);
<ide>
<ide> public function testViewFileName() {
<ide> $result = $View->getViewFileName('../Element/test_element');
<ide> $this->assertRegExp('/Element(\/|\\\)test_element.ctp/', $result);
<ide>
<del> $expected = TEST_APP . 'TestApp' . DS . 'Template' . DS . 'Posts' . DS . 'index.ctp';
<add> $expected = TEST_APP . 'TestApp' . DS . 'Template' . DS . 'Posts' . DS . '..' . DS . 'Posts' . DS . 'index.ctp';
<ide> $result = $View->getViewFileName('../Posts/index');
<ide> $this->assertPathEquals($expected, $result);
<ide> } | 2 |
Text | Text | add v3.24.4 to changelog.md | c4e70e3567a239c41ba9c319df72f239b1530e0c | <ide><path>CHANGELOG.md
<ide> - [#19441](https://github.com/emberjs/ember.js/pull/19441) Add automated publishing of weekly alpha releases to NPM
<ide> - [#19462](https://github.com/emberjs/ember.js/pull/19462) Use `positional` and `named` as the argument names in `ember g helper` blueprint
<ide>
<add>### v3.24.4 (May 3, 2021)
<add>
<add>- [#19477](https://github.com/emberjs/ember.js/pull/19477) Allow `<LinkToExternal />` to override internal assertion
<add>
<ide> ### v3.26.1 (March 24, 2021)
<ide>
<ide> - [#19473](https://github.com/emberjs/ember.js/pull/19473) Update Glimmer VM to latest.
<ide> - [#19338](https://github.com/emberjs/ember.js/pull/19338) [BUGFIX] Add missing `deprecate` options (`for` + `since`)
<ide> - [#19342](https://github.com/emberjs/ember.js/pull/19342) [BUGFIX] Fix misleading LinkTo error message
<ide>
<del>
<ide> ### v3.24.3 (March 7, 2021)
<ide>
<ide> - [#19448](https://github.com/emberjs/ember.js/pull/19448) Ensure query params are preserved through an intermediate loading state transition | 1 |
Javascript | Javascript | add test for piping large input from stdin | 761787be9156758a3300f2aac50f92345055281c | <ide><path>test/parallel/test-stdin-pipe-large.js
<add>'use strict';
<add>// See https://github.com/nodejs/node/issues/5927
<add>
<add>const common = require('../common');
<add>const assert = require('assert');
<add>const spawn = require('child_process').spawn;
<add>
<add>if (process.argv[2] === 'child') {
<add> process.stdin.pipe(process.stdout);
<add> return;
<add>}
<add>
<add>const child = spawn(process.execPath, [__filename, 'child'], { stdio: 'pipe' });
<add>
<add>const expectedBytes = 1024 * 1024;
<add>let readBytes = 0;
<add>
<add>child.stdin.end(Buffer.alloc(expectedBytes));
<add>
<add>child.stdout.on('data', (chunk) => readBytes += chunk.length);
<add>child.stdout.on('end', common.mustCall(() => {
<add> assert.strictEqual(readBytes, expectedBytes);
<add>})); | 1 |
Javascript | Javascript | remove scrolleventthrottle defaultprops | 3c5fa3b6426e1a91b5344682c131f520344ac467 | <ide><path>Libraries/Lists/VirtualizedList.js
<ide> type Props = {|
<ide>
<ide> type DefaultProps = {|
<ide> keyExtractor: (item: Item, index: number) => string,
<del> scrollEventThrottle: number,
<ide> updateCellsBatchingPeriod: number,
<ide> windowSize: number,
<ide> |};
<ide> function onEndReachedThresholdOrDefault(onEndReachedThreshold: ?number) {
<ide> return onEndReachedThreshold ?? 2;
<ide> }
<ide>
<add>function scrollEventThrottleOrDefault(scrollEventThrottle: ?number) {
<add> return scrollEventThrottle ?? 50;
<add>}
<add>
<ide> /**
<ide> * Base implementation for the more convenient [`<FlatList>`](https://reactnative.dev/docs/flatlist.html)
<ide> * and [`<SectionList>`](https://reactnative.dev/docs/sectionlist.html) components, which are also better
<ide> class VirtualizedList extends React.PureComponent<Props, State> {
<ide> }
<ide> return String(index);
<ide> },
<del> scrollEventThrottle: 50,
<ide> updateCellsBatchingPeriod: 50,
<ide> windowSize: 21, // multiples of length
<ide> };
<ide> class VirtualizedList extends React.PureComponent<Props, State> {
<ide> onScrollEndDrag: this._onScrollEndDrag,
<ide> onMomentumScrollBegin: this._onMomentumScrollBegin,
<ide> onMomentumScrollEnd: this._onMomentumScrollEnd,
<del> scrollEventThrottle: this.props.scrollEventThrottle, // TODO: Android support
<add> scrollEventThrottle: scrollEventThrottleOrDefault(
<add> this.props.scrollEventThrottle,
<add> ), // TODO: Android support
<ide> invertStickyHeaders:
<ide> this.props.invertStickyHeaders !== undefined
<ide> ? this.props.invertStickyHeaders | 1 |
Javascript | Javascript | finish the texture mapping implementation | c1034bc24bf6a36fff9d83e530279c044bb79829 | <ide><path>examples/js/renderers/SoftwareRenderer.js
<ide> THREE.SoftwareRenderer = function ( parameters ) {
<ide>
<ide> // UV interpolation setup
<ide>
<del> var dtu12 = tu1 - tu2, dtu23 = tu2 - tu3, dtu31 = tu3 - tu1;
<del>// var dtudx = (invDet * (dtu12*dy31 - du31*dy12)); // dtu per one subpixel step in x
<del>// var dtudy = (invDet * (dtu12*dx31 - dx12*du31)); // dtu per one subpixel step in y
<del> var dtv12 = tv1 - tv2, dtv23 = tv2 - tv3, dtv31 = tv3 - tv1;
<del>// var dtvdx = (invDet * (dtv12*dy31 - dtv31*dy12)); // dtv per one subpixel step in x
<del>// var dtvdy = (invDet * (dtv12*dx31 - dx12*dtv31)); // dtv per one subpixel step in y
<add> var dtu12 = tu1 - tu2, du31 = tu3 - tu1;
<add> var dtudx = (invDet * (dtu12*dy31 - du31*dy12)); // dtu per one subpixel step in x
<add> var dtudy = (invDet * (dtu12*dx31 - dx12*du31)); // dtu per one subpixel step in y
<add> var dtv12 = tv1 - tv2, dtv31 = tv3 - tv1;
<add> var dtvdx = (invDet * (dtv12*dy31 - dtv31*dy12)); // dtv per one subpixel step in x
<add> var dtvdy = (invDet * (dtv12*dx31 - dx12*dtv31)); // dtv per one subpixel step in y
<ide>
<del> // UV at top/left corner of rast area
<del>// var minXfixscale = (minx << subpixelBits);
<del>// var minYfixscale = (miny << subpixelBits);
<del>// var ctu = ( tu1 + (minXfixscale - x1) * dtudx + (minYfixscale - y1) * dtudy );
<del>// var ctv = ( tv1 + (minXfixscale - x1) * dtvdx + (minYfixscale - y1) * dtvdy );
<del> var mintu = Math.min( tu1, tu2, tu3 );
<del> var maxtu = Math.max( tu1, tu2, tu3 );
<del> var mintv = Math.min( tv1, tv2, tv3 );
<del> var maxtv = Math.max( tv1, tv2, tv3 );
<del>
<del> var cuv1 = dtv12 * (mintu- tu1) + dtu12 * (mintv - tv1);
<del> var cuv2 = dtv23 * (mintu - tu2) + dtu23 * (mintv - tv2);
<del> var cuv3 = dtv31 * (mintu - tu3) + dtu31 * (mintv - tv3);
<add> // UV at top/left corner of rast area
<ide>
<add> var minXfixscale = (minx << subpixelBits);
<add> var minYfixscale = (miny << subpixelBits);
<add> var ctu = ( tu1 + (minXfixscale - x1) * dtudx + (minYfixscale - y1) * dtudy );
<add> var ctv = ( tv1 + (minXfixscale - x1) * dtvdx + (minYfixscale - y1) * dtvdy );
<add>
<ide> // UV pixel steps
<ide>
<del>// var tufixscale = (1 << subpixelBits);
<del>// dtudx = dtudx * tufixscale;
<del>// dtudy = dtudy * tufixscale;
<del>// var tvfixscale = (1 << subpixelBits);
<del>// dtvdx = (dtvdx * tvfixscale);
<del>// dtvdy = (dtvdy * tvfixscale);
<add> var tufixscale = (1 << subpixelBits);
<add> dtudx = dtudx * tufixscale;
<add> dtudy = dtudy * tufixscale;
<add> var tvfixscale = (1 << subpixelBits);
<add> dtvdx = (dtvdx * tvfixscale);
<add> dtvdy = (dtvdy * tvfixscale);
<ide>
<ide> // Set up min/max corners
<ide> var qm1 = q - 1; // for convenience
<ide> var nmin1 = 0, nmax1 = 0;
<ide> var nmin2 = 0, nmax2 = 0;
<ide> var nmin3 = 0, nmax3 = 0;
<ide> var nminz = 0, nmaxz = 0;
<del>// var nmintu = 0, nmaxtu = 0;
<del>// var nmintv = 0, nmaxtv = 0;
<add> var nmintu = 0, nmaxtu = 0;
<add> var nmintv = 0, nmaxtv = 0;
<ide> if (dx12 >= 0) nmax1 -= qm1*dx12; else nmin1 -= qm1*dx12;
<ide> if (dy12 >= 0) nmax1 -= qm1*dy12; else nmin1 -= qm1*dy12;
<ide> if (dx23 >= 0) nmax2 -= qm1*dx23; else nmin2 -= qm1*dx23;
<ide> THREE.SoftwareRenderer = function ( parameters ) {
<ide> if (dy31 >= 0) nmax3 -= qm1*dy31; else nmin3 -= qm1*dy31;
<ide> if (dzdx >= 0) nmaxz += qm1*dzdx; else nminz += qm1*dzdx;
<ide> if (dzdy >= 0) nmaxz += qm1*dzdy; else nminz += qm1*dzdy;
<del>// if (dtudx >= 0) nmaxtu += qm1*dtudx; else nmintu += qm1*dtudx;
<del>// if (dtudy >= 0) nmaxtu += qm1*dtudy; else nmintu += qm1*dtudy;
<add> if (dtudx >= 0) nmaxtu += qm1*dtudx; else nmintu += qm1*dtudx;
<add> if (dtudy >= 0) nmaxtu += qm1*dtudy; else nmintu += qm1*dtudy;
<ide>
<ide> // Loop through blocks
<ide> var linestep = canvasWidth - q;
<ide> THREE.SoftwareRenderer = function ( parameters ) {
<ide> var cb2 = c2;
<ide> var cb3 = c3;
<ide> var cbz = cz;
<del> var cbtuv1 = cuv1;
<del> var cbtuv2 = cuv2;
<del> var cbtuv3 = cuv3;
<add> var cbtu = ctu;
<add> var cbtv = ctv;
<ide> var qstep = -q;
<ide> var e1x = qstep * dy12;
<ide> var e2x = qstep * dy23;
<ide> var e3x = qstep * dy31;
<ide> var ezx = qstep * dzdx;
<del> var e1tu = qstep * dtv12;
<del> var e2tu = qstep * dtv23;
<del> var e3tu = qstep * dtv31;
<add> var etux = qstep * dtudx;
<add> var etvx = qstep * dtvdx;
<ide> var x0 = minx;
<ide>
<ide> for ( var y0 = miny; y0 < maxy; y0 += q ) {
<ide> THREE.SoftwareRenderer = function ( parameters ) {
<ide> cb2 += e2x;
<ide> cb3 += e3x;
<ide> cbz += ezx;
<del> cbtuv1 += e1tu;
<del> cbtuv2 += e2tu;
<del> cbtuv3 += e3tu;
<add> cbtu += etux;
<add> cbtv += etvx;
<ide>
<ide> }
<ide>
<ide> THREE.SoftwareRenderer = function ( parameters ) {
<ide> e2x = -e2x;
<ide> e3x = -e3x;
<ide> ezx = -ezx;
<del> e1tu = -e1tu;
<del> e2tu = -e2tu;
<del> e3tu = -e3tu;
<add> etux = -etux;
<add> etvx = -etvx;
<ide>
<ide> while ( 1 ) {
<ide>
<ide> THREE.SoftwareRenderer = function ( parameters ) {
<ide> cb2 += e2x;
<ide> cb3 += e3x;
<ide> cbz += ezx;
<del> cbtuv1 += e1tu;
<del> cbtuv2 += e2tu;
<del> cbtuv3 += e3tu;
<add> cbtu += etux;
<add> cbtv += etvx;
<ide>
<ide> // We're done with this block line when at least one edge completely out
<ide> // If an edge function is too small and decreasing in the current traversal
<ide> THREE.SoftwareRenderer = function ( parameters ) {
<ide> var cy1 = cb1;
<ide> var cy2 = cb2;
<ide> var cyz = cbz;
<del> var ctv1 = cbtuv1;
<del> var ctv2 = cbtuv2;
<add> var cytu = cbtu;
<add> var cytv = cbtv;
<ide>
<ide> for ( var iy = 0; iy < q; iy ++ ) {
<ide>
<ide> var cx1 = cy1;
<ide> var cx2 = cy2;
<ide> var cxz = cyz;
<del> var ctu1 = ctv1;
<del> var ctu2 = ctv2;
<add> var cxtu = cytu;
<add> var cxtv = cytv;
<ide>
<ide> for ( var ix = 0; ix < q; ix ++ ) {
<ide>
<ide> var z = cxz;
<del>
<add>
<ide> if ( z < zbuffer[ offset ] ) {
<ide> zbuffer[ offset ] = z;
<ide> var u = cx1 * scale;
<del> var v = cx2 * scale;
<del>
<del>// // Compute UV
<del>// var xPos = x0 + ix;
<del>// var yPos = y0 + iy;
<del>// var dist1 = Math.sqrt((xPos-x1)*(xPos-x1)+(yPos-y1)*(yPos-y1));
<del>// var dist2 = Math.sqrt((xPos-x2)*(xPos-x2)+(yPos-y2)*(yPos-y2));
<del>// var dist3 = Math.sqrt((xPos-x3)*(xPos-x3)+(yPos-y3)*(yPos-y3));
<del>// var distTotal = dist1 + dist2 + dist3;
<del>//
<del>// var dist1Ratio = dist1 / distTotal;
<del>// var dist2Ratio = dist2 / distTotal;
<del>// var dist3Ratio = dist3 / distTotal;
<del>//
<del>// u = tu1 * dist1Ratio + tu2 * dist2Ratio + tu3 * dist3Ratio;
<del>// v = tv1 * dist1Ratio + tv2 * dist2Ratio + tv3 * dist3Ratio;
<del>//
<del>
<del> shader( data, offset * 4, ctu1, ctu2, face, material );
<add> var v = cx2 * scale;
<add>
<add> shader( data, offset * 4, cxtu, cxtv, face, material );
<ide> }
<ide>
<ide> cx1 += dy12;
<ide> cx2 += dy23;
<ide> cxz += dzdx;
<del> ctu1 += dtv12;
<del> ctu2 += dtv23;
<add> cxtu += dtudx;
<add> cxtv += dtvdx;
<ide> offset++;
<ide>
<ide> }
<ide>
<ide> cy1 += dx12;
<ide> cy2 += dx23;
<ide> cyz += dzdy;
<del> ctv1 += dtv12;
<del> ctv2 += dtv23;
<add> cytu += dtudy;
<add> cytv += dtvdy;
<ide> offset += linestep;
<ide>
<ide> }
<ide> THREE.SoftwareRenderer = function ( parameters ) {
<ide> var cy2 = cb2;
<ide> var cy3 = cb3;
<ide> var cyz = cbz;
<del> var ctv1 = cbtuv1;
<del> var ctv2 = cbtuv2;
<del> var ctv3 = cbtuv3;
<add> var cytu = cbtu;
<add> var cytv = cbtv;
<ide>
<ide> for ( var iy = 0; iy < q; iy ++ ) {
<ide>
<ide> var cx1 = cy1;
<ide> var cx2 = cy2;
<ide> var cx3 = cy3;
<ide> var cxz = cyz;
<del> var ctu1 = ctv1;
<del> var ctu2 = ctv2;
<del> var ctu3 = ctv3;
<add> var cxtu = cytu;
<add> var cxtv = cytv;
<ide>
<ide> for ( var ix = 0; ix < q; ix ++ ) {
<ide>
<ide> if ( ( cx1 | cx2 | cx3 ) >= 0 ) {
<ide>
<del> var z = cxz;
<add> var z = cxz;
<ide>
<ide> if ( z < zbuffer[ offset ] ) {
<ide> var u = cx1 * scale;
<ide> var v = cx2 * scale;
<ide>
<del> zbuffer[ offset ] = z;
<del>
<del>// // Compute UV
<del>// var xPos = x0 + ix;
<del>// var yPos = y0 + iy;
<del>// var dist1 = Math.sqrt((xPos-x1)*(xPos-x1)+(yPos-y1)*(yPos-y1));
<del>// var dist2 = Math.sqrt((xPos-x2)*(xPos-x2)+(yPos-y2)*(yPos-y2));
<del>// var dist3 = Math.sqrt((xPos-x3)*(xPos-x3)+(yPos-y3)*(yPos-y3));
<del>// var distTotal = dist1 + dist2 + dist3;
<del>//
<del>// var dist1Ratio = dist1 / distTotal;
<del>// var dist2Ratio = dist2 / distTotal;
<del>// var dist3Ratio = dist3 / distTotal;
<del>//
<del>// u = tu1 * dist1Ratio + tu2 * dist2Ratio + tu3 * dist3Ratio;
<del>// v = tv1 * dist1Ratio + tv2 * dist2Ratio + tv3 * dist3Ratio;
<del>//
<del> shader( data, offset * 4, ctu1, ctu2, face, material );
<add> zbuffer[ offset ] = z;
<add> shader( data, offset * 4, cxtu, cxtv, face, material );
<ide>
<ide> }
<ide>
<ide> THREE.SoftwareRenderer = function ( parameters ) {
<ide> cx2 += dy23;
<ide> cx3 += dy31;
<ide> cxz += dzdx;
<del> ctu1 += dtv12;
<del> ctu2 += dtv23;
<del> ctu3 += dtv31;
<add> cxtu += dtudx;
<add> cxtv += dtvdx;
<ide> offset++;
<ide>
<ide> }
<ide> THREE.SoftwareRenderer = function ( parameters ) {
<ide> cy2 += dx23;
<ide> cy3 += dx31;
<ide> cyz += dzdy;
<del> ctv1 += dtu12;
<del> ctv2 += dtu23;
<del> ctv3 += dtu31;
<add> cytu += dtudy;
<add> cytv += dtvdy;
<ide> offset += linestep;
<ide>
<ide> }
<ide> THREE.SoftwareRenderer = function ( parameters ) {
<ide> cb2 += q*dx23;
<ide> cb3 += q*dx31;
<ide> cbz += q*dzdy;
<del> cbtuv1 += q*dtu12;
<del> cbtuv2 += q*dtu23;
<del> cbtuv3 += q*dtu31;
<add> cbtu += q*dtudy;
<add> cbtv += q*dtvdy;
<ide> }
<ide>
<ide> } | 1 |
Text | Text | add note about uncloneable objects | 6ab768ea4a1418541ef1d971df4a8c0c2913f9b2 | <ide><path>doc/api/worker_threads.md
<ide> const otherChannel = new MessageChannel();
<ide> port2.postMessage({ port: otherChannel.port1 }, [ otherChannel.port1 ]);
<ide> ```
<ide>
<del>Because the object cloning uses the structured clone algorithm,
<del>non-enumerable properties, property accessors, and object prototypes are
<del>not preserved. In particular, [`Buffer`][] objects are read as
<del>plain [`Uint8Array`][]s on the receiving side.
<del>
<ide> The message object is cloned immediately, and can be modified after
<ide> posting without having side effects.
<ide>
<ide> The `ArrayBuffer`s for `Buffer` instances created using
<ide> transferred but doing so renders all other existing views of
<ide> those `ArrayBuffer`s unusable.
<ide>
<add>#### Considerations when cloning objects with prototypes, classes, and accessors
<add>
<add>Because object cloning uses the [HTML structured clone algorithm][],
<add>non-enumerable properties, property accessors, and object prototypes are
<add>not preserved. In particular, [`Buffer`][] objects will be read as
<add>plain [`Uint8Array`][]s on the receiving side, and instances of JavaScript
<add>classes will be cloned as plain JavaScript objects.
<add>
<add>```js
<add>const b = Symbol('b');
<add>
<add>class Foo {
<add> #a = 1;
<add> constructor() {
<add> this[b] = 2;
<add> this.c = 3;
<add> }
<add>
<add> get d() { return 4; }
<add>}
<add>
<add>const { port1, port2 } = new MessageChannel();
<add>
<add>port1.onmessage = ({ data }) => console.log(data);
<add>
<add>port2.postMessage(new Foo());
<add>
<add>// Prints: { c: 3 }
<add>```
<add>
<add>This limitation extends to many built-in objects, such as the global `URL`
<add>object:
<add>
<add>```js
<add>const { port1, port2 } = new MessageChannel();
<add>
<add>port1.onmessage = ({ data }) => console.log(data);
<add>
<add>port2.postMessage(new URL('https://example.org'));
<add>
<add>// Prints: { }
<add>```
<add>
<ide> ### `port.ref()`
<ide> <!-- YAML
<ide> added: v10.5.0 | 1 |
Python | Python | set version to v2.1.0a8.dev0 | 7f02464494b236c8a1db108aa81cd49c24af34c1 | <ide><path>spacy/about.py
<ide> # fmt: off
<ide>
<ide> __title__ = "spacy-nightly"
<del>__version__ = "2.1.0a7"
<add>__version__ = "2.1.0a8.dev0"
<ide> __summary__ = "Industrial-strength Natural Language Processing (NLP) with Python and Cython"
<ide> __uri__ = "https://spacy.io"
<ide> __author__ = "Explosion AI"
<ide> __email__ = "[email protected]"
<ide> __license__ = "MIT"
<del>__release__ = True
<add>__release__ = False
<ide>
<ide> __download_url__ = "https://github.com/explosion/spacy-models/releases/download"
<ide> __compatibility__ = "https://raw.githubusercontent.com/explosion/spacy-models/master/compatibility.json" | 1 |
Javascript | Javascript | add test for transition.text | aeae92ca5c3ead614f23e952d454292f14988b37 | <ide><path>test/core/transition-test-text.js
<add>require("../env");
<add>require("../../d3");
<add>
<add>var assert = require("assert");
<add>
<add>module.exports = {
<add> topic: function() {
<add> return d3.select("body").append("div").text("foo").transition().text("bar");
<add> },
<add> "sets the text tween": function(div) {
<add> assert.typeOf(div.tween("text"), "function");
<add> },
<add> "start": {
<add> topic: function(div) {
<add> var cb = this.callback,
<add> tween = div.tween("text");
<add> div.tween("text", function() {
<add> var result = tween.apply(this, arguments);
<add> cb(null, {transition: div, tween: result});
<add> return result;
<add> });
<add> },
<add> "sets the text content as a string": function(result) {
<add> assert.equal(result.transition[0][0].node.textContent, "bar");
<add> },
<add> "does not interpolate text": function(result) {
<add> assert.isTrue(!result.tween);
<add> }
<add> }
<add>};
<ide><path>test/core/transition-test.js
<ide> suite.addBatch({
<ide> // Content
<ide> "attr": require("./transition-test-attr"),
<ide> "style": require("./transition-test-style"),
<del> // text
<add> "text": require("./transition-test-text"),
<ide> // remove
<ide>
<ide> // Animation | 2 |
Javascript | Javascript | fix domproperty bitmask checking | 0e28f5e6d7fd1a960b92637053d2bb0859b67b36 | <ide><path>src/browser/ui/dom/DOMProperty.js
<ide>
<ide> var invariant = require('invariant');
<ide>
<add>function checkMask(value, bitmask) {
<add> return (value & bitmask) === bitmask;
<add>}
<add>
<ide> var DOMPropertyInjection = {
<ide> /**
<ide> * Mapping from normalized, camelcased property names to a configuration that
<ide> var DOMPropertyInjection = {
<ide>
<ide> var propConfig = Properties[propName];
<ide> DOMProperty.mustUseAttribute[propName] =
<del> propConfig & DOMPropertyInjection.MUST_USE_ATTRIBUTE;
<add> checkMask(propConfig, DOMPropertyInjection.MUST_USE_ATTRIBUTE);
<ide> DOMProperty.mustUseProperty[propName] =
<del> propConfig & DOMPropertyInjection.MUST_USE_PROPERTY;
<add> checkMask(propConfig, DOMPropertyInjection.MUST_USE_PROPERTY);
<ide> DOMProperty.hasSideEffects[propName] =
<del> propConfig & DOMPropertyInjection.HAS_SIDE_EFFECTS;
<add> checkMask(propConfig, DOMPropertyInjection.HAS_SIDE_EFFECTS);
<ide> DOMProperty.hasBooleanValue[propName] =
<del> propConfig & DOMPropertyInjection.HAS_BOOLEAN_VALUE;
<add> checkMask(propConfig, DOMPropertyInjection.HAS_BOOLEAN_VALUE);
<ide> DOMProperty.hasNumericValue[propName] =
<del> propConfig & DOMPropertyInjection.HAS_NUMERIC_VALUE;
<add> checkMask(propConfig, DOMPropertyInjection.HAS_NUMERIC_VALUE);
<ide> DOMProperty.hasPositiveNumericValue[propName] =
<del> propConfig & DOMPropertyInjection.HAS_POSITIVE_NUMERIC_VALUE;
<add> checkMask(propConfig, DOMPropertyInjection.HAS_POSITIVE_NUMERIC_VALUE);
<ide> DOMProperty.hasOverloadedBooleanValue[propName] =
<del> propConfig & DOMPropertyInjection.HAS_OVERLOADED_BOOLEAN_VALUE;
<add> checkMask(propConfig, DOMPropertyInjection.HAS_OVERLOADED_BOOLEAN_VALUE);
<ide>
<ide> invariant(
<ide> !DOMProperty.mustUseAttribute[propName] ||
<ide><path>src/browser/ui/dom/__tests__/DOMPropertyOperations-test.js
<ide> describe('DOMPropertyOperations', function() {
<ide> )).toBe('');
<ide> });
<ide>
<add> it('should create markup for numeric properties', function() {
<add> expect(DOMPropertyOperations.createMarkupForProperty(
<add> 'start',
<add> 5
<add> )).toBe('start="5"');
<add>
<add> expect(DOMPropertyOperations.createMarkupForProperty(
<add> 'start',
<add> 0
<add> )).toBe('start="0"');
<add>
<add> expect(DOMPropertyOperations.createMarkupForProperty(
<add> 'size',
<add> 0
<add> )).toBe('');
<add>
<add> expect(DOMPropertyOperations.createMarkupForProperty(
<add> 'size',
<add> 1
<add> )).toBe('size="1"');
<add> });
<add>
<ide> });
<ide>
<ide> describe('setValueForProperty', function() { | 2 |
Javascript | Javascript | stop mouseup propagation while inspecting | 18e337707a9dbfcd380deced8901cd1ec880d496 | <ide><path>src/backend/agent.js
<ide> export default class Agent extends EventEmitter {
<ide> startInspectingDOM = () => {
<ide> window.addEventListener('click', this._onClick, true);
<ide> window.addEventListener('mousedown', this._onMouseDown, true);
<add> window.addEventListener('mouseup', this._onMouseUp, true);
<ide> window.addEventListener('mouseover', this._onMouseOver, true);
<ide> };
<ide>
<ide> export default class Agent extends EventEmitter {
<ide>
<ide> window.removeEventListener('click', this._onClick, true);
<ide> window.removeEventListener('mousedown', this._onMouseDown, true);
<add> window.removeEventListener('mouseup', this._onMouseUp, true);
<ide> window.removeEventListener('mouseover', this._onMouseOver, true);
<ide> };
<ide>
<ide> export default class Agent extends EventEmitter {
<ide> }
<ide> };
<ide>
<add> // While we don't do anything here, this makes choosing
<add> // the inspected element less invasive and less likely
<add> // to dismiss e.g. a context menu.
<add> _onMouseUp = (event: MouseEvent) => {
<add> event.preventDefault();
<add> event.stopPropagation();
<add> };
<add>
<ide> _onMouseOver = (event: MouseEvent) => {
<ide> event.preventDefault();
<ide> event.stopPropagation(); | 1 |
Python | Python | ignore upcoming_changes from refguide | 5f332386617ba206ce8a448d0bc73bb2507ef5c5 | <ide><path>tools/refguide_check.py
<ide> 'changelog',
<ide> 'doc/release',
<ide> 'doc/source/release',
<add> 'doc/release/upcoming_changes',
<ide> 'c-info.ufunc-tutorial.rst',
<ide> 'c-info.python-as-glue.rst',
<ide> 'f2py.getting-started.rst', | 1 |
PHP | PHP | add return statement | 2ce1ed4eca81574d6929e350d5b9a6444797a0bb | <ide><path>src/Illuminate/Queue/SyncQueue.php
<ide> public function push($job, $data = '', $queue = null)
<ide> *
<ide> * @param \Illuminate\Queue\Jobs\Job $queueJob
<ide> * @param \Exception $e
<add> * @return void
<ide> *
<ide> * @throws \Exception
<ide> */ | 1 |
Text | Text | add model card | 72d6c9c68ba19b2e991b0d7a32989410399b33f5 | <ide><path>model_cards/sarnikowski/electra-small-discriminator-da-256-cased/README.md
<add>---
<add>language: da
<add>license: cc-by-4.0
<add>---
<add>
<add># Danish ELECTRA small (cased)
<add>
<add>An [ELECTRA](https://arxiv.org/abs/2003.10555) model pretrained on a custom Danish corpus (~17.5gb).
<add>For details regarding data sources and training procedure, along with benchmarks on downstream tasks, go to: https://github.com/sarnikowski/danish_transformers/tree/main/electra
<add>
<add>## Usage
<add>
<add>```python
<add>from transformers import AutoTokenizer, AutoModel
<add>
<add>tokenizer = AutoTokenizer.from_pretrained("sarnikowski/electra-small-discriminator-da-256-cased")
<add>model = AutoModel.from_pretrained("sarnikowski/electra-small-discriminator-da-256-cased")
<add>```
<add>
<add>## Questions?
<add>
<add>If you have any questions feel free to open an issue on the [danish_transformers](https://github.com/sarnikowski/danish_transformers) repository, or send an email to [email protected] | 1 |
Python | Python | use lemmatizer in code, not from downloaded model | f70be447464219db6ce306140844cf28fdc82843 | <ide><path>spacy/en/__init__.py
<ide> class Defaults(Language.Defaults):
<ide> tag_map = TAG_MAP
<ide> stop_words = STOP_WORDS
<ide>
<add> lemma_rules = dict(LEMMA_RULES)
<add> lemma_index = dict(LEMMA_INDEX)
<add> lemma_exc = dict(LEMMA_EXC)
<add>
<ide>
<ide> def __init__(self, **overrides):
<ide> # Make a special-case hack for loading the GloVe vectors, to support
<ide><path>spacy/en/lemmatizer/__init__.py
<ide> "adj": ADJECTIVES_IRREG,
<ide> "adv": ADVERBS_IRREG,
<ide> "noun": NOUNS_IRREG,
<del> "verbs": VERBS_IRREG
<add> "verb": VERBS_IRREG
<ide> }
<ide>
<ide>
<ide><path>spacy/language.py
<ide> from .syntax.parser import get_templates
<ide> from .syntax.nonproj import PseudoProjectivity
<ide> from .pipeline import DependencyParser, EntityRecognizer
<add>from .pipeline import BeamDependencyParser, BeamEntityRecognizer
<ide> from .syntax.arc_eager import ArcEager
<ide> from .syntax.ner import BiluoPushDown
<ide>
<ide>
<ide> class BaseDefaults(object):
<ide> @classmethod
<ide> def create_lemmatizer(cls, nlp=None):
<del> if nlp is None or nlp.path is None:
<del> return Lemmatizer({}, {}, {})
<del> else:
<del> return Lemmatizer.load(nlp.path, rules=cls.lemma_rules)
<add> return Lemmatizer(cls.lemma_index, cls.lemma_exc, cls.lemma_rules)
<ide>
<ide> @classmethod
<ide> def create_vocab(cls, nlp=None):
<ide> def create_pipeline(self, nlp=None):
<ide> stop_words = set()
<ide>
<ide> lemma_rules = {}
<add> lemma_exc = {}
<add> lemma_index = {}
<ide>
<ide> lex_attr_getters = {
<ide> attrs.LOWER: lambda string: string.lower(), | 3 |
Javascript | Javascript | send a bad record only after connection done | 1f4c5bdbcab0ec89cabdc3d598d6bf2ab4f1894c | <ide><path>test/parallel/test-tls-alert-handling.js
<ide> server.listen(0, common.mustCall(function() {
<ide> sendClient();
<ide> }));
<ide>
<add>server.on('tlsClientError', common.mustNotCall());
<add>
<add>server.on('error', common.mustNotCall());
<ide>
<ide> function sendClient() {
<ide> const client = tls.connect(server.address().port, {
<ide> function sendBADTLSRecord() {
<ide> socket: socket,
<ide> rejectUnauthorized: false
<ide> }, common.mustCall(function() {
<del> socket.write(BAD_RECORD);
<del> socket.end();
<add> client.write('x');
<add> client.on('data', (data) => {
<add> socket.end(BAD_RECORD);
<add> });
<ide> }));
<ide> client.on('error', common.mustCall((err) => {
<ide> assert.strictEqual(err.code, 'ERR_SSL_TLSV1_ALERT_PROTOCOL_VERSION'); | 1 |
Java | Java | fix crash when resolveview fails to find a view | 8e91843cc7da4a791e5fe78078998f1c30592863 | <ide><path>ReactAndroid/src/main/java/com/facebook/react/uimanager/NativeViewHierarchyManager.java
<ide> package com.facebook.react.uimanager;
<ide>
<ide> import android.content.res.Resources;
<add>import android.util.Log;
<ide> import android.util.SparseArray;
<ide> import android.util.SparseBooleanArray;
<ide> import android.view.Menu;
<ide> @NotThreadSafe
<ide> public class NativeViewHierarchyManager {
<ide>
<add> private static final String TAG = NativeViewHierarchyManager.class.getSimpleName();
<add>
<ide> private final AnimationRegistry mAnimationRegistry;
<ide> private final SparseArray<View> mTagsToViews;
<ide> private final SparseArray<ViewManager> mTagsToViewManagers;
<ide> public void setLayoutAnimationEnabled(boolean enabled) {
<ide> public void updateProperties(int tag, ReactStylesDiffMap props) {
<ide> UiThreadUtil.assertOnUiThread();
<ide>
<del> ViewManager viewManager = resolveViewManager(tag);
<del> View viewToUpdate = resolveView(tag);
<del> viewManager.updateProperties(viewToUpdate, props);
<add> try {
<add> ViewManager viewManager = resolveViewManager(tag);
<add> View viewToUpdate = resolveView(tag);
<add> viewManager.updateProperties(viewToUpdate, props);
<add> } catch (IllegalViewOperationException e) {
<add> Log.e(TAG, "Unable to update properties for view tag " + tag, e);
<add> }
<ide> }
<ide>
<ide> public void updateViewExtraData(int tag, Object extraData) { | 1 |
Text | Text | fix punctuation in tile | df62159296e9de8b04653ba999a32f9be7bb2a73 | <ide><path>README.md
<del>[jQuery](http://jquery.com/) - New Wave JavaScript
<add>[jQuery](http://jquery.com/) — New Wave JavaScript
<ide> ==================================================
<ide>
<ide> Contribution Guides | 1 |
Text | Text | fix punctuation marks and articles | 3a0974f7e7ae4535e24adb65f39ae38177ceb865 | <ide><path>guide/english/mathematics/2-by-2-determinants/index.md
<ide> title: 2 by 2 Determinants
<ide>
<ide> ## 2 by 2 Determinants
<ide>
<del>In linear algebra, the determinant of a two-by-two matrix is a useful quantity.Mostly it is used to calculate the area of the given quadilateral(convex polygons only) and is also a easy representation of a quadilateral(convex polygons only) to be stored in computers as arrays. Scientists, engineers, and mathematicians use determinants in many everyday applications including image and graphic processing.
<add>In linear algebra, the determinant of a two-by-two matrix is a useful quantity. Mostly it is used to calculate the area of the given quadilateral (convex polygons only) and is also an easy representation of a quadilateral(convex polygons only) to be stored in computers as arrays. Scientists, engineers, and mathematicians use determinants in many everyday applications including image and graphic processing.
<ide>
<ide> Calculating the determinant of a square two-by-two matrix is simple, and is the basis of the [Laplace formula](https://en.wikipedia.org/wiki/Laplace_expansion) used for calculating determinants for larger square matrices.
<ide>
<ide> Given a matrix A, the determinant of A (written as |A|) is given by the followin
<ide>
<ide> The rows and vectors of a 2 by 2 matrix can be associated with points on a cartesian plane, such that each row forms a 2D vector. These two vectors form a parallelogram, as shown in the image below.
<ide> PROOF:
<del>Let the vectors be M(a,b),N(c,d) originating from origin in a 2-D plane with an angle (*theta*>0) between them(head of one vector touching tail of another vector) . But in here it doesn't matter because sin(theta)=sin(2(pi)-theta).Then the other point is P(a+c,b+d).The area of the parallelogram is perpendicular distance from one point say N(c,d) to the base vector, M(a,b) multiplied by the length of the base vector, |M(a,b)|. The parallelogram consists of two triangles hence, the area is two times of a triangle.
<add>Let the vectors be M(a,b),N(c,d) originating from origin in a 2-D plane with an angle (*theta*>0) between them(head of one vector touching tail of another vector). But in here it doesn't matter because sin(theta)=sin(2(pi)-theta). Then the other point is P(a+c,b+d). The area of the parallelogram is perpendicular distance from one point say N(c,d) to the base vector, M(a,b) multiplied by the length of the base vector, |M(a,b)|. The parallelogram consists of two triangles hence, the area is two times of a triangle.
<ide> Let the perpendicular distance be h
<ide> h=|N(c,d)|* sin(*theta*(angle between two vectors))
<ide> b=|M(a,b)| | 1 |
Javascript | Javascript | add firstdayofweek, firstdayofyear locale getters | 4b378d1fd1e79e4863b23ec64ffc5c08b9651878 | <ide><path>moment.js
<ide> doy : 6 // The week that contains Jan 1st is the first week of the year.
<ide> },
<ide>
<add> firstDayOfWeek : function () {
<add> return this._week.dow;
<add> },
<add>
<add> firstDayOfYear : function () {
<add> return this._week.doy;
<add> },
<add>
<ide> _invalidDate: 'Invalid date',
<ide> invalidDate: function () {
<ide> return this._invalidDate;
<ide><path>test/moment/locale.js
<ide> exports.locale = {
<ide> test.done();
<ide> },
<ide>
<add> 'firstDayOfWeek firstDayOfYear locale getters' : function (test) {
<add> moment.locale('something', {week: {dow: 3, doy: 4}});
<add> moment.locale('something');
<add> test.equal(moment.localeData().firstDayOfWeek(), 3, 'firstDayOfWeek');
<add> test.equal(moment.localeData().firstDayOfYear(), 4, 'firstDayOfYear');
<add>
<add> test.done();
<add> },
<add>
<ide> 'instance locale method' : function (test) {
<ide> moment.locale('en');
<ide> | 2 |
Javascript | Javascript | cover node entry type in perf_hooks | 74ec01106d95d850417db71fb9e05a53f61d6017 | <ide><path>test/parallel/test-performanceobserver.js
<ide> assert.strictEqual(counts[NODE_PERFORMANCE_ENTRY_TYPE_FUNCTION], 0);
<ide> countdown.dec();
<ide> }
<ide> assert.strictEqual(counts[NODE_PERFORMANCE_ENTRY_TYPE_MARK], 0);
<del> observer.observe({ entryTypes: ['mark'] });
<add> assert.strictEqual(counts[NODE_PERFORMANCE_ENTRY_TYPE_NODE], 0);
<add> observer.observe({ entryTypes: ['mark', 'node'] });
<ide> assert.strictEqual(counts[NODE_PERFORMANCE_ENTRY_TYPE_MARK], 1);
<add> assert.strictEqual(counts[NODE_PERFORMANCE_ENTRY_TYPE_NODE], 1);
<ide> performance.mark('test1');
<ide> performance.mark('test2');
<ide> performance.mark('test3'); | 1 |
Text | Text | fix indentation + add backticks [ci skip] | c27991fc6387444070ec6a229fad37e1b413f04c | <ide><path>activesupport/CHANGELOG.md
<ide> * Add default option to module and class attribute accessors.
<ide>
<del> mattr_accessor :settings, default: {}
<add> mattr_accessor :settings, default: {}
<ide>
<ide> Works for `mattr_reader`, `mattr_writer`, `cattr_accessor`, `cattr_reader`,
<ide> and `cattr_writer` as well.
<ide>
<ide> *Shota Iguchi*
<ide>
<del>* Add default option to class_attribute. Before:
<add>* Add default option to `class_attribute`.
<add>
<add> Before:
<ide>
<ide> class_attribute :settings
<ide> self.settings = {} | 1 |
Text | Text | adjust docs example [ci skip] | 8b4a0fabbb65fa701261bbb5136d8cd15f65a560 | <ide><path>website/docs/usage/rule-based-matching.md
<ide> matcher = Matcher(nlp.vocab, validate=True)
<ide> # Add match ID "HelloWorld" with unsupported attribute CASEINSENSITIVE
<ide> pattern = [{"LOWER": "hello"}, {"IS_PUNCT": True}, {"CASEINSENSITIVE": "world"}]
<ide> matcher.add("HelloWorld", None, pattern)
<del>
<del># Raises an error:
<del>#
<del># spacy.errors.MatchPatternError: Invalid token patterns for matcher rule 'HelloWorld'
<add># 🚨 Raises an error:
<add># MatchPatternError: Invalid token patterns for matcher rule 'HelloWorld'
<ide> # Pattern 0:
<ide> # - Additional properties are not allowed ('CASEINSENSITIVE' was unexpected) [2]
<ide>
<ide> doc = nlp(u"MyCorp Inc. is a company in the U.S.")
<ide> print([(ent.text, ent.label_) for ent in doc.ents])
<ide> ```
<ide>
<del>#### Validating and debugging EntityRuler patterns {#entityruler-pattern-validation}
<add>#### Validating and debugging EntityRuler patterns {#entityruler-pattern-validation new="2.1.8"}
<ide>
<ide> The `EntityRuler` can validate patterns against a JSON schema with the option
<del>`validate=True`. See details under [Validating and debugging
<del>patterns](#pattern-validation).
<add>`validate=True`. See details under
<add>[Validating and debugging patterns](#pattern-validation).
<ide>
<ide> ```python
<ide> ruler = EntityRuler(nlp, validate=True) | 1 |
Go | Go | add some lines back | a066b94ef0b4e7d90a6418429b056883e407b665 | <ide><path>daemon/graphdriver/driver.go
<ide> type ProtoDriver interface {
<ide> // String returns a string representation of this driver.
<ide> String() string
<ide> // Create creates a new, empty, filesystem layer with the
<add> // specified id and parent. Parent may be "".
<ide> Create(id, parent string) error
<ide> // Remove attempts to remove the filesystem layer with this id.
<ide> Remove(id string) error | 1 |
Javascript | Javascript | avoid emit() eager deopt | e52fee50a08c9d9ca6215149cc8e8c0b174e32dd | <ide><path>lib/events.js
<ide> EventEmitter.prototype.emit = function emit(type) {
<ide>
<ide> // If there is no 'error' event listener then throw.
<ide> if (doError) {
<del> er = arguments[1];
<add> if (arguments.length > 1)
<add> er = arguments[1];
<ide> if (domain) {
<ide> if (!er)
<ide> er = new Error('Uncaught, unspecified "error" event'); | 1 |
Text | Text | add a security note to the 1.3.2 log | b6fd184a93937765a7a5d13de8e676880ea75fa5 | <ide><path>CHANGELOG.md
<ide> [#9926](https://github.com/angular/angular.js/issues/9926), [#9871](https://github.com/angular/angular.js/issues/9871))
<ide>
<ide>
<add>## Security Note
<add>
<add>This release also contains security fixes for expression sandbox bypasses.
<add>
<add>These issues affect only applications with known server-side XSS holes that are also using [CSP](https://developer.mozilla.org/en-US/docs/Web/Security/CSP) to secure their client-side code. If your application falls into this rare category, we recommend updating your version of Angular.
<add>
<add>We'd like to thank security researches [Sebastian Lekies](https://twitter.com/sebastianlekies), [Jann Horn](http://thejh.net/), and [Gábor Molnár](https://twitter.com/molnar_g) for reporting these issues to us.
<add>
<add>We also added a documentation page focused on security, which contains some of the best practices, DOs and DON'Ts. Please check out [https://docs.angularjs.org/guide/security](https://docs.angularjs.org/guide/security).
<add>
<ide>
<ide>
<ide> <a name="1.3.1"></a> | 1 |
Java | Java | respect context path in webmvc.fn & webflux.fn | d550d344d55e0b410f517069bb7d6e4cd816617e | <ide><path>spring-test/src/main/java/org/springframework/mock/web/reactive/function/server/MockServerRequest.java
<ide> import org.springframework.http.MediaType;
<ide> import org.springframework.http.codec.HttpMessageReader;
<ide> import org.springframework.http.codec.multipart.Part;
<del>import org.springframework.http.server.PathContainer;
<ide> import org.springframework.http.server.RequestPath;
<ide> import org.springframework.http.server.reactive.ServerHttpRequest;
<ide> import org.springframework.lang.Nullable;
<ide> public final class MockServerRequest implements ServerRequest {
<ide>
<ide> private final URI uri;
<ide>
<del> private final RequestPath pathContainer;
<add> private final RequestPath requestPath;
<ide>
<ide> private final MockHeaders headers;
<ide>
<ide> public final class MockServerRequest implements ServerRequest {
<ide> private final WebSession session;
<ide>
<ide> @Nullable
<del> private Principal principal;
<add> private final Principal principal;
<ide>
<ide> @Nullable
<ide> private final InetSocketAddress remoteAddress;
<ide> private MockServerRequest(HttpMethod method, URI uri, String contextPath, MockHe
<ide>
<ide> this.method = method;
<ide> this.uri = uri;
<del> this.pathContainer = RequestPath.parse(uri, contextPath);
<add> this.requestPath = RequestPath.parse(uri, contextPath);
<ide> this.headers = headers;
<ide> this.cookies = cookies;
<ide> this.body = body;
<ide> public UriBuilder uriBuilder() {
<ide> }
<ide>
<ide> @Override
<del> public PathContainer pathContainer() {
<del> return this.pathContainer;
<add> public RequestPath requestPath() {
<add> return this.requestPath;
<ide> }
<ide>
<ide> @Override
<ide><path>spring-web/src/main/java/org/springframework/web/util/pattern/PathPattern.java
<ide> else if (!hasLength(pathContainer)) {
<ide> @Nullable
<ide> public PathRemainingMatchInfo matchStartOfPath(PathContainer pathContainer) {
<ide> if (this.head == null) {
<del> return new PathRemainingMatchInfo(pathContainer);
<add> return new PathRemainingMatchInfo(EMPTY_PATH, pathContainer);
<ide> }
<ide> else if (!hasLength(pathContainer)) {
<ide> return null;
<ide> else if (!hasLength(pathContainer)) {
<ide> return null;
<ide> }
<ide> else {
<del> PathRemainingMatchInfo info;
<add> PathContainer pathMatched;
<add> PathContainer pathRemaining;
<ide> if (matchingContext.remainingPathIndex == pathContainer.elements().size()) {
<del> info = new PathRemainingMatchInfo(EMPTY_PATH, matchingContext.getPathMatchResult());
<add> pathMatched = pathContainer;
<add> pathRemaining = EMPTY_PATH;
<ide> }
<ide> else {
<del> info = new PathRemainingMatchInfo(pathContainer.subPath(matchingContext.remainingPathIndex),
<del> matchingContext.getPathMatchResult());
<add> pathMatched = pathContainer.subPath(0, matchingContext.remainingPathIndex);
<add> pathRemaining = pathContainer.subPath(matchingContext.remainingPathIndex);
<ide> }
<del> return info;
<add> return new PathRemainingMatchInfo(pathMatched, pathRemaining, matchingContext.getPathMatchResult());
<ide> }
<ide> }
<ide>
<ide> public String toString() {
<ide> */
<ide> public static class PathRemainingMatchInfo {
<ide>
<add> private final PathContainer pathMatched;
<add>
<ide> private final PathContainer pathRemaining;
<ide>
<ide> private final PathMatchInfo pathMatchInfo;
<ide>
<ide>
<del> PathRemainingMatchInfo(PathContainer pathRemaining) {
<del> this(pathRemaining, PathMatchInfo.EMPTY);
<add> PathRemainingMatchInfo(PathContainer pathMatched, PathContainer pathRemaining) {
<add> this(pathMatched, pathRemaining, PathMatchInfo.EMPTY);
<ide> }
<ide>
<del> PathRemainingMatchInfo(PathContainer pathRemaining, PathMatchInfo pathMatchInfo) {
<add> PathRemainingMatchInfo(PathContainer pathMatched, PathContainer pathRemaining,
<add> PathMatchInfo pathMatchInfo) {
<ide> this.pathRemaining = pathRemaining;
<add> this.pathMatched = pathMatched;
<ide> this.pathMatchInfo = pathMatchInfo;
<ide> }
<ide>
<add> /**
<add> * Return the part of a path that was matched by a pattern.
<add> * @since 5.3
<add> */
<add> public PathContainer getPathMatched() {
<add> return this.pathMatched;
<add> }
<add>
<ide> /**
<ide> * Return the part of a path that was not matched by a pattern.
<ide> */
<ide><path>spring-web/src/test/java/org/springframework/web/util/pattern/PathPatternTests.java
<ide> public void pathRemainingEnhancements_spr15419() {
<ide> pp = parse("/{this}/{one}/{here}");
<ide> pri = getPathRemaining(pp, "/foo/bar/goo/boo");
<ide> assertThat(pri.getPathRemaining().value()).isEqualTo("/boo");
<add> assertThat(pri.getPathMatched().value()).isEqualTo("/foo/bar/goo");
<ide> assertThat(pri.getUriVariables().get("this")).isEqualTo("foo");
<ide> assertThat(pri.getUriVariables().get("one")).isEqualTo("bar");
<ide> assertThat(pri.getUriVariables().get("here")).isEqualTo("goo");
<ide>
<ide> pp = parse("/aaa/{foo}");
<ide> pri = getPathRemaining(pp, "/aaa/bbb");
<ide> assertThat(pri.getPathRemaining().value()).isEqualTo("");
<add> assertThat(pri.getPathMatched().value()).isEqualTo("/aaa/bbb");
<ide> assertThat(pri.getUriVariables().get("foo")).isEqualTo("bbb");
<ide>
<ide> pp = parse("/aaa/bbb");
<ide> pri = getPathRemaining(pp, "/aaa/bbb");
<ide> assertThat(pri.getPathRemaining().value()).isEqualTo("");
<add> assertThat(pri.getPathMatched().value()).isEqualTo("/aaa/bbb");
<ide> assertThat(pri.getUriVariables().size()).isEqualTo(0);
<ide>
<ide> pp = parse("/*/{foo}/b*");
<ide><path>spring-webflux/src/main/java/org/springframework/web/reactive/function/server/DefaultServerRequest.java
<ide> import org.springframework.http.MediaType;
<ide> import org.springframework.http.codec.HttpMessageReader;
<ide> import org.springframework.http.codec.multipart.Part;
<del>import org.springframework.http.server.PathContainer;
<add>import org.springframework.http.server.RequestPath;
<ide> import org.springframework.http.server.reactive.ServerHttpRequest;
<ide> import org.springframework.http.server.reactive.ServerHttpResponse;
<ide> import org.springframework.lang.Nullable;
<ide> public UriBuilder uriBuilder() {
<ide> }
<ide>
<ide> @Override
<del> public PathContainer pathContainer() {
<add> public RequestPath requestPath() {
<ide> return request().getPath();
<ide> }
<ide>
<ide><path>spring-webflux/src/main/java/org/springframework/web/reactive/function/server/PathResourceLookupFunction.java
<ide> public PathResourceLookupFunction(String pattern, Resource location) {
<ide>
<ide> @Override
<ide> public Mono<Resource> apply(ServerRequest request) {
<del> PathContainer pathContainer = request.pathContainer();
<add> PathContainer pathContainer = request.requestPath().pathWithinApplication();
<ide> if (!this.pattern.matches(pathContainer)) {
<ide> return Mono.empty();
<ide> }
<ide><path>spring-webflux/src/main/java/org/springframework/web/reactive/function/server/RequestPredicates.java
<ide> import java.net.InetSocketAddress;
<ide> import java.net.URI;
<ide> import java.security.Principal;
<del>import java.util.ArrayList;
<ide> import java.util.Arrays;
<ide> import java.util.Collections;
<ide> import java.util.EnumSet;
<ide> import org.springframework.http.codec.HttpMessageReader;
<ide> import org.springframework.http.codec.multipart.Part;
<ide> import org.springframework.http.server.PathContainer;
<add>import org.springframework.http.server.RequestPath;
<ide> import org.springframework.http.server.reactive.ServerHttpRequest;
<ide> import org.springframework.lang.NonNull;
<ide> import org.springframework.lang.Nullable;
<ide> public PathPatternPredicate(PathPattern pattern) {
<ide>
<ide> @Override
<ide> public boolean test(ServerRequest request) {
<del> PathContainer pathContainer = request.pathContainer();
<add> PathContainer pathContainer = request.requestPath().pathWithinApplication();
<ide> PathPattern.PathMatchInfo info = this.pattern.matchAndExtract(pathContainer);
<ide> traceMatch("Pattern", this.pattern.getPatternString(), request.path(), info != null);
<ide> if (info != null) {
<ide> private static void mergeAttributes(ServerRequest request, Map<String, String> v
<ide>
<ide> @Override
<ide> public Optional<ServerRequest> nest(ServerRequest request) {
<del> return Optional.ofNullable(this.pattern.matchStartOfPath(request.pathContainer()))
<add> return Optional.ofNullable(this.pattern.matchStartOfPath(request.requestPath().pathWithinApplication()))
<ide> .map(info -> new SubPathServerRequestWrapper(request, info, this.pattern));
<ide> }
<ide>
<ide> private static class SubPathServerRequestWrapper implements ServerRequest {
<ide>
<ide> private final ServerRequest request;
<ide>
<del> private final PathContainer pathContainer;
<add> private final RequestPath requestPath;
<ide>
<ide> private final Map<String, Object> attributes;
<ide>
<ide> public SubPathServerRequestWrapper(ServerRequest request,
<ide> PathPattern.PathRemainingMatchInfo info, PathPattern pattern) {
<ide> this.request = request;
<del> this.pathContainer = new SubPathContainer(info.getPathRemaining());
<add> this.requestPath = requestPath(request.requestPath(), info);
<ide> this.attributes = mergeAttributes(request, info.getUriVariables(), pattern);
<ide> }
<ide>
<add> private static RequestPath requestPath(RequestPath original, PathPattern.PathRemainingMatchInfo info) {
<add> StringBuilder contextPath = new StringBuilder(original.contextPath().value());
<add> contextPath.append(info.getPathMatched().value());
<add> int length = contextPath.length();
<add> if (length > 0 && contextPath.charAt(length - 1) == '/') {
<add> contextPath.setLength(length - 1);
<add> }
<add> return original.modifyContextPath(contextPath.toString());
<add> }
<add>
<ide> private static Map<String, Object> mergeAttributes(ServerRequest request,
<ide> Map<String, String> pathVariables, PathPattern pattern) {
<ide> Map<String, Object> result = new ConcurrentHashMap<>(request.attributes());
<ide> public UriBuilder uriBuilder() {
<ide> }
<ide>
<ide> @Override
<del> public String path() {
<del> return this.pathContainer.value();
<del> }
<del>
<del> @Override
<del> public PathContainer pathContainer() {
<del> return this.pathContainer;
<add> public RequestPath requestPath() {
<add> return this.requestPath;
<ide> }
<ide>
<ide> @Override
<ide> public String toString() {
<ide> return method() + " " + path();
<ide> }
<ide>
<del> private static class SubPathContainer implements PathContainer {
<del>
<del> private static final PathContainer.Separator SEPARATOR = () -> "/";
<del>
<del>
<del> private final String value;
<del>
<del> private final List<Element> elements;
<del>
<del> public SubPathContainer(PathContainer original) {
<del> this.value = prefixWithSlash(original.value());
<del> this.elements = prependWithSeparator(original.elements());
<del> }
<del>
<del> private static String prefixWithSlash(String path) {
<del> if (!path.startsWith("/")) {
<del> path = "/" + path;
<del> }
<del> return path;
<del> }
<del>
<del> private static List<Element> prependWithSeparator(List<Element> elements) {
<del> List<Element> result = new ArrayList<>(elements);
<del> if (result.isEmpty() || !(result.get(0) instanceof Separator)) {
<del> result.add(0, SEPARATOR);
<del> }
<del> return Collections.unmodifiableList(result);
<del> }
<del>
<del>
<del> @Override
<del> public String value() {
<del> return this.value;
<del> }
<del>
<del> @Override
<del> public List<Element> elements() {
<del> return this.elements;
<del> }
<del> }
<ide> }
<ide>
<ide> }
<ide><path>spring-webflux/src/main/java/org/springframework/web/reactive/function/server/ServerRequest.java
<ide> import org.springframework.http.codec.json.Jackson2CodecSupport;
<ide> import org.springframework.http.codec.multipart.Part;
<ide> import org.springframework.http.server.PathContainer;
<add>import org.springframework.http.server.RequestPath;
<ide> import org.springframework.http.server.reactive.ServerHttpRequest;
<ide> import org.springframework.lang.Nullable;
<ide> import org.springframework.util.Assert;
<ide> default HttpMethod method() {
<ide> * Get the request path.
<ide> */
<ide> default String path() {
<del> return uri().getRawPath();
<add> return requestPath().pathWithinApplication().value();
<ide> }
<ide>
<ide> /**
<ide> * Get the request path as a {@code PathContainer}.
<add> * @deprecated as of 5.3, in favor on {@link #requestPath()}
<ide> */
<add> @Deprecated
<ide> default PathContainer pathContainer() {
<del> return PathContainer.parsePath(path());
<add> return requestPath();
<add> }
<add>
<add> /**
<add> * Get the request path as a {@code PathContainer}.
<add> * @since 5.3
<add> */
<add> default RequestPath requestPath() {
<add> return exchange().getRequest().getPath();
<ide> }
<ide>
<ide> /**
<ide><path>spring-webflux/src/main/java/org/springframework/web/reactive/function/server/support/ServerRequestWrapper.java
<ide> import org.springframework.http.codec.HttpMessageReader;
<ide> import org.springframework.http.codec.multipart.Part;
<ide> import org.springframework.http.server.PathContainer;
<add>import org.springframework.http.server.RequestPath;
<ide> import org.springframework.http.server.reactive.ServerHttpRequest;
<ide> import org.springframework.util.Assert;
<ide> import org.springframework.util.MultiValueMap;
<ide> public String path() {
<ide> }
<ide>
<ide> @Override
<add> @Deprecated
<ide> public PathContainer pathContainer() {
<ide> return this.delegate.pathContainer();
<ide> }
<ide>
<add> @Override
<add> public RequestPath requestPath() {
<add> return this.delegate.requestPath();
<add> }
<add>
<ide> @Override
<ide> public Headers headers() {
<ide> return this.delegate.headers();
<ide><path>spring-webflux/src/test/java/org/springframework/web/reactive/function/server/RequestPredicatesTests.java
<ide> import org.springframework.web.testfixture.server.MockServerWebExchange;
<ide> import org.springframework.web.util.pattern.PathPatternParser;
<ide>
<del>import static java.util.Collections.emptyList;
<ide> import static org.assertj.core.api.Assertions.assertThat;
<ide>
<ide> /**
<ide> public void path() {
<ide> URI uri = URI.create("https://localhost/path");
<ide> RequestPredicate predicate = RequestPredicates.path("/p*");
<ide> MockServerHttpRequest mockRequest = MockServerHttpRequest.get(uri.toString()).build();
<del> ServerRequest request = new DefaultServerRequest(MockServerWebExchange.from(mockRequest), emptyList());
<add> ServerRequest request = new DefaultServerRequest(MockServerWebExchange.from(mockRequest), Collections.emptyList());
<ide> assertThat(predicate.test(request)).isTrue();
<ide>
<ide> mockRequest = MockServerHttpRequest.head("https://example.com").build();
<ide> public void pathPredicates() {
<ide> assertThat(predicate.test(request)).isTrue();
<ide> }
<ide>
<add> @Test
<add> public void pathWithContext() {
<add> RequestPredicate predicate = RequestPredicates.path("/p*");
<add> MockServerHttpRequest mockRequest = MockServerHttpRequest.get("https://localhost/context/path")
<add> .contextPath("/context").build();
<add> ServerRequest request = new DefaultServerRequest(MockServerWebExchange.from(mockRequest), Collections.emptyList());
<add> assertThat(predicate.test(request)).isTrue();
<add> }
<add>
<ide> @Test
<ide> public void headers() {
<ide> String name = "MyHeader";
<ide><path>spring-webmvc/src/main/java/org/springframework/web/servlet/function/DefaultServerRequest.java
<ide> import org.springframework.http.MediaType;
<ide> import org.springframework.http.converter.GenericHttpMessageConverter;
<ide> import org.springframework.http.converter.HttpMessageConverter;
<del>import org.springframework.http.server.PathContainer;
<ide> import org.springframework.http.server.RequestPath;
<ide> import org.springframework.http.server.ServletServerHttpRequest;
<ide> import org.springframework.lang.Nullable;
<ide> public UriBuilder uriBuilder() {
<ide> }
<ide>
<ide> @Override
<del> public String path() {
<del> return pathContainer().value();
<del> }
<del>
<del> @Override
<del> public PathContainer pathContainer() {
<del> return this.requestPath.pathWithinApplication();
<add> public RequestPath requestPath() {
<add> return this.requestPath;
<ide> }
<ide>
<ide> @Override
<ide><path>spring-webmvc/src/main/java/org/springframework/web/servlet/function/PathResourceLookupFunction.java
<ide> public PathResourceLookupFunction(String pattern, Resource location) {
<ide>
<ide> @Override
<ide> public Optional<Resource> apply(ServerRequest request) {
<del> PathContainer pathContainer = request.pathContainer();
<add> PathContainer pathContainer = request.requestPath().pathWithinApplication();
<ide> if (!this.pattern.matches(pathContainer)) {
<ide> return Optional.empty();
<ide> }
<ide><path>spring-webmvc/src/main/java/org/springframework/web/servlet/function/RequestPredicates.java
<ide> import java.net.URI;
<ide> import java.security.Principal;
<ide> import java.time.Instant;
<del>import java.util.ArrayList;
<ide> import java.util.Arrays;
<ide> import java.util.Collections;
<ide> import java.util.EnumSet;
<ide> import org.springframework.http.MediaType;
<ide> import org.springframework.http.converter.HttpMessageConverter;
<ide> import org.springframework.http.server.PathContainer;
<add>import org.springframework.http.server.RequestPath;
<ide> import org.springframework.lang.NonNull;
<ide> import org.springframework.lang.Nullable;
<ide> import org.springframework.util.Assert;
<ide> public PathPatternPredicate(PathPattern pattern) {
<ide>
<ide> @Override
<ide> public boolean test(ServerRequest request) {
<del> PathContainer pathContainer = request.pathContainer();
<add> PathContainer pathContainer = request.requestPath().pathWithinApplication();
<ide> PathPattern.PathMatchInfo info = this.pattern.matchAndExtract(pathContainer);
<ide> traceMatch("Pattern", this.pattern.getPatternString(), request.path(), info != null);
<ide> if (info != null) {
<ide> private static void mergeAttributes(ServerRequest request, Map<String, String> v
<ide>
<ide> @Override
<ide> public Optional<ServerRequest> nest(ServerRequest request) {
<del> return Optional.ofNullable(this.pattern.matchStartOfPath(request.pathContainer()))
<add> return Optional.ofNullable(this.pattern.matchStartOfPath(request.requestPath().pathWithinApplication()))
<ide> .map(info -> new SubPathServerRequestWrapper(request, info, this.pattern));
<ide> }
<ide>
<ide> private static class SubPathServerRequestWrapper implements ServerRequest {
<ide>
<ide> private final ServerRequest request;
<ide>
<del> private final PathContainer pathContainer;
<add> private RequestPath requestPath;
<ide>
<ide> private final Map<String, Object> attributes;
<ide>
<ide> public SubPathServerRequestWrapper(ServerRequest request,
<ide> PathPattern.PathRemainingMatchInfo info, PathPattern pattern) {
<ide> this.request = request;
<del> this.pathContainer = new SubPathContainer(info.getPathRemaining());
<add> this.requestPath = requestPath(request.requestPath(), info);
<ide> this.attributes = mergeAttributes(request, info.getUriVariables(), pattern);
<ide> }
<ide>
<add> private static RequestPath requestPath(RequestPath original, PathPattern.PathRemainingMatchInfo info) {
<add> StringBuilder contextPath = new StringBuilder(original.contextPath().value());
<add> contextPath.append(info.getPathMatched().value());
<add> int length = contextPath.length();
<add> if (length > 0 && contextPath.charAt(length - 1) == '/') {
<add> contextPath.setLength(length - 1);
<add> }
<add> return original.modifyContextPath(contextPath.toString());
<add> }
<add>
<ide> private static Map<String, Object> mergeAttributes(ServerRequest request,
<ide> Map<String, String> pathVariables, PathPattern pattern) {
<ide> Map<String, Object> result = new ConcurrentHashMap<>(request.attributes());
<ide> public UriBuilder uriBuilder() {
<ide> }
<ide>
<ide> @Override
<del> public String path() {
<del> return this.pathContainer.value();
<del> }
<del>
<del> @Override
<del> public PathContainer pathContainer() {
<del> return this.pathContainer;
<add> public RequestPath requestPath() {
<add> return this.requestPath;
<ide> }
<ide>
<ide> @Override
<ide> public String toString() {
<ide> return method() + " " + path();
<ide> }
<ide>
<del> private static class SubPathContainer implements PathContainer {
<del>
<del> private static final PathContainer.Separator SEPARATOR = () -> "/";
<del>
<del>
<del> private final String value;
<del>
<del> private final List<Element> elements;
<del>
<del> public SubPathContainer(PathContainer original) {
<del> this.value = prefixWithSlash(original.value());
<del> this.elements = prependWithSeparator(original.elements());
<del> }
<del>
<del> private static String prefixWithSlash(String path) {
<del> if (!path.startsWith("/")) {
<del> path = "/" + path;
<del> }
<del> return path;
<del> }
<del>
<del> private static List<Element> prependWithSeparator(List<Element> elements) {
<del> List<Element> result = new ArrayList<>(elements);
<del> if (result.isEmpty() || !(result.get(0) instanceof Separator)) {
<del> result.add(0, SEPARATOR);
<del> }
<del> return Collections.unmodifiableList(result);
<del> }
<del>
<del>
<del> @Override
<del> public String value() {
<del> return this.value;
<del> }
<del>
<del> @Override
<del> public List<Element> elements() {
<del> return this.elements;
<del> }
<del> }
<ide> }
<ide>
<ide> }
<ide><path>spring-webmvc/src/main/java/org/springframework/web/servlet/function/ServerRequest.java
<ide> import org.springframework.http.MediaType;
<ide> import org.springframework.http.converter.HttpMessageConverter;
<ide> import org.springframework.http.server.PathContainer;
<add>import org.springframework.http.server.RequestPath;
<ide> import org.springframework.lang.Nullable;
<ide> import org.springframework.util.Assert;
<ide> import org.springframework.util.CollectionUtils;
<ide> import org.springframework.util.MultiValueMap;
<add>import org.springframework.web.util.ServletRequestPathUtils;
<ide> import org.springframework.web.util.UriBuilder;
<ide>
<ide> /**
<ide> default HttpMethod method() {
<ide> * Get the request path.
<ide> */
<ide> default String path() {
<del> return uri().getRawPath();
<add> return requestPath().pathWithinApplication().value();
<ide> }
<ide>
<ide> /**
<ide> * Get the request path as a {@code PathContainer}.
<add> * @deprecated as of 5.3, in favor on {@link #requestPath()}
<ide> */
<add> @Deprecated
<ide> default PathContainer pathContainer() {
<del> return PathContainer.parsePath(path());
<add> return requestPath();
<add> }
<add>
<add> /**
<add> * Get the request path as a {@code PathContainer}.
<add> * @since 5.3
<add> */
<add> default RequestPath requestPath() {
<add> return ServletRequestPathUtils.getParsedRequestPath(servletRequest());
<ide> }
<ide>
<ide> /**
<ide><path>spring-webmvc/src/test/java/org/springframework/web/servlet/function/RequestPredicatesTests.java
<ide> void pathPredicates() {
<ide> assertThat(predicate.test(initRequest("GET", "/path"))).isTrue();
<ide> }
<ide>
<add> @Test
<add> public void pathWithContext() {
<add> RequestPredicate predicate = RequestPredicates.path("/p*");
<add> ServerRequest request = initRequest("GET", "/context/path",
<add> servletRequest -> servletRequest.setContextPath("/context"));
<add> assertThat(predicate.test(request)).isTrue();
<add> }
<ide>
<ide> @Test
<ide> void headers() { | 14 |
Javascript | Javascript | remove a few old deprecation warnings | f47ad10db7ad69aa2bc4ab0d4bdb0b3ac805692b | <ide><path>src/node.js
<ide> function removed (reason) {
<ide> }
<ide> }
<ide>
<del>GLOBAL.__module = removed("'__module' has been renamed to 'module'");
<del>GLOBAL.include = removed("include(module) has been removed. Use require(module)");
<del>GLOBAL.puts = removed("puts() has moved. Use require('sys') to bring it back.");
<del>GLOBAL.print = removed("print() has moved. Use require('sys') to bring it back.");
<del>GLOBAL.p = removed("p() has moved. Use require('sys') to bring it back.");
<ide> process.debug = removed("process.debug() has moved. Use require('sys') to bring it back.");
<ide> process.error = removed("process.error() has moved. Use require('sys') to bring it back.");
<ide> process.watchFile = removed("process.watchFile() has moved to fs.watchFile()");
<ide><path>test/simple/test-global-leak.js
<ide> var knownGlobals = [ setTimeout
<ide> , Buffer
<ide> , process
<ide> , global
<del> , __module
<del> , include
<del> , puts
<del> , print
<del> , p
<ide> ];
<ide>
<ide> for (var x in global) { | 2 |
Javascript | Javascript | simplify the `readablestream` polyfill | e2aa067603e4ad136f67bee907797a1f7724a8bc | <ide><path>src/shared/compatibility.js
<ide> if (
<ide> (typeof PDFJSDev === "undefined" || !PDFJSDev.test("SKIP_BABEL")) &&
<ide> (typeof globalThis === "undefined" || !globalThis._pdfjsCompatibilityChecked)
<ide> ) {
<del> // Provides support for globalThis in legacy browsers.
<del> // Support: Firefox<65, Chrome<71, Safari<12.1
<add> // Provides support for `globalThis` in legacy browsers.
<add> // Support: Firefox<65, Chrome<71, Safari<12.1, Node.js<12.0.0
<ide> if (typeof globalThis === "undefined" || globalThis.Math !== Math) {
<ide> // eslint-disable-next-line no-global-assign
<ide> globalThis = require("core-js/es/global-this");
<ide> if (
<ide> // shouldn't need to be polyfilled for the IMAGE_DECODERS build target.
<ide> return;
<ide> }
<del> let isReadableStreamSupported = false;
<del>
<del> if (typeof ReadableStream !== "undefined") {
<del> // MS Edge may say it has ReadableStream but they are not up to spec yet.
<del> try {
<del> // eslint-disable-next-line no-new
<del> new ReadableStream({
<del> start(controller) {
<del> controller.close();
<del> },
<del> });
<del> isReadableStreamSupported = true;
<del> } catch (e) {
<del> // The ReadableStream constructor cannot be used.
<del> }
<add> if (typeof PDFJSDev !== "undefined" && PDFJSDev.test("CHROME")) {
<add> // Slightly reduce the size of the Chromium-extension, given
<add> // that `ReadableStream` has been supported since Chrome 43.
<add> return;
<ide> }
<del> if (isReadableStreamSupported) {
<add> if (globalThis.ReadableStream || !isNodeJS) {
<ide> return;
<ide> }
<ide> globalThis.ReadableStream = | 1 |
Python | Python | fix flake8 errors | f978b342237bd0f1705812f600c2571c35825304 | <ide><path>libcloud/compute/drivers/packet.py
<ide> from libcloud.common.base import ConnectionKey, JsonResponse
<ide> from libcloud.compute.types import Provider, NodeState, InvalidCredsError
<ide> from libcloud.compute.base import NodeDriver, Node
<del>from libcloud.compute.providers import get_driver
<ide> from libcloud.compute.base import NodeImage, NodeSize, NodeLocation
<ide> from libcloud.compute.base import KeyPair
<ide>
<ide> def list_nodes(self, ex_project_id=None):
<ide> ex_project_id=self.project_id)
<ide>
<ide> # In case of Python2 perform requests serially
<del> if asyncio == None:
<add> if asyncio is None:
<ide> nodes = []
<ide> for project in self.projects:
<ide> nodes.extend(
<ide> def _list_nodes(driver):
<ide> for future in futures:
<ide> result = yield from future
<ide> nodes.extend(result)
<del> return nodes""", glob , loc)
<add> return nodes""", glob, loc)
<ide> loop = asyncio.get_event_loop()
<ide> nodes = loop.run_until_complete(loc['_list_nodes'](loc['self']))
<ide> return nodes | 1 |
Javascript | Javascript | fix the encoding problem for truetype | b3b03224460a2fc7095a27ad95cfc46beb51499e | <ide><path>pdf.js
<ide> var CanvasExtraState = (function() {
<ide> const Encodings = {
<ide> get ExpertEncoding() {
<ide> return shadow(this, "ExpertEncoding", [
<add> null, null, null, null, null, null, null, null, null, null, null,
<add> null, null, null, null, null, null, null, null, null, null, null,
<add> null, null, null, null, null, null, null, null, null, null,
<ide> "space","exclamsmall","Hungarumlautsmall",,"dollaroldstyle","dollarsuperior",
<ide> "ampersandsmall","Acutesmall","parenleftsuperior","parenrightsuperior",
<ide> "twodotenleader","onedotenleader","comma","hyphen","period","fraction",
<ide> const Encodings = {
<ide> },
<ide> get MacExpertEncoding() {
<ide> return shadow(this, "MacExpertEncoding", [
<add> null, null, null, null, null, null, null, null, null, null, null,
<add> null, null, null, null, null, null, null, null, null, null, null,
<add> null, null, null, null, null, null, null, null, null, null,
<ide> "space","exclamsmall","Hungarumlautsmall","centoldstyle","dollaroldstyle",
<ide> "dollarsuperior","ampersandsmall","Acutesmall","parenleftsuperior",
<ide> "parenrightsuperior","twodotenleader","onedotenleader","comma","hyphen","period",
<ide> const Encodings = {
<ide> },
<ide> get MacRomanEncoding() {
<ide> return shadow(this, "MacRomanEncoding", [
<add> null, null, null, null, null, null, null, null, null, null, null,
<add> null, null, null, null, null, null, null, null, null, null, null,
<add> null, null, null, null, null, null, null, null, null, null,
<ide> "space","exclam","quotedbl","numbersign","dollar","percent","ampersand",
<ide> "quotesingle","parenleft","parenright","asterisk","plus","comma","hyphen",
<ide> "period","slash","zero","one","two","three","four","five","six","seven","eight",
<ide> const Encodings = {
<ide> },
<ide> get StandardEncoding() {
<ide> return shadow(this, "StandardEncoding", [
<add> null, null, null, null, null, null, null, null, null, null, null,
<add> null, null, null, null, null, null, null, null, null, null, null,
<add> null, null, null, null, null, null, null, null, null, null,
<ide> "space","exclam","quotedbl","numbersign","dollar","percent","ampersand",
<ide> "quoteright","parenleft","parenright","asterisk","plus","comma","hyphen","period",
<ide> "slash","zero","one","two","three","four","five","six","seven","eight","nine",
<ide> const Encodings = {
<ide> },
<ide> get WinAnsiEncoding() {
<ide> return shadow(this, "WinAnsiEncoding", [
<add> null, null, null, null, null, null, null, null, null, null, null,
<add> null, null, null, null, null, null, null, null, null, null, null,
<add> null, null, null, null, null, null, null, null, null, null,
<ide> "space","exclam","quotedbl","numbersign","dollar","percent","ampersand",
<ide> "quotesingle","parenleft","parenright","asterisk","plus","comma","hyphen",
<ide> "period","slash","zero","one","two","three","four","five","six","seven","eight",
<ide> const Encodings = {
<ide> },
<ide> get zapfDingbatsEncoding() {
<ide> return shadow(this, "zapfDingbatsEncoding", [
<add> null, null, null, null, null, null, null, null, null, null, null,
<add> null, null, null, null, null, null, null, null, null, null, null,
<add> null, null, null, null, null, null, null, null, null, null,
<ide> "space","a1","a2","a202","a3","a4","a5","a119","a118","a117","a11","a12","a13",
<ide> "a14","a15","a16","a105","a17","a18","a19","a20","a21","a22","a23","a24","a25",
<ide> "a26","a27","a28","a6","a7","a8","a9","a10","a29","a30","a31","a32","a33","a34",
<ide> var CanvasGraphics = (function() {
<ide> var widths = xref.fetchIfRef(fontDict.get("Widths"));
<ide> assertWellFormed(IsArray(widths) && IsInt(firstChar),
<ide> "invalid font Widths or FirstChar");
<add>
<ide> for (var j = 0; j < widths.length; j++) {
<ide> if (widths[j])
<ide> charset.push(encoding[j + firstChar]); | 1 |
Python | Python | improve gpt2 doc | f210e2a414711b43fa66abaa271ac82923284f85 | <ide><path>src/transformers/models/gpt2/modeling_gpt2.py
<ide> def forward(
<ide> r"""
<ide> mc_token_ids (`torch.LongTensor` of shape `(batch_size, num_choices)`, *optional*, default to index of the last token of the input):
<ide> Index of the classification token in each input sequence. Selected in the range `[0, input_ids.size(-1) -
<del> 1[`.
<add> 1]`.
<ide> labels (`torch.LongTensor` of shape `(batch_size, sequence_length)`, *optional*):
<ide> Labels for language modeling. Note that the labels **are shifted** inside the model, i.e. you can set
<del> `labels = input_ids` Indices are selected in `[-100, 0, ..., config.vocab_size - 1]` All labels set to
<add> `labels = input_ids`. Indices are selected in `[-100, 0, ..., config.vocab_size - 1]`. All labels set to
<ide> `-100` are ignored (masked), the loss is only computed for labels in `[0, ..., config.vocab_size - 1]`
<ide> mc_labels (`torch.LongTensor` of shape `(batch_size)`, *optional*):
<ide> Labels for computing the multiple choice classification loss. Indices should be in `[0, ..., num_choices]`
<ide> def forward(
<ide> return_dict: Optional[bool] = None,
<ide> ) -> Union[Tuple, TokenClassifierOutput]:
<ide> r"""
<del> labels (`torch.LongTensor` of shape `(batch_size,)`, *optional*):
<add> labels (`torch.LongTensor` of shape `(batch_size, sequence_length)`, *optional*):
<ide> Labels for computing the sequence classification/regression loss. Indices should be in `[0, ...,
<ide> config.num_labels - 1]`. If `config.num_labels == 1` a regression loss is computed (Mean-Square loss), If
<ide> `config.num_labels > 1` a classification loss is computed (Cross-Entropy).
<ide><path>src/transformers/models/gpt2/modeling_tf_gpt2.py
<ide> def call(
<ide> r"""
<ide> mc_token_ids (`tf.Tensor` or `Numpy array` of shape `(batch_size, num_choices)`, *optional*, default to index of the last token of the input):
<ide> Index of the classification token in each input sequence. Selected in the range `[0, input_ids.size(-1) -
<del> 1[`.
<add> 1]`.
<ide>
<ide> Return:
<ide> | 2 |
Text | Text | fix cvt_text citation | d44156002142407ae311bc027e574cf0abb5974c | <ide><path>research/cvt_text/README.md
<ide> Run `python cvt.py --mode=train --model_name=chunking_model`. By default this tr
<ide> Run `python cvt.py --mode=eval --model_name=chunking_model`. A CVT model trained on the chunking data for 200k steps should get at least 97.1 F1 on the dev set and 96.6 F1 on the test set.
<ide>
<ide> ## Citation
<del>If you use this code for your publication, please cite the original paper
<add>If you use this code for your publication, please cite the original paper:
<ide> ```
<ide> @inproceedings{clark2018semi,
<ide> title = {Semi-Supervised Sequence Modeling with Cross-View Training},
<ide> author = {Kevin Clark and Minh-Thang Luong and Christopher D. Manning and Quoc V. Le},
<del> booktitle = {ACL},
<add> booktitle = {EMNLP},
<ide> year = {2018}
<ide> }
<ide> ``` | 1 |
Javascript | Javascript | use relative links | 5cbe99eced65594f6f82102187f1d5f75e86ebcf | <ide><path>client/src/components/Header/components/SignedIn.js
<ide> import React from 'react';
<ide> import PropTypes from 'prop-types';
<add>import { Link } from 'gatsby';
<ide> import { connect } from 'react-redux';
<ide> import { createSelector } from 'reselect';
<ide>
<ide> const mapStateToProps = createSelector(userSelector, ({ picture }) => ({
<ide>
<ide> function SignedIn({ picture }) {
<ide> return (
<del> <a href='https://www.freecodecamp.org/settings'>
<add> <Link to='/settings'>
<ide> <img alt='' height='38px' src={picture} />
<del> </a>
<add> </Link>
<ide> );
<ide> }
<ide> | 1 |
Text | Text | add cask maintainer guide | 0f472906222c16c4d33265446cb5ddcc0c41e788 | <ide><path>docs/Cask-Maintainer-Guide.md
<add># Cask Maintainer Guide
<add>
<add>This guide is intended to help maintainers effectively maintain the cask repositories.
<add>It is meant to be used in conjunction with the more generic [Maintainer Guidelines](Maintainer-Guidelines.md).
<add>
<add>This guide applies to all four of the cask repositories:
<add>
<add>- [Homebrew/homebrew-cask](https://github.com/Homebrew/homebrew-cask): The main cask repository
<add>- [Homebrew/homebrew-cask-drivers](https://github.com/Homebrew/homebrew-cask-drivers): Casks of drivers
<add>- [Homebrew/homebrew-cask-fonts](https://github.com/Homebrew/homebrew-cask-fonts): Casks of fonts
<add>- [Homebrew/homebrew-cask-versions](https://github.com/Homebrew/homebrew-cask-versions): Alternate versions of Casks
<add>
<add>## Common Situations
<add>
<add>Here is a list of the most common situations that arise in PRs and how to handle them:
<add>
<add>- The `version` and `sha256` both change (keeping the same format): Merge
<add>- Only the `sha256` changes: Merge unless the version needs to be updated as well.
<add> It’s not uncommon for upstream vendors to update versions in-place.
<add>- `livecheck` is updated: Use your best judgement and try to make sure that the changes
<add> follow the [`livecheck` guidelines](Brew-Livecheck.md).
<add>- Only the `version` changes or the `version` format changes: Use your best judgement and
<add> merge if it seems correct (this is relatively rare).
<add>- Other changes (including adding new casks): Use the [Cask Cookbook](Cask-Cookbook.md) to determine what's correct.
<add>
<add>If in doubt, ask another cask maintainer on GitHub or Slack.
<add>
<add>Note that unlike in formulae, casks do not consider the `sha256` stanza as meaningful security measure as maintainers cannot realistically check them for authenticity. Casks download from upstream; if a malicious actor compromised a URL, they could just as well compromise a version and make it look like an update.
<add>
<add>## Merging
<add>
<add>### Approvals
<add>
<add>In general, PRs in the cask repositories should have at least one approval from a maintainer
<add>before being merged.
<add>
<add>If desired, a maintainer can self-approve one of their PRs using the
<add>`self-approve` GitHub Actions workflow to satisfy this requirement. To trigger a self-approval, navigate to the
<add>["Self-approve a Pull Request" section of the Actions tab](https://github.com/Homebrew/homebrew-cask/actions/workflows/self-approve.yml),
<add>click on "Run workflow", enter the PR number and click "Run workflow".
<add>
<add>### Merge Types
<add>
<add>In general, using GitHub's Squash and Merge button is the best way to merge a PR. This can be used when
<add>the PR modifies only one cask, regardless of the number of commits or whether the commit message
<add>format is correct. When merging using this method, the commit message can be modified if needed.
<add>Usually, version bump commit messages follow the form `Update CASK from OLD_VERSION to NEW_VERSION`.
<add>
<add>If the PR modifies multiple casks, use the Rebase and Merge button to merge the PR. This will use the
<add>commit messages from the PR, so make sure that they are appropriate before merging. If needed,
<add>checkout the PR, squash/reword the commits and force-push back to the PR branch to ensure the proper commit format.
<add>
<add>Finally, make sure to thank the contributor for submitting a PR!
<add>
<add>## Other Tips
<add>
<add>A maintainer can easily rebase a PR onto the latest `master` branch by adding a `/rebase` comment.
<add>`BrewTestBot` will automatically rebase the PR and add a reaction to
<add>the comment once the rebase is in progress and complete.
<ide><path>docs/README.md
<ide> - [Releases](Releases.md)
<ide> - [Developer/Internal API Documentation](https://rubydoc.brew.sh)
<ide> - [Homebrew/homebrew-core merge checklist](Homebrew-homebrew-core-Merge-Checklist.md)
<add>- [Cask Maintainer Guide](Cask-Maintainer-Guide.md)
<ide>
<ide> ## Governance
<ide> | 2 |
Python | Python | fix objective tests | 217cdd8b8517f54323e705cced749017274241d2 | <ide><path>tests/keras/test_objectives.py
<ide> from keras import backend as K
<ide>
<ide>
<del>allobj = [objectives.mean_squared_error, objectives.root_mean_squared_error,
<del> objectives.mean_absolute_error, objectives.mean_absolute_percentage_error,
<del> objectives.mean_squared_logarithmic_error, objectives.squared_hinge,
<del> objectives.hinge, objectives.categorical_crossentropy, objectives.binary_crossentropy, objectives.poisson,
<add>allobj = [objectives.mean_squared_error,
<add> objectives.mean_absolute_error,
<add> objectives.mean_absolute_percentage_error,
<add> objectives.mean_squared_logarithmic_error,
<add> objectives.squared_hinge,
<add> objectives.hinge, objectives.categorical_crossentropy,
<add> objectives.binary_crossentropy,
<add> objectives.poisson,
<ide> objectives.cosine_proximity]
<ide>
<add>
<ide> def test_objective_shapes_3d():
<ide> y_a = K.variable(np.random.random((5, 6, 7)))
<ide> y_b = K.variable(np.random.random((5, 6, 7)))
<ide> for obj in allobj:
<ide> objective_output = obj(y_a, y_b)
<ide> assert K.eval(objective_output).shape == (5, 6)
<ide>
<add>
<ide> def test_objective_shapes_2d():
<ide> y_a = K.variable(np.random.random((6, 7)))
<ide> y_b = K.variable(np.random.random((6, 7))) | 1 |
Ruby | Ruby | remove updated_at from templates | 80c0ae7de867071ea6abee865364092783ca3d0a | <ide><path>actionview/lib/action_view/file_template.rb
<ide> def refresh(_)
<ide> # to ensure that references to the template object can be marshalled as well. This means forgoing
<ide> # the marshalling of the compiler mutex and instantiating that again on unmarshalling.
<ide> def marshal_dump # :nodoc:
<del> [ @identifier, @handler, @compiled, @locals, @virtual_path, @updated_at, @format, @variant ]
<add> [ @identifier, @handler, @compiled, @locals, @virtual_path, @format, @variant ]
<ide> end
<ide>
<ide> def marshal_load(array) # :nodoc:
<del> @identifier, @handler, @compiled, @locals, @virtual_path, @updated_at, @format, @variant = *array
<add> @identifier, @handler, @compiled, @locals, @virtual_path, @format, @variant = *array
<ide> @compile_mutex = Mutex.new
<ide> end
<ide> end
<ide><path>actionview/lib/action_view/template.rb
<ide> def self.finalize_compiled_template_methods=(_)
<ide>
<ide> extend Template::Handlers
<ide>
<del> attr_reader :source, :identifier, :handler, :original_encoding, :updated_at
<add> attr_reader :source, :identifier, :handler, :original_encoding
<ide> attr_reader :variable, :format, :variant, :locals, :virtual_path
<ide>
<del> def initialize(source, identifier, handler, format: nil, variant: nil, locals: nil, virtual_path: nil, updated_at: Time.now)
<add> def initialize(source, identifier, handler, format: nil, variant: nil, locals: nil, virtual_path: nil)
<ide> unless locals
<ide> ActiveSupport::Deprecation.warn "ActionView::Template#initialize requires a locals parameter"
<ide> locals = []
<ide> def initialize(source, identifier, handler, format: nil, variant: nil, locals: n
<ide> $1.to_sym
<ide> end
<ide>
<del> @updated_at = updated_at
<ide> @format = format
<ide> @variant = variant
<ide> @compile_mutex = Mutex.new
<ide> def encode!
<ide> # to ensure that references to the template object can be marshalled as well. This means forgoing
<ide> # the marshalling of the compiler mutex and instantiating that again on unmarshalling.
<ide> def marshal_dump # :nodoc:
<del> [ @source, @identifier, @handler, @compiled, @locals, @virtual_path, @updated_at, @format, @variant ]
<add> [ @source, @identifier, @handler, @compiled, @locals, @virtual_path, @format, @variant ]
<ide> end
<ide>
<ide> def marshal_load(array) # :nodoc:
<del> @source, @identifier, @handler, @compiled, @locals, @virtual_path, @updated_at, @format, @variant = *array
<add> @source, @identifier, @handler, @compiled, @locals, @virtual_path, @format, @variant = *array
<ide> @compile_mutex = Mutex.new
<ide> end
<ide>
<ide><path>actionview/lib/action_view/template/resolver.rb
<ide> def query(path, details, formats, outside_app_allowed, locals)
<ide> virtual_path: path.virtual,
<ide> format: format,
<ide> variant: variant,
<del> locals: locals,
<del> updated_at: mtime(template)
<add> locals: locals
<ide> )
<ide> end
<ide> end
<ide> def escape_entry(entry)
<ide> entry.gsub(/[*?{}\[\]]/, '\\\\\\&')
<ide> end
<ide>
<del> # Returns the file mtime from the filesystem.
<del> def mtime(p)
<del> File.mtime(p)
<del> end
<del>
<ide> # Extract handler, formats and variant from path. If a format cannot be found neither
<ide> # from the path, or the handler, we should return the array of formats given
<ide> # to the resolver.
<ide><path>actionview/lib/action_view/testing/resolvers.rb
<ide> def query(path, exts, _, _, locals)
<ide> query = /^(#{Regexp.escape(path)})#{query}$/
<ide>
<ide> templates = []
<del> @hash.each do |_path, array|
<del> source, updated_at = array
<add> @hash.each do |_path, source|
<ide> next unless query.match?(_path)
<ide> handler, format, variant = extract_handler_and_format_and_variant(_path)
<ide> templates << Template.new(source, _path, handler,
<ide> virtual_path: path.virtual,
<ide> format: format,
<ide> variant: variant,
<del> locals: locals,
<del> updated_at: updated_at
<add> locals: locals
<ide> )
<ide> end
<ide> | 4 |
PHP | PHP | allow eloquent model type in be/actingas | b1ed53e5a4cc11730ad5eda8d2d5adb6424421ce | <ide><path>src/Illuminate/Foundation/Testing/Concerns/InteractsWithAuthentication.php
<ide> trait InteractsWithAuthentication
<ide> /**
<ide> * Set the currently logged in user for the application.
<ide> *
<del> * @param \Illuminate\Contracts\Auth\Authenticatable $user
<add> * @param \Illuminate\Contracts\Auth\Authenticatable|\Illuminate\Database\Eloquent\Model $user
<ide> * @param string|null $guard
<ide> * @return $this
<ide> */
<ide> public function actingAs(UserContract $user, $guard = null)
<ide> /**
<ide> * Set the currently logged in user for the application.
<ide> *
<del> * @param \Illuminate\Contracts\Auth\Authenticatable $user
<add> * @param \Illuminate\Contracts\Auth\Authenticatable|\Illuminate\Database\Eloquent\Model $user
<ide> * @param string|null $guard
<ide> * @return $this
<ide> */ | 1 |
Python | Python | use relation in ti join to rtif | d5c039d2f1314a3f37842d9056a8ee1f0038dd90 | <ide><path>airflow/api_connexion/endpoints/task_instance_endpoint.py
<ide> from airflow.api_connexion.types import APIResponse
<ide> from airflow.models import SlaMiss
<ide> from airflow.models.dagrun import DagRun as DR
<del>from airflow.models.renderedtifields import RenderedTaskInstanceFields as RTIF
<ide> from airflow.models.taskinstance import TaskInstance as TI, clear_task_instances
<ide> from airflow.security import permissions
<ide> from airflow.utils.session import NEW_SESSION, provide_session
<ide> def get_task_instances(
<ide> # Count elements before joining extra columns
<ide> total_entries = base_query.with_entities(func.count('*')).scalar()
<ide> # Add join
<del> base_query = base_query.join(
<del> SlaMiss,
<del> and_(
<del> SlaMiss.dag_id == TI.dag_id,
<del> SlaMiss.task_id == TI.task_id,
<del> SlaMiss.execution_date == DR.execution_date,
<del> ),
<del> isouter=True,
<del> ).add_entity(SlaMiss)
<del> ti_query = base_query.outerjoin(
<del> RTIF,
<del> and_(
<del> RTIF.dag_id == TI.dag_id,
<del> RTIF.task_id == TI.task_id,
<del> RTIF.run_id == TI.run_id,
<del> ),
<del> ).add_entity(RTIF)
<del> task_instances = ti_query.offset(offset).limit(limit).all()
<del>
<add> query = (
<add> base_query.join(
<add> SlaMiss,
<add> and_(
<add> SlaMiss.dag_id == TI.dag_id,
<add> SlaMiss.task_id == TI.task_id,
<add> SlaMiss.execution_date == DR.execution_date,
<add> ),
<add> isouter=True,
<add> )
<add> .add_entity(SlaMiss)
<add> .options(joinedload(TI.rendered_task_instance_fields))
<add> )
<add> task_instances = query.offset(offset).limit(limit).all()
<ide> return task_instance_collection_schema.dump(
<ide> TaskInstanceCollection(task_instances=task_instances, total_entries=total_entries)
<ide> )
<ide><path>tests/api_connexion/endpoints/test_task_instance_endpoint.py
<ide> def test_should_respond_200_task_instance_with_sla_and_rendered(self, session):
<ide> "rendered_fields": {'op_args': [], 'op_kwargs': {}},
<ide> }
<ide>
<add> def test_should_respond_200_mapped_task_instance_with_rtif(self, session):
<add> """Verify we don't duplicate rows through join to RTIF"""
<add> tis = self.create_task_instances(session)
<add> session.query()
<add> ti = tis[0]
<add> ti.map_index = 1
<add> rendered_fields = RTIF(ti, render_templates=False)
<add> session.add(rendered_fields)
<add> session.commit()
<add> new_ti = TaskInstance(task=ti.task, run_id=ti.run_id, map_index=2)
<add> for attr in ['duration', 'end_date', 'pid', 'start_date', 'state', 'queue']:
<add> setattr(new_ti, attr, getattr(ti, attr))
<add> session.add(new_ti)
<add> rendered_fields = RTIF(new_ti, render_templates=False)
<add> session.add(rendered_fields)
<add> session.commit()
<add>
<add> # in each loop, we should get the right mapped TI back
<add> for map_index in (1, 2):
<add> response = self.client.get(
<add> "/api/v1/dags/example_python_operator/dagRuns/TEST_DAG_RUN_ID/taskInstances"
<add> + f"/print_the_context/{map_index}",
<add> environ_overrides={"REMOTE_USER": "test"},
<add> )
<add> assert response.status_code == 200
<add>
<add> assert response.json == {
<add> "dag_id": "example_python_operator",
<add> "duration": 10000.0,
<add> "end_date": "2020-01-03T00:00:00+00:00",
<add> "execution_date": "2020-01-01T00:00:00+00:00",
<add> "executor_config": "{}",
<add> "hostname": "",
<add> "map_index": map_index,
<add> "max_tries": 0,
<add> "operator": "_PythonDecoratedOperator",
<add> "pid": 100,
<add> "pool": "default_pool",
<add> "pool_slots": 1,
<add> "priority_weight": 6,
<add> "queue": "default_queue",
<add> "queued_when": None,
<add> 'sla_miss': None,
<add> "start_date": "2020-01-02T00:00:00+00:00",
<add> "state": "running",
<add> "task_id": "print_the_context",
<add> "try_number": 0,
<add> "unixname": getuser(),
<add> "dag_run_id": "TEST_DAG_RUN_ID",
<add> "rendered_fields": {'op_args': [], 'op_kwargs': {}},
<add> }
<add>
<ide> def test_should_raises_401_unauthenticated(self):
<ide> response = self.client.get(
<ide> "api/v1/dags/example_python_operator/dagRuns/TEST_DAG_RUN_ID/taskInstances/print_the_context", | 2 |
Go | Go | extract saving options to a separate method | c0f0cf6c19f9f6573b5db5b2c82adf9f5ea9c783 | <ide><path>volume/local/local.go
<ide> func (r *Root) Create(name string, opts map[string]string) (volume.Volume, error
<ide> }
<ide> }()
<ide>
<del> if len(opts) != 0 {
<del> if err = v.setOpts(opts); err != nil {
<del> return nil, err
<del> }
<del> var b []byte
<del> b, err = json.Marshal(v.opts)
<del> if err != nil {
<del> return nil, err
<del> }
<del> if err = os.WriteFile(filepath.Join(v.rootPath, "opts.json"), b, 0600); err != nil {
<del> return nil, errdefs.System(errors.Wrap(err, "error while persisting volume options"))
<del> }
<add> if err = v.setOpts(opts); err != nil {
<add> return nil, err
<ide> }
<ide>
<ide> r.volumes[name] = v
<ide> func (v *localVolume) Status() map[string]interface{} {
<ide> return nil
<ide> }
<ide>
<add>func (v *localVolume) saveOpts() error {
<add> var b []byte
<add> b, err := json.Marshal(v.opts)
<add> if err != nil {
<add> return err
<add> }
<add> err = os.WriteFile(filepath.Join(v.rootPath, "opts.json"), b, 0600)
<add> if err != nil {
<add> return errdefs.System(errors.Wrap(err, "error while persisting volume options"))
<add> }
<add> return nil
<add>}
<add>
<ide> // getAddress finds out address/hostname from options
<ide> func getAddress(opts string) string {
<ide> optsList := strings.Split(opts, ",")
<ide><path>volume/local/local_unix.go
<ide> func (v *localVolume) setOpts(opts map[string]string) error {
<ide> }
<ide> v.opts.Quota.Size = uint64(size)
<ide> }
<del> return nil
<add> return v.saveOpts()
<ide> }
<ide>
<ide> func unmount(path string) { | 2 |
Java | Java | improve mappingregistry tests and polish | 4a8baebf5908c0734a1297bb20e72268fa48979a | <ide><path>spring-webmvc/src/main/java/org/springframework/web/servlet/handler/AbstractHandlerMethodMapping.java
<ide> public List<HandlerMethod> getHandlerMethodsForMappingName(String mappingName) {
<ide> return this.mappingRegistry.getHandlerMethodsByMappingName(mappingName);
<ide> }
<ide>
<add> /**
<add> * Return the internal mapping registry. Provided for testing purposes.
<add> */
<add> MappingRegistry getMappingRegistry() {
<add> return this.mappingRegistry;
<add> }
<add>
<ide>
<ide> /**
<ide> * Detects handler methods at initialization.
<ide> protected HandlerMethod getHandlerInternal(HttpServletRequest request) throws Ex
<ide> */
<ide> protected HandlerMethod lookupHandlerMethod(String lookupPath, HttpServletRequest request) throws Exception {
<ide> List<Match> matches = new ArrayList<Match>();
<del> List<T> directPathMatches = this.mappingRegistry.getMappingKeysByUrl(lookupPath);
<add> List<T> directPathMatches = this.mappingRegistry.getMappingsByUrl(lookupPath);
<ide> if (directPathMatches != null) {
<ide> addMatchingMappings(directPathMatches, matches, request);
<ide> }
<ide> private void addMatchingMappings(Collection<T> mappings, List<Match> matches, Ht
<ide> for (T mapping : mappings) {
<ide> T match = getMatchingMapping(mapping, request);
<ide> if (match != null) {
<del> matches.add(new Match(match, this.mappingRegistry.getHandlerMethod(mapping)));
<add> matches.add(new Match(match, this.mappingRegistry.getMappings().get(mapping)));
<ide> }
<ide> }
<ide> }
<ide> else if (handlerMethod.equals(PREFLIGHT_AMBIGUOUS_MATCH)) {
<ide> }
<ide>
<ide>
<del> private class MappingRegistry {
<add> /**
<add> * A registry that maintains all mappings to handler methods, exposing methods
<add> * to perform lookups and providing concurrent access.
<add> *
<add> * <p>Package-private for testing purposes.
<add> */
<add> class MappingRegistry {
<add>
<add> private final Map<T, MappingRegistration<T>> registry = new HashMap<T, MappingRegistration<T>>();
<ide>
<ide> private final Map<T, HandlerMethod> mappingLookup = new LinkedHashMap<T, HandlerMethod>();
<ide>
<ide> private final MultiValueMap<String, T> urlLookup = new LinkedMultiValueMap<String, T>();
<ide>
<del> private final Map<String, List<HandlerMethod>> mappingNameLookup =
<add> private final Map<String, List<HandlerMethod>> nameLookup =
<ide> new ConcurrentHashMap<String, List<HandlerMethod>>();
<ide>
<del> private final Map<T, MappingDefinition<T>> definitionMap = new HashMap<T, MappingDefinition<T>>();
<del>
<ide> private final Map<Method, CorsConfiguration> corsLookup =
<ide> new ConcurrentHashMap<Method, CorsConfiguration>();
<ide>
<ide> public Map<T, HandlerMethod> getMappings() {
<ide> * Return matches for the given URL path. Not thread-safe.
<ide> * @see #acquireReadLock()
<ide> */
<del> public List<T> getMappingKeysByUrl(String urlPath) {
<add> public List<T> getMappingsByUrl(String urlPath) {
<ide> return this.urlLookup.get(urlPath);
<ide> }
<ide>
<del> /**
<del> * Return the handler method for the mapping key. Not thread-safe.
<del> * @see #acquireReadLock()
<del> */
<del> public HandlerMethod getHandlerMethod(T mapping) {
<del> return this.mappingLookup.get(mapping);
<del> }
<del>
<ide> /**
<ide> * Return handler methods by mapping name. Thread-safe for concurrent use.
<ide> */
<ide> public List<HandlerMethod> getHandlerMethodsByMappingName(String mappingName) {
<del> return this.mappingNameLookup.get(mappingName);
<add> return this.nameLookup.get(mappingName);
<ide> }
<ide>
<ide> /**
<ide> public CorsConfiguration getCorsConfiguration(HandlerMethod handlerMethod) {
<ide> }
<ide>
<ide> /**
<del> * Acquire the read lock when using getMappings and getMappingKeysByUrl.
<add> * Acquire the read lock when using getMappings and getMappingsByUrl.
<ide> */
<ide> public void acquireReadLock() {
<ide> this.readWriteLock.readLock().lock();
<ide> }
<ide>
<ide> /**
<del> * Release the read lock after using getMappings and getMappingKeysByUrl.
<add> * Release the read lock after using getMappings and getMappingsByUrl.
<ide> */
<ide> public void releaseReadLock() {
<ide> this.readWriteLock.readLock().unlock();
<ide> public void register(T mapping, Object handler, Method method) {
<ide> this.corsLookup.put(method, corsConfig);
<ide> }
<ide>
<del> this.definitionMap.put(mapping,
<del> new MappingDefinition<T>(mapping, handlerMethod, directUrls, name, corsConfig));
<add> this.registry.put(mapping,
<add> new MappingRegistration<T>(mapping, handlerMethod, directUrls, name, corsConfig));
<ide> }
<ide> finally {
<ide> this.readWriteLock.writeLock().unlock();
<ide> private List<String> getDirectUrls(T mapping) {
<ide>
<ide> private void addMappingName(String name, HandlerMethod handlerMethod) {
<ide>
<del> List<HandlerMethod> oldList = this.mappingNameLookup.containsKey(name) ?
<del> this.mappingNameLookup.get(name) : Collections.<HandlerMethod>emptyList();
<add> List<HandlerMethod> oldList = this.nameLookup.containsKey(name) ?
<add> this.nameLookup.get(name) : Collections.<HandlerMethod>emptyList();
<ide>
<ide> for (HandlerMethod current : oldList) {
<ide> if (handlerMethod.getMethod().equals(current.getMethod())) {
<ide> private void addMappingName(String name, HandlerMethod handlerMethod) {
<ide> List<HandlerMethod> newList = new ArrayList<HandlerMethod>(oldList.size() + 1);
<ide> newList.addAll(oldList);
<ide> newList.add(handlerMethod);
<del> this.mappingNameLookup.put(name, newList);
<add> this.nameLookup.put(name, newList);
<ide>
<ide> if (newList.size() > 1) {
<ide> if (logger.isDebugEnabled()) {
<ide> private void addMappingName(String name, HandlerMethod handlerMethod) {
<ide> public void unregister(T mapping) {
<ide> this.readWriteLock.writeLock().lock();
<ide> try {
<del> MappingDefinition<T> definition = this.definitionMap.remove(mapping);
<add> MappingRegistration<T> definition = this.registry.remove(mapping);
<ide> if (definition == null) {
<ide> return;
<ide> }
<ide> public void unregister(T mapping) {
<ide> }
<ide> }
<ide>
<del> private void removeMappingName(MappingDefinition<T> definition) {
<del> String name = definition.getName();
<add> private void removeMappingName(MappingRegistration<T> definition) {
<add> String name = definition.getMappingName();
<ide> if (name == null) {
<ide> return;
<ide> }
<ide> HandlerMethod handlerMethod = definition.getHandlerMethod();
<del> List<HandlerMethod> oldList = this.mappingNameLookup.get(name);
<add> List<HandlerMethod> oldList = this.nameLookup.get(name);
<ide> if (oldList == null) {
<ide> return;
<ide> }
<ide> if (oldList.size() <= 1) {
<del> this.mappingNameLookup.remove(name);
<add> this.nameLookup.remove(name);
<ide> return;
<ide> }
<ide> List<HandlerMethod> newList = new ArrayList<HandlerMethod>(oldList.size() - 1);
<ide> private void removeMappingName(MappingDefinition<T> definition) {
<ide> newList.add(current);
<ide> }
<ide> }
<del> this.mappingNameLookup.put(name, newList);
<add> this.nameLookup.put(name, newList);
<ide> }
<ide>
<ide> }
<ide>
<del> private static class MappingDefinition<T> {
<add> private static class MappingRegistration<T> {
<ide>
<ide> private final T mapping;
<ide>
<ide> private final HandlerMethod handlerMethod;
<ide>
<ide> private final List<String> directUrls;
<ide>
<del> private final String name;
<add> private final String mappingName;
<ide>
<ide> private final CorsConfiguration corsConfiguration;
<ide>
<ide>
<del> public MappingDefinition(T mapping, HandlerMethod handlerMethod, List<String> directUrls,
<del> String name, CorsConfiguration corsConfiguration) {
<add> public MappingRegistration(T mapping, HandlerMethod handlerMethod, List<String> directUrls,
<add> String mappingName, CorsConfiguration corsConfiguration) {
<ide>
<ide> Assert.notNull(mapping);
<ide> Assert.notNull(handlerMethod);
<ide>
<ide> this.mapping = mapping;
<ide> this.handlerMethod = handlerMethod;
<ide> this.directUrls = (directUrls != null ? directUrls : Collections.<String>emptyList());
<del> this.name = name;
<add> this.mappingName = mappingName;
<ide> this.corsConfiguration = corsConfiguration;
<ide> }
<ide>
<ide> public List<String> getDirectUrls() {
<ide> return this.directUrls;
<ide> }
<ide>
<del> public String getName() {
<del> return this.name;
<add> public String getMappingName() {
<add> return this.mappingName;
<ide> }
<ide>
<ide> public CorsConfiguration getCorsConfiguration() {
<ide><path>spring-webmvc/src/test/java/org/springframework/web/servlet/handler/HandlerMethodMappingTests.java
<ide> import static org.junit.Assert.*;
<ide>
<ide> import java.lang.reflect.Method;
<add>import java.util.Collections;
<ide> import java.util.Comparator;
<del>import java.util.HashSet;
<add>import java.util.List;
<ide> import java.util.Set;
<ide>
<ide> import javax.servlet.http.HttpServletRequest;
<ide> import org.springframework.util.AntPathMatcher;
<ide> import org.springframework.util.PathMatcher;
<ide> import org.springframework.web.bind.annotation.RequestMapping;
<add>import org.springframework.web.cors.CorsConfiguration;
<ide> import org.springframework.web.method.HandlerMethod;
<ide> import org.springframework.web.util.UrlPathHelper;
<ide>
<add>
<ide> /**
<ide> * Test for {@link AbstractHandlerMethodMapping}.
<ide> *
<ide> * @author Arjen Poutsma
<ide> */
<add>@SuppressWarnings("unused")
<ide> public class HandlerMethodMappingTests {
<ide>
<ide> private AbstractHandlerMethodMapping<String> mapping;
<ide> public class HandlerMethodMappingTests {
<ide>
<ide> private Method method2;
<ide>
<add>
<ide> @Before
<ide> public void setUp() throws Exception {
<del> mapping = new MyHandlerMethodMapping();
<del> handler = new MyHandler();
<del> method1 = handler.getClass().getMethod("handlerMethod1");
<del> method2 = handler.getClass().getMethod("handlerMethod2");
<add> this.mapping = new MyHandlerMethodMapping();
<add> this.handler = new MyHandler();
<add> this.method1 = handler.getClass().getMethod("handlerMethod1");
<add> this.method2 = handler.getClass().getMethod("handlerMethod2");
<ide> }
<ide>
<add>
<ide> @Test(expected = IllegalStateException.class)
<ide> public void registerDuplicates() {
<del> mapping.registerMapping("foo", handler, method1);
<del> mapping.registerMapping("foo", handler, method2);
<add> this.mapping.registerMapping("foo", this.handler, this.method1);
<add> this.mapping.registerMapping("foo", this.handler, this.method2);
<ide> }
<ide>
<ide> @Test
<ide> public void directMatch() throws Exception {
<ide> String key = "foo";
<del> mapping.registerMapping(key, handler, method1);
<add> this.mapping.registerMapping(key, this.handler, this.method1);
<ide>
<del> HandlerMethod result = mapping.getHandlerInternal(new MockHttpServletRequest("GET", key));
<add> HandlerMethod result = this.mapping.getHandlerInternal(new MockHttpServletRequest("GET", key));
<ide> assertEquals(method1, result.getMethod());
<ide> }
<ide>
<ide> @Test
<ide> public void patternMatch() throws Exception {
<del> mapping.registerMapping("/fo*", handler, method1);
<del> mapping.registerMapping("/f*", handler, method2);
<add> this.mapping.registerMapping("/fo*", this.handler, this.method1);
<add> this.mapping.registerMapping("/f*", this.handler, this.method2);
<ide>
<del> HandlerMethod result = mapping.getHandlerInternal(new MockHttpServletRequest("GET", "/foo"));
<add> HandlerMethod result = this.mapping.getHandlerInternal(new MockHttpServletRequest("GET", "/foo"));
<ide> assertEquals(method1, result.getMethod());
<ide> }
<ide>
<ide> @Test(expected = IllegalStateException.class)
<ide> public void ambiguousMatch() throws Exception {
<del> mapping.registerMapping("/f?o", handler, method1);
<del> mapping.registerMapping("/fo?", handler, method2);
<add> this.mapping.registerMapping("/f?o", this.handler, this.method1);
<add> this.mapping.registerMapping("/fo?", this.handler, this.method2);
<ide>
<del> mapping.getHandlerInternal(new MockHttpServletRequest("GET", "/foo"));
<add> this.mapping.getHandlerInternal(new MockHttpServletRequest("GET", "/foo"));
<ide> }
<ide>
<ide> @Test
<ide> public void detectHandlerMethodsInAncestorContexts() {
<ide> }
<ide>
<ide> @Test
<del> public void unregister() throws Exception {
<add> public void registerMapping() throws Exception {
<add>
<add> String key1 = "/foo";
<add> String key2 = "/foo*";
<add> this.mapping.registerMapping(key1, this.handler, this.method1);
<add> this.mapping.registerMapping(key2, this.handler, this.method2);
<add>
<add> // Direct URL lookup
<add>
<add> List directUrlMatches = this.mapping.getMappingRegistry().getMappingsByUrl(key1);
<add> assertNotNull(directUrlMatches);
<add> assertEquals(1, directUrlMatches.size());
<add> assertEquals(key1, directUrlMatches.get(0));
<add>
<add> // Mapping name lookup
<add>
<add> HandlerMethod handlerMethod1 = new HandlerMethod(this.handler, this.method1);
<add> HandlerMethod handlerMethod2 = new HandlerMethod(this.handler, this.method2);
<add>
<add> String name1 = this.method1.getName();
<add> List<HandlerMethod> handlerMethods = this.mapping.getMappingRegistry().getHandlerMethodsByMappingName(name1);
<add> assertNotNull(handlerMethods);
<add> assertEquals(1, handlerMethods.size());
<add> assertEquals(handlerMethod1, handlerMethods.get(0));
<add>
<add> String name2 = this.method2.getName();
<add> handlerMethods = this.mapping.getMappingRegistry().getHandlerMethodsByMappingName(name2);
<add> assertNotNull(handlerMethods);
<add> assertEquals(1, handlerMethods.size());
<add> assertEquals(handlerMethod2, handlerMethods.get(0));
<add>
<add> // CORS lookup
<add>
<add> CorsConfiguration config = this.mapping.getMappingRegistry().getCorsConfiguration(handlerMethod1);
<add> assertNotNull(config);
<add> assertEquals("http://" + name1, config.getAllowedOrigins().get(0));
<add>
<add> config = this.mapping.getMappingRegistry().getCorsConfiguration(handlerMethod2);
<add> assertNotNull(config);
<add> assertEquals("http://" + name2, config.getAllowedOrigins().get(0));
<add> }
<add>
<add> @Test
<add> public void unregisterMapping() throws Exception {
<add>
<ide> String key = "foo";
<del> mapping.registerMapping(key, handler, method1);
<add> HandlerMethod handlerMethod = new HandlerMethod(this.handler, this.method1);
<ide>
<del> HandlerMethod handlerMethod = mapping.getHandlerInternal(new MockHttpServletRequest("GET", key));
<del> assertEquals(method1, handlerMethod.getMethod());
<add> this.mapping.registerMapping(key, this.handler, this.method1);
<add> assertNotNull(this.mapping.getHandlerInternal(new MockHttpServletRequest("GET", key)));
<ide>
<del> mapping.unregisterMapping(key);
<add> this.mapping.unregisterMapping(key);
<ide> assertNull(mapping.getHandlerInternal(new MockHttpServletRequest("GET", key)));
<add> assertNull(this.mapping.getMappingRegistry().getMappingsByUrl(key));
<add> assertNull(this.mapping.getMappingRegistry().getHandlerMethodsByMappingName(this.method1.getName()));
<add> assertNull(this.mapping.getMappingRegistry().getCorsConfiguration(handlerMethod));
<ide> }
<ide>
<ide>
<ide> private static class MyHandlerMethodMapping extends AbstractHandlerMethodMapping
<ide>
<ide> private PathMatcher pathMatcher = new AntPathMatcher();
<ide>
<add>
<add> public MyHandlerMethodMapping() {
<add> setHandlerMethodMappingNamingStrategy(new SimpleMappingNamingStrategy());
<add> }
<add>
<ide> @Override
<del> protected String getMatchingMapping(String pattern, HttpServletRequest request) {
<del> String lookupPath = pathHelper.getLookupPathForRequest(request);
<del> return pathMatcher.match(pattern, lookupPath) ? pattern : null;
<add> protected boolean isHandler(Class<?> beanType) {
<add> return true;
<ide> }
<ide>
<ide> @Override
<ide> protected String getMappingForMethod(Method method, Class<?> handlerType) {
<ide> }
<ide>
<ide> @Override
<del> protected Comparator<String> getMappingComparator(HttpServletRequest request) {
<del> String lookupPath = pathHelper.getLookupPathForRequest(request);
<del> return pathMatcher.getPatternComparator(lookupPath);
<add> protected Set<String> getMappingPathPatterns(String key) {
<add> return (this.pathMatcher.isPattern(key) ? Collections.<String>emptySet() : Collections.singleton(key));
<ide> }
<ide>
<ide> @Override
<del> protected boolean isHandler(Class<?> beanType) {
<del> return true;
<add> protected CorsConfiguration initCorsConfiguration(Object handler, Method method, String mapping) {
<add> CorsConfiguration corsConfig = new CorsConfiguration();
<add> corsConfig.setAllowedOrigins(Collections.singletonList("http://" + method.getName()));
<add> return corsConfig;
<ide> }
<ide>
<ide> @Override
<del> protected Set<String> getMappingPathPatterns(String key) {
<del> return new HashSet<String>();
<add> protected String getMatchingMapping(String pattern, HttpServletRequest request) {
<add> String lookupPath = this.pathHelper.getLookupPathForRequest(request);
<add> return this.pathMatcher.match(pattern, lookupPath) ? pattern : null;
<add> }
<add>
<add> @Override
<add> protected Comparator<String> getMappingComparator(HttpServletRequest request) {
<add> String lookupPath = this.pathHelper.getLookupPathForRequest(request);
<add> return this.pathMatcher.getPatternComparator(lookupPath);
<add> }
<add>
<add> }
<add>
<add> private static class SimpleMappingNamingStrategy implements HandlerMethodMappingNamingStrategy<String> {
<add>
<add> @Override
<add> public String getName(HandlerMethod handlerMethod, String mapping) {
<add> return handlerMethod.getMethod().getName();
<ide> }
<ide> }
<ide>
<del> @SuppressWarnings("unused")
<ide> @Controller
<ide> static class MyHandler {
<ide> | 2 |
Python | Python | add extra arguments to corrcoef | 6eec749b27cf8787177585df601795d92f31e643 | <ide><path>numpy/lib/function_base.py
<ide> def cov(m,y=None, rowvar=1, bias=0):
<ide> else:
<ide> return (dot(X,X.transpose().conj())/fact).squeeze()
<ide>
<del>def corrcoef(x, y=None):
<add>def corrcoef(x, y=None, rowvar=1, bias=0):
<ide> """The correlation coefficients
<ide> """
<del> c = cov(x, y)
<add> c = cov(x, y, rowvar, bias)
<ide> try:
<ide> d = diag(c)
<ide> except ValueError: # scalar covariance | 1 |
Ruby | Ruby | escape `.`s in hostnames in regexps | aa36b343cab9a998d6e5359df8921200ba37ba3f | <ide><path>Library/Homebrew/rubocops/urls.rb
<ide> def audit_formula(_node, _class_node, _parent_class_node, body_node)
<ide> end
<ide>
<ide> # GNU URLs; doesn't apply to mirrors
<del> gnu_pattern = %r{^(?:https?|ftp)://ftpmirror.gnu.org/(.*)}
<add> gnu_pattern = %r{^(?:https?|ftp)://ftpmirror\.gnu\.org/(.*)}
<ide> audit_urls(urls, gnu_pattern) do |match, url|
<ide> problem "Please use \"https://ftp.gnu.org/gnu/#{match[1]}\" instead of #{url}."
<ide> end
<ide> def audit_formula(_node, _class_node, _parent_class_node, body_node)
<ide> urls += mirrors
<ide>
<ide> # Check pypi URLs
<del> pypi_pattern = %r{^https?://pypi.python.org/}
<add> pypi_pattern = %r{^https?://pypi\.python\.org/}
<ide> audit_urls(urls, pypi_pattern) do |_, url|
<ide> problem "use the `Source` url found on PyPI downloads page (`#{get_pypi_url(url)}`)"
<ide> end
<ide>
<ide> # Require long files.pythonhosted.org URLs
<del> pythonhosted_pattern = %r{^https?://files.pythonhosted.org/packages/source/}
<add> pythonhosted_pattern = %r{^https?://files\.pythonhosted\.org/packages/source/}
<ide> audit_urls(urls, pythonhosted_pattern) do |_, url|
<ide> problem "use the `Source` url found on PyPI downloads page (`#{get_pypi_url(url)}`)"
<ide> end | 1 |
Javascript | Javascript | handle nested fragments in totree | ef8d6d92a28835a8ab89a876f877306a5c3feffe | <ide><path>packages/react-test-renderer/src/ReactTestRenderer.js
<ide> function toTree(node: ?Fiber) {
<ide> };
<ide> case HostText: // 6
<ide> return node.stateNode.text;
<add> case Fragment: // 10
<add> return toTree(node.child);
<ide> default:
<ide> invariant(
<ide> false,
<ide><path>packages/react-test-renderer/src/__tests__/ReactTestRenderer-test.js
<ide> describe('ReactTestRenderer', () => {
<ide> );
<ide> });
<ide>
<add> it('toTree() handles nested Fragments', () => {
<add> const Foo = () => (
<add> <React.Fragment>
<add> <React.Fragment>foo</React.Fragment>
<add> </React.Fragment>
<add> );
<add> const renderer = ReactTestRenderer.create(<Foo />);
<add> const tree = renderer.toTree();
<add>
<add> cleanNodeOrArray(tree);
<add>
<add> expect(prettyFormat(tree)).toEqual(
<add> prettyFormat({
<add> nodeType: 'component',
<add> type: Foo,
<add> instance: null,
<add> props: {},
<add> rendered: 'foo',
<add> }),
<add> );
<add> });
<add>
<ide> it('toTree() handles null rendering components', () => {
<ide> class Foo extends React.Component {
<ide> render() { | 2 |
Ruby | Ruby | update bundled version of rack before 2.3 final | 572e0aac802334d2029e67eb1e87356d890f4255 | <ide><path>actionpack/lib/action_controller/vendor/rack-1.0/rack.rb
<ide> def self.release
<ide> autoload :CommonLogger, "rack/commonlogger"
<ide> autoload :ConditionalGet, "rack/conditionalget"
<ide> autoload :ContentLength, "rack/content_length"
<add> autoload :ContentType, "rack/content_type"
<ide> autoload :File, "rack/file"
<ide> autoload :Deflater, "rack/deflater"
<ide> autoload :Directory, "rack/directory"
<ide><path>actionpack/lib/action_controller/vendor/rack-1.0/rack/auth/abstract/handler.rb
<ide> class AbstractHandler
<ide>
<ide> attr_accessor :realm
<ide>
<del> def initialize(app, &authenticator)
<del> @app, @authenticator = app, authenticator
<add> def initialize(app, realm=nil, &authenticator)
<add> @app, @realm, @authenticator = app, realm, authenticator
<ide> end
<ide>
<ide>
<ide><path>actionpack/lib/action_controller/vendor/rack-1.0/rack/auth/digest/md5.rb
<ide> class MD5 < AbstractHandler
<ide>
<ide> attr_writer :passwords_hashed
<ide>
<del> def initialize(app)
<add> def initialize(*args)
<ide> super
<ide> @passwords_hashed = nil
<ide> end
<ide><path>actionpack/lib/action_controller/vendor/rack-1.0/rack/auth/digest/request.rb
<ide> module Digest
<ide> class Request < Auth::AbstractRequest
<ide>
<ide> def method
<del> @env['REQUEST_METHOD']
<add> @env['rack.methodoverride.original_method'] || @env['REQUEST_METHOD']
<ide> end
<ide>
<ide> def digest?
<ide><path>actionpack/lib/action_controller/vendor/rack-1.0/rack/builder.rb
<ide> def self.app(&block)
<ide> end
<ide>
<ide> def use(middleware, *args, &block)
<del> @ins << if block_given?
<del> lambda { |app| middleware.new(app, *args, &block) }
<del> else
<del> lambda { |app| middleware.new(app, *args) }
<del> end
<add> @ins << lambda { |app| middleware.new(app, *args, &block) }
<ide> end
<ide>
<ide> def run(app)
<ide><path>actionpack/lib/action_controller/vendor/rack-1.0/rack/content_type.rb
<add>require 'rack/utils'
<add>
<add>module Rack
<add>
<add> # Sets the Content-Type header on responses which don't have one.
<add> #
<add> # Builder Usage:
<add> # use Rack::ContentType, "text/plain"
<add> #
<add> # When no content type argument is provided, "text/html" is assumed.
<add> class ContentType
<add> def initialize(app, content_type = "text/html")
<add> @app, @content_type = app, content_type
<add> end
<add>
<add> def call(env)
<add> status, headers, body = @app.call(env)
<add> headers = Utils::HeaderHash.new(headers)
<add> headers['Content-Type'] ||= @content_type
<add> [status, headers.to_hash, body]
<add> end
<add> end
<add>end
<ide><path>actionpack/lib/action_controller/vendor/rack-1.0/rack/directory.rb
<ide> def list_directory
<ide> type = stat.directory? ? 'directory' : Mime.mime_type(ext)
<ide> size = stat.directory? ? '-' : filesize_format(size)
<ide> mtime = stat.mtime.httpdate
<add> url << '/' if stat.directory?
<add> basename << '/' if stat.directory?
<ide>
<ide> @files << [ url, basename, size, type, mtime ]
<ide> end
<ide><path>actionpack/lib/action_controller/vendor/rack-1.0/rack/handler/webrick.rb
<ide> def service(req, res)
<ide> env["HTTP_VERSION"] ||= env["SERVER_PROTOCOL"]
<ide> env["QUERY_STRING"] ||= ""
<ide> env["REQUEST_PATH"] ||= "/"
<del> env.delete "PATH_INFO" if env["PATH_INFO"] == ""
<add> if env["PATH_INFO"] == ""
<add> env.delete "PATH_INFO"
<add> else
<add> path, n = req.request_uri.path, env["SCRIPT_NAME"].length
<add> env["PATH_INFO"] = path[n, path.length-n]
<add> end
<ide>
<ide> status, headers, body = @app.call(env)
<ide> begin
<ide><path>actionpack/lib/action_controller/vendor/rack-1.0/rack/lint.rb
<ide> def check_env(env)
<ide> ## within the application. This may be an
<ide> ## empty string, if the request URL targets
<ide> ## the application root and does not have a
<del> ## trailing slash.
<add> ## trailing slash. This information should be
<add> ## decoded by the server if it comes from a
<add> ## URL.
<ide>
<ide> ## <tt>QUERY_STRING</tt>:: The portion of the request URL that
<ide> ## follows the <tt>?</tt>, if any. May be
<ide><path>actionpack/lib/action_controller/vendor/rack-1.0/rack/response.rb
<ide> module Rack
<ide> # Your application's +call+ should end returning Response#finish.
<ide>
<ide> class Response
<add> attr_accessor :length
<add>
<ide> def initialize(body=[], status=200, header={}, &block)
<ide> @status = status
<ide> @header = Utils::HeaderHash.new({"Content-Type" => "text/html"}. | 10 |
Python | Python | fix array_almost_equal for array subclasses | dfc567790badcc87822a39f5c35f0dd78b8c1599 | <ide><path>numpy/testing/tests/test_utils.py
<ide> def test_inf(self):
<ide> self.assertRaises(AssertionError,
<ide> lambda : self._assert_func(a, b))
<ide>
<add> def test_subclass(self):
<add> a = np.array([[1., 2.], [3., 4.]])
<add> b = np.ma.masked_array([[1., 2.], [0., 4.]],
<add> [[False, False], [True, False]])
<add> assert_array_almost_equal(a, b)
<add> assert_array_almost_equal(b, a)
<add> assert_array_almost_equal(b, b)
<add>
<ide> class TestAlmostEqual(_GenericTest, unittest.TestCase):
<ide> def setUp(self):
<ide> self._assert_func = assert_almost_equal
<ide><path>numpy/testing/utils.py
<ide> def compare(x, y):
<ide> # make sure y is an inexact type to avoid abs(MIN_INT); will cause
<ide> # casting of x later.
<ide> dtype = result_type(y, 1.)
<del> y = array(y, dtype=dtype, copy=False)
<add> y = array(y, dtype=dtype, copy=False, subok=True)
<ide> z = abs(x-y)
<ide>
<ide> if not issubdtype(z.dtype, number): | 2 |
Javascript | Javascript | expand nodeeventtarget functionality | 16b11cd2adaa5f60382a7f205f893f38a5061fff | <ide><path>lib/internal/event_target.js
<ide> const kEvents = Symbol('kEvents');
<ide> const kStop = Symbol('kStop');
<ide> const kTarget = Symbol('kTarget');
<ide>
<add>const kHybridDispatch = Symbol.for('nodejs.internal.kHybridDispatch');
<add>const kCreateEvent = Symbol('kCreateEvent');
<ide> const kNewListener = Symbol('kNewListener');
<ide> const kRemoveListener = Symbol('kRemoveListener');
<add>const kIsNodeStyleListener = Symbol('kIsNodeStyleListener');
<add>const kMaxListeners = Symbol('kMaxListeners');
<add>const kMaxListenersWarned = Symbol('kMaxListenersWarned');
<ide>
<ide> // Lazy load perf_hooks to avoid the additional overhead on startup
<ide> let perf_hooks;
<ide> Object.defineProperty(Event.prototype, SymbolToStringTag, {
<ide> // the linked list makes dispatching faster, even if adding/removing is
<ide> // slower.
<ide> class Listener {
<del> constructor(previous, listener, once, capture, passive) {
<add> constructor(previous, listener, once, capture, passive, isNodeStyleListener) {
<ide> this.next = undefined;
<ide> if (previous !== undefined)
<ide> previous.next = this;
<ide> class Listener {
<ide> this.once = once;
<ide> this.capture = capture;
<ide> this.passive = passive;
<add> this.isNodeStyleListener = isNodeStyleListener;
<ide>
<ide> this.callback =
<ide> typeof listener === 'function' ?
<ide> class Listener {
<ide> }
<ide> }
<ide>
<add>function initEventTarget(self) {
<add> self[kEvents] = new Map();
<add>}
<add>
<ide> class EventTarget {
<ide> // Used in checking whether an object is an EventTarget. This is a well-known
<ide> // symbol as EventTarget may be used cross-realm. See discussion in #33661.
<ide> static [kIsEventTarget] = true;
<ide>
<ide> constructor() {
<del> this[kEvents] = new Map();
<add> initEventTarget(this);
<ide> }
<ide>
<ide> [kNewListener](size, type, listener, once, capture, passive) {}
<ide> class EventTarget {
<ide> const {
<ide> once,
<ide> capture,
<del> passive
<add> passive,
<add> isNodeStyleListener
<ide> } = validateEventListenerOptions(options);
<ide>
<ide> if (!shouldAddListener(listener)) {
<ide> class EventTarget {
<ide> if (root === undefined) {
<ide> root = { size: 1, next: undefined };
<ide> // This is the first handler in our linked list.
<del> new Listener(root, listener, once, capture, passive);
<add> new Listener(root, listener, once, capture, passive, isNodeStyleListener);
<ide> this[kNewListener](root.size, type, listener, once, capture, passive);
<ide> this[kEvents].set(type, root);
<ide> return;
<ide> class EventTarget {
<ide> return;
<ide> }
<ide>
<del> new Listener(previous, listener, once, capture, passive);
<add> new Listener(previous, listener, once, capture, passive,
<add> isNodeStyleListener);
<ide> root.size++;
<ide> this[kNewListener](root.size, type, listener, once, capture, passive);
<ide> }
<ide> class EventTarget {
<ide> if (event[kTarget] !== null)
<ide> throw new ERR_EVENT_RECURSION(event.type);
<ide>
<del> const root = this[kEvents].get(event.type);
<add> this[kHybridDispatch](event, event.type, event);
<add>
<add> return event.defaultPrevented !== true;
<add> }
<add>
<add> [kHybridDispatch](nodeValue, type, event) {
<add> const createEvent = () => {
<add> if (event === undefined) {
<add> event = this[kCreateEvent](nodeValue, type);
<add> event[kTarget] = this;
<add> }
<add> return event;
<add> };
<add>
<add> const root = this[kEvents].get(type);
<ide> if (root === undefined || root.next === undefined)
<ide> return true;
<ide>
<del> event[kTarget] = this;
<add> if (event !== undefined)
<add> event[kTarget] = this;
<ide>
<ide> let handler = root.next;
<ide> let next;
<ide>
<ide> while (handler !== undefined &&
<del> (handler.passive || event[kStop] !== true)) {
<add> (handler.passive || event?.[kStop] !== true)) {
<ide> // Cache the next item in case this iteration removes the current one
<ide> next = handler.next;
<ide>
<ide> if (handler.once) {
<ide> handler.remove();
<ide> root.size--;
<add> const { listener, capture } = handler;
<add> this[kRemoveListener](root.size, type, listener, capture);
<ide> }
<ide>
<ide> try {
<del> const result = handler.callback.call(this, event);
<add> let arg;
<add> if (handler.isNodeStyleListener) {
<add> arg = nodeValue;
<add> } else {
<add> arg = createEvent();
<add> }
<add> const result = handler.callback.call(this, arg);
<ide> if (result !== undefined && result !== null)
<del> addCatch(this, result, event);
<add> addCatch(this, result, createEvent());
<ide> } catch (err) {
<del> emitUnhandledRejectionOrErr(this, err, event);
<add> emitUnhandledRejectionOrErr(this, err, createEvent());
<ide> }
<ide>
<ide> handler = next;
<ide> }
<ide>
<del> event[kTarget] = undefined;
<del>
<del> return event.defaultPrevented !== true;
<add> if (event !== undefined)
<add> event[kTarget] = undefined;
<ide> }
<ide>
<ide> [customInspectSymbol](depth, options) {
<ide> Object.defineProperty(EventTarget.prototype, SymbolToStringTag, {
<ide> value: 'EventTarget',
<ide> });
<ide>
<del>const kMaxListeners = Symbol('maxListeners');
<del>const kMaxListenersWarned = Symbol('maxListenersWarned');
<add>function initNodeEventTarget(self) {
<add> initEventTarget(self);
<add> // eslint-disable-next-line no-use-before-define
<add> self[kMaxListeners] = NodeEventTarget.defaultMaxListeners;
<add> self[kMaxListenersWarned] = false;
<add>}
<add>
<ide> class NodeEventTarget extends EventTarget {
<ide> static defaultMaxListeners = 10;
<ide>
<ide> constructor() {
<ide> super();
<del> this[kMaxListeners] = NodeEventTarget.defaultMaxListeners;
<del> this[kMaxListenersWarned] = false;
<add> initNodeEventTarget(this);
<ide> }
<ide>
<ide> [kNewListener](size, type, listener, once, capture, passive) {
<ide> class NodeEventTarget extends EventTarget {
<ide> }
<ide>
<ide> on(type, listener) {
<del> this.addEventListener(type, listener);
<add> this.addEventListener(type, listener, { [kIsNodeStyleListener]: true });
<ide> return this;
<ide> }
<ide>
<ide> addListener(type, listener) {
<del> this.addEventListener(type, listener);
<add> this.addEventListener(type, listener, { [kIsNodeStyleListener]: true });
<ide> return this;
<ide> }
<ide>
<ide> once(type, listener) {
<del> this.addEventListener(type, listener, { once: true });
<add> this.addEventListener(type, listener,
<add> { once: true, [kIsNodeStyleListener]: true });
<ide> return this;
<ide> }
<ide>
<ide> function validateEventListenerOptions(options) {
<ide> once: Boolean(options.once),
<ide> capture: Boolean(options.capture),
<ide> passive: Boolean(options.passive),
<add> isNodeStyleListener: Boolean(options[kIsNodeStyleListener])
<ide> };
<ide> }
<ide>
<ide> module.exports = {
<ide> EventTarget,
<ide> NodeEventTarget,
<ide> defineEventHandler,
<add> initEventTarget,
<add> initNodeEventTarget,
<add> kCreateEvent,
<add> kNewListener,
<add> kRemoveListener,
<ide> }; | 1 |
Go | Go | move "image_tag" and "tag" to graph/tag.go | d7879379571e778b30973874df22fed3266cbb8f | <ide><path>graph/service.go
<ide> import (
<ide>
<ide> "github.com/docker/docker/engine"
<ide> "github.com/docker/docker/image"
<del> "github.com/docker/docker/pkg/parsers"
<ide> "github.com/docker/docker/utils"
<ide> )
<ide>
<ide> func (s *TagStore) Install(eng *engine.Engine) error {
<ide> eng.Register("image_set", s.CmdSet)
<ide> eng.Register("image_tag", s.CmdTag)
<add> eng.Register("tag", s.CmdTagLegacy) // FIXME merge with "image_tag"
<ide> eng.Register("image_get", s.CmdGet)
<ide> eng.Register("image_inspect", s.CmdLookup)
<ide> eng.Register("image_tarlayer", s.CmdTarLayer)
<ide> func (s *TagStore) CmdSet(job *engine.Job) engine.Status {
<ide> return engine.StatusOK
<ide> }
<ide>
<del>// CmdTag assigns a new name and tag to an existing image. If the tag already exists,
<del>// it is changed and the image previously referenced by the tag loses that reference.
<del>// This may cause the old image to be garbage-collected if its reference count reaches zero.
<del>//
<del>// Syntax: image_tag NEWNAME OLDNAME
<del>// Example: image_tag shykes/myapp:latest shykes/myapp:1.42.0
<del>func (s *TagStore) CmdTag(job *engine.Job) engine.Status {
<del> if len(job.Args) != 2 {
<del> return job.Errorf("usage: %s NEWNAME OLDNAME", job.Name)
<del> }
<del> var (
<del> newName = job.Args[0]
<del> oldName = job.Args[1]
<del> )
<del> newRepo, newTag := parsers.ParseRepositoryTag(newName)
<del> // FIXME: Set should either parse both old and new name, or neither.
<del> // the current prototype is inconsistent.
<del> if err := s.Set(newRepo, newTag, oldName, true); err != nil {
<del> return job.Error(err)
<del> }
<del> return engine.StatusOK
<del>}
<del>
<ide> // CmdGet returns information about an image.
<ide> // If the image doesn't exist, an empty object is returned, to allow
<ide> // checking for an image's existence.
<ide><path>graph/tag.go
<add>package graph
<add>
<add>import (
<add> "github.com/docker/docker/engine"
<add> "github.com/docker/docker/pkg/parsers"
<add>)
<add>
<add>// CmdTag assigns a new name and tag to an existing image. If the tag already exists,
<add>// it is changed and the image previously referenced by the tag loses that reference.
<add>// This may cause the old image to be garbage-collected if its reference count reaches zero.
<add>//
<add>// Syntax: image_tag NEWNAME OLDNAME
<add>// Example: image_tag shykes/myapp:latest shykes/myapp:1.42.0
<add>func (s *TagStore) CmdTag(job *engine.Job) engine.Status {
<add> if len(job.Args) != 2 {
<add> return job.Errorf("usage: %s NEWNAME OLDNAME", job.Name)
<add> }
<add> var (
<add> newName = job.Args[0]
<add> oldName = job.Args[1]
<add> )
<add> newRepo, newTag := parsers.ParseRepositoryTag(newName)
<add> // FIXME: Set should either parse both old and new name, or neither.
<add> // the current prototype is inconsistent.
<add> if err := s.Set(newRepo, newTag, oldName, true); err != nil {
<add> return job.Error(err)
<add> }
<add> return engine.StatusOK
<add>}
<add>
<add>// FIXME: merge into CmdTag above, and merge "image_tag" and "tag" into a single job.
<add>func (s *TagStore) CmdTagLegacy(job *engine.Job) engine.Status {
<add> if len(job.Args) != 2 && len(job.Args) != 3 {
<add> return job.Errorf("Usage: %s IMAGE REPOSITORY [TAG]\n", job.Name)
<add> }
<add> var tag string
<add> if len(job.Args) == 3 {
<add> tag = job.Args[2]
<add> }
<add> if err := s.Set(job.Args[1], tag, job.Args[0], job.GetenvBool("force")); err != nil {
<add> return job.Error(err)
<add> }
<add> return engine.StatusOK
<add>}
<ide><path>server/image.go
<ide> func (srv *Server) Build(job *engine.Job) engine.Status {
<ide> return engine.StatusOK
<ide> }
<ide>
<del>func (srv *Server) ImageTag(job *engine.Job) engine.Status {
<del> if len(job.Args) != 2 && len(job.Args) != 3 {
<del> return job.Errorf("Usage: %s IMAGE REPOSITORY [TAG]\n", job.Name)
<del> }
<del> var tag string
<del> if len(job.Args) == 3 {
<del> tag = job.Args[2]
<del> }
<del> if err := srv.daemon.Repositories().Set(job.Args[1], tag, job.Args[0], job.GetenvBool("force")); err != nil {
<del> return job.Error(err)
<del> }
<del> return engine.StatusOK
<del>}
<del>
<ide> func (srv *Server) pullImage(r *registry.Registry, out io.Writer, imgID, endpoint string, token []string, sf *utils.StreamFormatter) error {
<ide> history, err := r.GetRemoteHistory(imgID, endpoint, token)
<ide> if err != nil {
<ide><path>server/init.go
<ide> func InitServer(job *engine.Job) engine.Status {
<ide> job.Eng.Hack_SetGlobalVar("httpapi.daemon", srv.daemon)
<ide>
<ide> for name, handler := range map[string]engine.Handler{
<del> "tag": srv.ImageTag, // FIXME merge with "image_tag"
<ide> "info": srv.DockerInfo,
<ide> "log": srv.Log,
<ide> "build": srv.Build, | 4 |
Java | Java | move nativemodule initialization off ui thread | b08521523780e2104465d007ef664cc69b5c90d9 | <ide><path>ReactAndroid/src/androidTest/java/com/facebook/react/testing/ReactTestHelper.java
<ide> import com.facebook.react.bridge.JavaScriptModuleRegistry;
<ide> import com.facebook.react.bridge.NativeModule;
<ide> import com.facebook.react.bridge.NativeModuleCallExceptionHandler;
<add>import com.facebook.react.bridge.ReactApplicationContext;
<ide> import com.facebook.react.bridge.WritableNativeMap;
<ide> import com.facebook.react.bridge.queue.ReactQueueConfigurationSpec;
<ide> import com.facebook.react.cxxbridge.CatalystInstanceImpl;
<ide> public class ReactTestHelper {
<ide> private static class DefaultReactTestFactory implements ReactTestFactory {
<ide> private static class ReactInstanceEasyBuilderImpl implements ReactInstanceEasyBuilder {
<ide>
<del> private final NativeModuleRegistryBuilder mNativeModuleRegistryBuilder =
<del> new NativeModuleRegistryBuilder(null, null, false);
<ide> private final JavaScriptModuleRegistry.Builder mJSModuleRegistryBuilder =
<ide> new JavaScriptModuleRegistry.Builder();
<add> private NativeModuleRegistryBuilder mNativeModuleRegistryBuilder;
<ide>
<ide> private @Nullable Context mContext;
<ide>
<ide> public ReactInstanceEasyBuilder setContext(Context context) {
<ide>
<ide> @Override
<ide> public ReactInstanceEasyBuilder addNativeModule(NativeModule nativeModule) {
<add> if (mNativeModuleRegistryBuilder == null) {
<add> mNativeModuleRegistryBuilder = new NativeModuleRegistryBuilder(
<add> (ReactApplicationContext) mContext,
<add> null,
<add> false);
<add> }
<ide> mNativeModuleRegistryBuilder.addNativeModule(nativeModule);
<ide> return this;
<ide> }
<ide> public ReactInstanceEasyBuilder addJSModule(Class moduleInterfaceClass) {
<ide>
<ide> @Override
<ide> public CatalystInstance build() {
<add> if (mNativeModuleRegistryBuilder == null) {
<add> mNativeModuleRegistryBuilder = new NativeModuleRegistryBuilder(
<add> (ReactApplicationContext) mContext,
<add> null,
<add> false);
<add> }
<ide> JavaScriptExecutor executor = null;
<ide> try {
<ide> executor = new JSCJavaScriptExecutor.Factory(new WritableNativeMap()).create();
<ide><path>ReactAndroid/src/main/java/com/facebook/react/NativeModuleRegistryBuilder.java
<ide> public NativeModuleRegistry build() {
<ide> }
<ide> }
<ide>
<del> return new NativeModuleRegistry(mModules, batchCompleteListenerModules);
<add> return new NativeModuleRegistry(
<add> mReactApplicationContext,
<add> mModules,
<add> batchCompleteListenerModules);
<ide> }
<ide> }
<ide><path>ReactAndroid/src/main/java/com/facebook/react/animated/NativeAnimatedModule.java
<ide>
<ide> import javax.annotation.Nullable;
<ide>
<add>import java.util.ArrayList;
<add>
<ide> import com.facebook.infer.annotation.Assertions;
<ide> import com.facebook.react.bridge.Arguments;
<ide> import com.facebook.react.bridge.Callback;
<ide> import com.facebook.react.uimanager.GuardedFrameCallback;
<ide> import com.facebook.react.uimanager.UIManagerModule;
<ide>
<del>import java.util.ArrayList;
<del>
<ide> /**
<ide> * Module that exposes interface for creating and managing animated nodes on the "native" side.
<ide> *
<ide> public NativeAnimatedModule(ReactApplicationContext reactContext) {
<ide>
<ide> @Override
<ide> public void initialize() {
<del> // Safe to acquire choreographer here, as initialize() is invoked from UI thread.
<del> mReactChoreographer = ReactChoreographer.getInstance();
<del>
<del> ReactApplicationContext reactCtx = getReactApplicationContext();
<del> UIManagerModule uiManager = reactCtx.getNativeModule(UIManagerModule.class);
<add> getReactApplicationContext().addLifecycleEventListener(this);
<add> }
<ide>
<del> final NativeAnimatedNodesManager nodesManager = new NativeAnimatedNodesManager(uiManager);
<del> mAnimatedFrameCallback = new GuardedFrameCallback(reactCtx) {
<del> @Override
<del> protected void doFrameGuarded(final long frameTimeNanos) {
<add> @Override
<add> public void onHostResume() {
<add> if (mReactChoreographer == null) {
<add> // Safe to acquire choreographer here, as onHostResume() is invoked from UI thread.
<add> mReactChoreographer = ReactChoreographer.getInstance();
<add>
<add> ReactApplicationContext reactCtx = getReactApplicationContext();
<add> UIManagerModule uiManager = reactCtx.getNativeModule(UIManagerModule.class);
<add>
<add> final NativeAnimatedNodesManager nodesManager = new NativeAnimatedNodesManager(uiManager);
<add> mAnimatedFrameCallback = new GuardedFrameCallback(reactCtx) {
<add> @Override
<add> protected void doFrameGuarded(final long frameTimeNanos) {
<add>
<add> ArrayList<UIThreadOperation> operations;
<add> synchronized (mOperationsCopyLock) {
<add> operations = mReadyOperations;
<add> mReadyOperations = null;
<add> }
<ide>
<del> ArrayList<UIThreadOperation> operations;
<del> synchronized (mOperationsCopyLock) {
<del> operations = mReadyOperations;
<del> mReadyOperations = null;
<del> }
<add> if (operations != null) {
<add> for (int i = 0, size = operations.size(); i < size; i++) {
<add> operations.get(i).execute(nodesManager);
<add> }
<add> }
<ide>
<del> if (operations != null) {
<del> for (int i = 0, size = operations.size(); i < size; i++) {
<del> operations.get(i).execute(nodesManager);
<add> if (nodesManager.hasActiveAnimations()) {
<add> nodesManager.runUpdates(frameTimeNanos);
<ide> }
<del> }
<ide>
<del> if (nodesManager.hasActiveAnimations()) {
<del> nodesManager.runUpdates(frameTimeNanos);
<add> // TODO: Would be great to avoid adding this callback in case there are no active animations
<add> // and no outstanding tasks on the operations queue. Apparently frame callbacks can only
<add> // be posted from the UI thread and therefore we cannot schedule them directly from
<add> // @ReactMethod methods
<add> Assertions.assertNotNull(mReactChoreographer).postFrameCallback(
<add> ReactChoreographer.CallbackType.NATIVE_ANIMATED_MODULE,
<add> mAnimatedFrameCallback);
<ide> }
<del>
<del> // TODO: Would be great to avoid adding this callback in case there are no active animations
<del> // and no outstanding tasks on the operations queue. Apparently frame callbacks can only
<del> // be posted from the UI thread and therefore we cannot schedule them directly from
<del> // @ReactMethod methods
<del> Assertions.assertNotNull(mReactChoreographer).postFrameCallback(
<del> ReactChoreographer.CallbackType.NATIVE_ANIMATED_MODULE,
<del> mAnimatedFrameCallback);
<del> }
<del> };
<del> reactCtx.addLifecycleEventListener(this);
<add> };
<add> }
<add> enqueueFrameCallback();
<ide> }
<ide>
<ide> @Override
<ide> public void onBatchComplete() {
<ide> }
<ide> }
<ide>
<del> @Override
<del> public void onHostResume() {
<del> enqueueFrameCallback();
<del> }
<del>
<ide> @Override
<ide> public void onHostPause() {
<ide> clearFrameCallback();
<ide><path>ReactAndroid/src/main/java/com/facebook/react/bridge/ReactContext.java
<ide> public void assertOnNativeModulesQueueThread() {
<ide> Assertions.assertNotNull(mNativeModulesMessageQueueThread).assertIsOnThread();
<ide> }
<ide>
<add> public void assertOnNativeModulesQueueThread(String message) {
<add> Assertions.assertNotNull(mNativeModulesMessageQueueThread).assertIsOnThread(message);
<add> }
<add>
<ide> public boolean isOnNativeModulesQueueThread() {
<ide> return Assertions.assertNotNull(mNativeModulesMessageQueueThread).isOnThread();
<ide> }
<ide><path>ReactAndroid/src/main/java/com/facebook/react/bridge/queue/MessageQueueThread.java
<ide> public interface MessageQueueThread {
<ide> @DoNotStrip
<ide> void assertIsOnThread();
<ide>
<add> /**
<add> * Asserts {@link #isOnThread()}, throwing a {@link AssertionException} (NOT an
<add> * {@link AssertionError}) if the assertion fails. The given message is appended to the error.
<add> */
<add> @DoNotStrip
<add> void assertIsOnThread(String message);
<add>
<ide> /**
<ide> * Quits this MessageQueueThread. If called from this MessageQueueThread, this will be the last
<ide> * thing the thread runs. If called from a separate thread, this will block until the thread can
<ide><path>ReactAndroid/src/main/java/com/facebook/react/bridge/queue/MessageQueueThreadImpl.java
<ide> public void assertIsOnThread() {
<ide> SoftAssertions.assertCondition(isOnThread(), mAssertionErrorMessage);
<ide> }
<ide>
<add> /**
<add> * Asserts {@link #isOnThread()}, throwing a {@link AssertionException} (NOT an
<add> * {@link AssertionError}) if the assertion fails.
<add> */
<add> @DoNotStrip
<add> @Override
<add> public void assertIsOnThread(String message) {
<add> SoftAssertions.assertCondition(
<add> isOnThread(),
<add> new StringBuilder().append(mAssertionErrorMessage).append(" ").append(message).toString());
<add> }
<add>
<ide> /**
<ide> * Quits this queue's Looper. If that Looper was running on a different Thread than the current
<ide> * Thread, also waits for the last message being processed to finish and the Thread to die.
<ide><path>ReactAndroid/src/main/java/com/facebook/react/cxxbridge/CatalystInstanceImpl.java
<ide> import android.content.res.AssetManager;
<ide>
<ide> import com.facebook.common.logging.FLog;
<add>import com.facebook.infer.annotation.Assertions;
<ide> import com.facebook.jni.HybridData;
<add>import com.facebook.proguard.annotations.DoNotStrip;
<ide> import com.facebook.react.bridge.CatalystInstance;
<ide> import com.facebook.react.bridge.ExecutorToken;
<ide> import com.facebook.react.bridge.JavaScriptModule;
<ide> import com.facebook.react.bridge.NativeModule;
<ide> import com.facebook.react.bridge.NativeModuleCallExceptionHandler;
<ide> import com.facebook.react.bridge.NotThreadSafeBridgeIdleDebugListener;
<del>import com.facebook.react.bridge.queue.ReactQueueConfiguration;
<ide> import com.facebook.react.bridge.queue.MessageQueueThread;
<ide> import com.facebook.react.bridge.queue.QueueThreadExceptionHandler;
<add>import com.facebook.react.bridge.queue.ReactQueueConfiguration;
<ide> import com.facebook.react.bridge.queue.ReactQueueConfigurationImpl;
<ide> import com.facebook.react.bridge.queue.ReactQueueConfigurationSpec;
<del>import com.facebook.proguard.annotations.DoNotStrip;
<ide> import com.facebook.react.common.ReactConstants;
<ide> import com.facebook.react.common.annotations.VisibleForTesting;
<del>import com.facebook.infer.annotation.Assertions;
<ide> import com.facebook.soloader.SoLoader;
<ide> import com.facebook.systrace.Systrace;
<ide> import com.facebook.systrace.TraceListener;
<ide> public void destroy() {
<ide> // TODO: tell all APIs to shut down
<ide> mDestroyed = true;
<ide> mHybridData.resetNative();
<del> mJavaRegistry.notifyCatalystInstanceDestroy();
<add> mReactQueueConfiguration.getNativeModulesQueueThread().runOnQueue(new Runnable() {
<add> @Override
<add> public void run() {
<add> mJavaRegistry.notifyCatalystInstanceDestroy();
<add> }
<add> });
<ide> boolean wasIdle = (mPendingJSCalls.getAndSet(0) == 0);
<ide> if (!wasIdle && !mBridgeIdleListeners.isEmpty()) {
<ide> for (NotThreadSafeBridgeIdleDebugListener listener : mBridgeIdleListeners) {
<ide> public void initialize() {
<ide> mAcceptCalls,
<ide> "RunJSBundle hasn't completed.");
<ide> mInitialized = true;
<del> mJavaRegistry.notifyCatalystInstanceInitialized();
<add> mReactQueueConfiguration.getNativeModulesQueueThread().runOnQueue(new Runnable() {
<add> @Override
<add> public void run() {
<add> mJavaRegistry.notifyCatalystInstanceInitialized();
<add> }
<add> });
<ide> }
<ide>
<ide> @Override
<ide><path>ReactAndroid/src/main/java/com/facebook/react/cxxbridge/ModuleHolder.java
<ide> import javax.annotation.Nullable;
<ide> import javax.inject.Provider;
<ide>
<del>import java.util.concurrent.ExecutionException;
<del>
<ide> import com.facebook.react.bridge.NativeModule;
<ide> import com.facebook.react.bridge.ReactMarker;
<ide> import com.facebook.react.bridge.ReactMarkerConstants;
<del>import com.facebook.react.common.futures.SimpleSettableFuture;
<ide> import com.facebook.systrace.Systrace;
<ide> import com.facebook.systrace.SystraceMessage;
<ide>
<ide> private void doInitialize(NativeModule module) {
<ide> }
<ide> section.flush();
<ide> ReactMarker.logMarker(ReactMarkerConstants.INITIALIZE_MODULE_START, mName);
<del> callInitializeOnUiThread(module);
<add> module.initialize();
<ide> ReactMarker.logMarker(ReactMarkerConstants.INITIALIZE_MODULE_END);
<ide> Systrace.endSection(TRACE_TAG_REACT_JAVA_BRIDGE);
<ide> }
<del>
<del> // TODO(t11394264): Use the native module thread here after the old bridge is gone
<del> private static void callInitializeOnUiThread(final NativeModule module) {
<del> if (UiThreadUtil.isOnUiThread()) {
<del> module.initialize();
<del> return;
<del> }
<del> final SimpleSettableFuture<Void> future = new SimpleSettableFuture<>();
<del> UiThreadUtil.runOnUiThread(new Runnable() {
<del> @Override
<del> public void run() {
<del> Systrace.beginSection(TRACE_TAG_REACT_JAVA_BRIDGE, "initializeOnUiThread");
<del> try {
<del> module.initialize();
<del> future.set(null);
<del> } catch (Exception e) {
<del> future.setException(e);
<del> }
<del> Systrace.endSection(TRACE_TAG_REACT_JAVA_BRIDGE);
<del> }
<del> });
<del> try {
<del> future.get();
<del> } catch (InterruptedException | ExecutionException e) {
<del> throw new RuntimeException(e);
<del> }
<del> }
<ide> }
<ide><path>ReactAndroid/src/main/java/com/facebook/react/cxxbridge/NativeModuleRegistry.java
<ide> import com.facebook.infer.annotation.Assertions;
<ide> import com.facebook.react.bridge.NativeModule;
<ide> import com.facebook.react.bridge.OnBatchCompleteListener;
<add>import com.facebook.react.bridge.ReactApplicationContext;
<ide> import com.facebook.react.bridge.ReactMarker;
<ide> import com.facebook.react.bridge.ReactMarkerConstants;
<ide> import com.facebook.systrace.Systrace;
<ide> */
<ide> public class NativeModuleRegistry {
<ide>
<add> private final ReactApplicationContext mReactApplicationContext;
<ide> private final Map<Class<? extends NativeModule>, ModuleHolder> mModules;
<ide> private final ArrayList<ModuleHolder> mBatchCompleteListenerModules;
<ide>
<ide> public NativeModuleRegistry(
<add> ReactApplicationContext reactApplicationContext,
<ide> Map<Class<? extends NativeModule>, ModuleHolder> modules,
<ide> ArrayList<ModuleHolder> batchCompleteListenerModules) {
<add> mReactApplicationContext = reactApplicationContext;
<ide> mModules = modules;
<ide> mBatchCompleteListenerModules = batchCompleteListenerModules;
<ide> }
<ide> public NativeModuleRegistry(
<ide> }
<ide>
<ide> /* package */ void notifyCatalystInstanceDestroy() {
<del> UiThreadUtil.assertOnUiThread();
<add> mReactApplicationContext.assertOnNativeModulesQueueThread();
<ide> Systrace.beginSection(
<ide> Systrace.TRACE_TAG_REACT_JAVA_BRIDGE,
<ide> "NativeModuleRegistry_notifyCatalystInstanceDestroy");
<ide> public NativeModuleRegistry(
<ide> }
<ide>
<ide> /* package */ void notifyCatalystInstanceInitialized() {
<del> UiThreadUtil.assertOnUiThread();
<del>
<add> mReactApplicationContext.assertOnNativeModulesQueueThread("From version React Native v0.44, " +
<add> "native modules are explicitly not initialized on the UI thread. See " +
<add> "https://github.com/facebook/react-native/wiki/Breaking-Changes#d4611211-reactnativeandroidbreaking-move-nativemodule-initialization-off-ui-thread---aaachiuuu " +
<add> " for more details.");
<ide> ReactMarker.logMarker(ReactMarkerConstants.NATIVE_MODULE_INITIALIZE_START);
<ide> Systrace.beginSection(
<ide> Systrace.TRACE_TAG_REACT_JAVA_BRIDGE,
<ide><path>ReactAndroid/src/main/java/com/facebook/react/modules/core/Timing.java
<ide> import com.facebook.react.bridge.WritableArray;
<ide> import com.facebook.react.common.SystemClock;
<ide> import com.facebook.react.devsupport.interfaces.DevSupportManager;
<del>import com.facebook.react.jstasks.HeadlessJsTaskEventListener;
<ide> import com.facebook.react.jstasks.HeadlessJsTaskContext;
<add>import com.facebook.react.jstasks.HeadlessJsTaskEventListener;
<ide> import com.facebook.react.module.annotations.ReactModule;
<ide>
<ide> /**
<ide> public int compare(Timer lhs, Timer rhs) {
<ide>
<ide> @Override
<ide> public void initialize() {
<del> // Safe to acquire choreographer here, as initialize() is invoked from UI thread.
<del> mReactChoreographer = ReactChoreographer.getInstance();
<ide> getReactApplicationContext().addLifecycleEventListener(this);
<ide> HeadlessJsTaskContext headlessJsTaskContext =
<ide> HeadlessJsTaskContext.getInstance(getReactApplicationContext());
<ide> public void onHostDestroy() {
<ide>
<ide> @Override
<ide> public void onHostResume() {
<add> if (mReactChoreographer == null) {
<add> // Safe to acquire choreographer here, as onHostResume() is invoked from UI thread.
<add> mReactChoreographer = ReactChoreographer.getInstance();
<add> }
<add>
<ide> isPaused.set(false);
<ide> // TODO(5195192) Investigate possible problems related to restarting all tasks at the same
<ide> // moment
<ide> public void onHostResume() {
<ide>
<ide> @Override
<ide> public void onHeadlessJsTaskStart(int taskId) {
<add> if (mReactChoreographer == null) {
<add> // Safe to acquire choreographer here, as onHeadlessJsTaskStart() is invoked from UI thread.
<add> mReactChoreographer = ReactChoreographer.getInstance();
<add> }
<add>
<ide> if (!isRunningTasks.getAndSet(true)) {
<ide> setChoreographerCallback();
<ide> maybeSetChoreographerIdleCallback(); | 10 |
Python | Python | fix flaky test | d5ae6f32dd1136226e7bd7a63a2120c317668d1e | <ide><path>tests/integration_tests/test_temporal_data_tasks.py
<ide> def test_temporal_classification():
<ide> '''
<ide> np.random.seed(1337)
<ide> (X_train, y_train), (X_test, y_test) = get_test_data(nb_train=500,
<del> nb_test=200,
<add> nb_test=500,
<ide> input_shape=(3, 5),
<ide> classification=True,
<ide> nb_class=2)
<ide> def test_temporal_classification():
<ide> input_shape=(X_train.shape[1], X_train.shape[2]),
<ide> activation='softmax'))
<ide> model.compile(loss='categorical_crossentropy',
<del> optimizer='adadelta',
<add> optimizer='adagrad',
<ide> metrics=['accuracy'])
<del> history = model.fit(X_train, y_train, nb_epoch=5, batch_size=16,
<add> history = model.fit(X_train, y_train, nb_epoch=20, batch_size=32,
<ide> validation_data=(X_test, y_test),
<ide> verbose=0)
<del> assert(history.history['val_acc'][-1] > 0.9)
<add> assert(history.history['val_acc'][-1] >= 0.85)
<ide>
<ide>
<ide> def test_temporal_regression():
<ide> def test_masked_temporal():
<ide> assert(np.abs(history.history['val_loss'][-1] - ground_truth) < 0.06)
<ide>
<ide> if __name__ == '__main__':
<del> pytest.main([__file__])
<add> # pytest.main([__file__])
<add> test_temporal_classification() | 1 |
Text | Text | add v3.2.0-beta.2 to changelog | c77ddd2edbaf5595c4ddbea114a7eda50c55a727 | <ide><path>CHANGELOG.md
<ide> # Ember Changelog
<ide>
<add>### v3.2.0-beta.2 (April 16, 2018)
<add>
<add>- [#16493](https://github.com/emberjs/ember.js/pull/16493) [BUGFIX] Ensure proxies have access to `getOwner(this)`.
<add>- [#16494](https://github.com/emberjs/ember.js/pull/16494) [BUGFIX] Adjust assertion to allow for either undefined or null
<add>- [#16499](https://github.com/emberjs/ember.js/pull/16499) [BUGFIX] Object to string serialization
<add>- [#16514](https://github.com/emberjs/ember.js/pull/16514) [BUGFIX] Bring back (with deprecation) Ember.EXTEND_PROTOTYPES.
<add>- [#16520](https://github.com/emberjs/ember.js/pull/16520) [BUGFIX] Adds options checking ability to debug/deprecation test helpers
<add>- [#16526](https://github.com/emberjs/ember.js/pull/16526) [BUGFIX] Ensure setting a `NAME_KEY` does not error.
<add>- [#16527](https://github.com/emberjs/ember.js/pull/16527) [BUGFIX] Update glimmer-vm to 0.33.5.
<add>
<ide> ### v3.2.0-beta.1 (April 10, 2018)
<ide>
<ide> - [#16250](https://github.com/emberjs/ember.js/pull/16250) [DEPRECATION] Deprecation of `Ember.Logger` | 1 |
Ruby | Ruby | add missing require for enumerable#index_with | 0d0eb93b16117fd35f4ee1b12b01c115c676c87c | <ide><path>activemodel/lib/active_model/attribute_set.rb
<ide> # frozen_string_literal: true
<ide>
<add>require "active_support/core_ext/enumerable"
<ide> require "active_support/core_ext/object/deep_dup"
<ide> require "active_model/attribute_set/builder"
<ide> require "active_model/attribute_set/yaml_encoder" | 1 |
PHP | PHP | update laravel version | a4ea877d2bb6a68796b244a741594968796c1c4e | <ide><path>src/Illuminate/Foundation/Application.php
<ide> class Application extends Container implements ApplicationContract, HttpKernelIn
<ide> *
<ide> * @var string
<ide> */
<del> const VERSION = '5.1.22 (LTS)';
<add> const VERSION = '5.1.23 (LTS)';
<ide>
<ide> /**
<ide> * The base path for the Laravel installation. | 1 |
Javascript | Javascript | add property for rangeerror in test-buffer-copy | a6e836a657d6fd159868a3c05e22562afdbe0c9d | <ide><path>test/parallel/test-buffer-copy.js
<ide> 'use strict';
<ide>
<del>require('../common');
<add>const common = require('../common');
<ide> const assert = require('assert');
<ide>
<ide> const b = Buffer.allocUnsafe(1024);
<ide> const c = Buffer.allocUnsafe(512);
<add>
<add>const errorProperty = {
<add> code: 'ERR_OUT_OF_RANGE',
<add> type: RangeError,
<add> message: 'Index out of range'
<add>};
<add>
<ide> let cntr = 0;
<ide>
<ide> {
<ide> bb.fill('hello crazy world');
<ide> b.copy(c, 0, 100, 10);
<ide>
<ide> // copy throws at negative sourceStart
<del>assert.throws(function() {
<del> Buffer.allocUnsafe(5).copy(Buffer.allocUnsafe(5), 0, -1);
<del>}, RangeError);
<add>common.expectsError(
<add> () => Buffer.allocUnsafe(5).copy(Buffer.allocUnsafe(5), 0, -1),
<add> errorProperty);
<ide>
<ide> {
<ide> // check sourceEnd resets to targetEnd if former is greater than the latter
<ide> assert.throws(function() {
<ide> }
<ide>
<ide> // throw with negative sourceEnd
<del>assert.throws(() => b.copy(c, 0, 0, -1), RangeError);
<add>common.expectsError(
<add> () => b.copy(c, 0, -1), errorProperty);
<ide>
<ide> // when sourceStart is greater than sourceEnd, zero copied
<ide> assert.strictEqual(b.copy(c, 0, 100, 10), 0); | 1 |
Javascript | Javascript | remove line breaks at function calls | 6d64a0616e2223061010ef7c771b7d6843e3e35c | <ide><path>src/objects/Mesh.js
<ide> THREE.Mesh.prototype.raycast = ( function () {
<ide> b = indices[ i + 1 ];
<ide> c = indices[ i + 2 ];
<ide>
<del> intersection = checkBufferGeometryIntersection( this, raycaster, ray,
<del> positions, uvs, a, b, c );
<add> intersection = checkBufferGeometryIntersection( this, raycaster, ray, positions, uvs, a, b, c );
<ide>
<ide> if( intersection ){
<ide>
<ide> THREE.Mesh.prototype.raycast = ( function () {
<ide> b = a + 1;
<ide> c = a + 2;
<ide>
<del> intersection = checkBufferGeometryIntersection( this, raycaster, ray,
<del> positions, uvs, a, b, c );
<add> intersection = checkBufferGeometryIntersection( this, raycaster, ray, positions, uvs, a, b, c );
<ide>
<ide> if( intersection ){
<ide> | 1 |
Text | Text | improve process around `prs plz!` label | 2907a0288b20b3ed9ded39f4c7425dcc522bf8ab | <ide><path>TRIAGING.md
<ide> This process based on the idea of minimizing user pain
<ide> * inconvenience - causes ugly/boilerplate code in apps
<ide> 1. Label `component: *`
<ide> * In rare cases, it's ok to have multiple components.
<del>1. Label `PRs plz!` - These issues are good targets for PRs from the open source community. Apply to issues where the problem and solution are well defined in the comments, and it's not too complex.
<add>1. Label `PRs plz!` - These issues are good targets for PRs from the open source community. In addition to applying this label, you must:
<add> * Leave a comment explaining the problem and solution so someone can easily finish it.
<add> * Assign the issue to yourself.
<add> * Give feedback on PRs addressing this issue.
<add> * You are responsible for mentoring contributors helping with this issue.
<ide> 1. Label `origin: google` for issues from Google
<ide> 1. Assign a milestone:
<ide> * Backlog - triaged fixes and features, should be the default choice | 1 |
PHP | PHP | fix partial empty option for datetime | 71128997584e8d54cc830487fab8a718bc9f271d | <ide><path>src/View/Helper/FormHelper.php
<ide> protected function _datetimeOptions($options)
<ide> $options[$type] = [];
<ide> }
<ide>
<del> // Pass empty options to each type.
<del> if (!empty($options['empty']) &&
<del> is_array($options[$type])
<del> ) {
<add> // Pass boolean/scalar empty options to each type.
<add> if (is_array($options[$type]) && isset($options['empty']) && !is_array($options['empty'])) {
<ide> $options[$type]['empty'] = $options['empty'];
<ide> }
<ide>
<ide><path>tests/TestCase/View/Helper/FormHelperTest.php
<ide> public function testDateTimeSecuredDisabled()
<ide> }
<ide>
<ide> /**
<del> * testDatetimeEmpty method
<del> *
<ide> * Test empty defaulting to true for datetime.
<ide> *
<ide> * @return void
<ide> public function testDatetimeEmpty()
<ide> $this->assertNotRegExp('/<option[^<>]+value=""[^<>]+selected="selected"[^>]*>/', $result);
<ide> }
<ide>
<add> /**
<add> * Presence check for array form empty options
<add> *
<add> * @return void
<add> */
<add> public function testDateTimeEmptyAsArrayPresence()
<add> {
<add> $result = $this->Form->dateTime('Contact.date', [
<add> 'empty' => [
<add> 'day' => 'DAY',
<add> 'month' => 'MONTH',
<add> 'year' => 'YEAR',
<add> 'hour' => 'HOUR',
<add> 'minute' => 'MINUTE',
<add> 'meridian' => false
<add> ],
<add> 'default' => true
<add> ]);
<add>
<add> $this->assertRegExp('/<option value="">DAY<\/option>/', $result);
<add> $this->assertRegExp('/<option value="">MONTH<\/option>/', $result);
<add> $this->assertRegExp('/<option value="">YEAR<\/option>/', $result);
<add> $this->assertRegExp('/<option value="">HOUR<\/option>/', $result);
<add> $this->assertRegExp('/<option value="">MINUTE<\/option>/', $result);
<add> $this->assertNotRegExp('/<option value=""><\/option>/', $result);
<add>
<add> }
<add>
<add> /**
<add> * Test datetime with array empty value, ensuring
<add> * empty options aren't duplicated.
<add> *
<add> * @return void
<add> */
<add> public function testDatetimeEmptyArrayForm()
<add> {
<add> extract($this->dateRegex);
<add>
<add> $result = $this->Form->dateTime('Contact.date', [
<add> 'minYear' => '2017',
<add> 'maxYear' => '2019',
<add> 'empty' => [
<add> 'year' => 'pick year',
<add> 'month' => 'pick month',
<add> ],
<add> 'hour' => false,
<add> 'minute' => false,
<add> 'second' => false,
<add> 'meridian' => false,
<add> ]);
<add> $expected = [
<add> ['select' => ['name' => 'Contact[date][year]']],
<add> ['option' => ['value' => '', 'selected' => 'selected']], 'pick year', '/option',
<add> '*/select',
<add>
<add> ['select' => ['name' => 'Contact[date][month]']],
<add> ['option' => ['value' => '', 'selected' => 'selected']], 'pick month', '/option',
<add> $monthsRegex,
<add> '*/select',
<add>
<add> ['select' => ['name' => 'Contact[date][day]']],
<add> $daysRegex,
<add> '*/select',
<add> ];
<add> $this->assertHtml($expected, $result);
<add> }
<add>
<ide> /**
<ide> * testDatetimeMinuteInterval method
<ide> *
<ide> public function testDateTimeAllZeros()
<ide> $this->assertNotRegExp('/<option value="0" selected="selected">0<\/option>/', $result);
<ide> }
<ide>
<del> /**
<del> * testDateTimeEmptyAsArray method
<del> *
<del> * @return void
<del> */
<del> public function testDateTimeEmptyAsArray()
<del> {
<del> $result = $this->Form->dateTime('Contact.date', [
<del> 'empty' => [
<del> 'day' => 'DAY',
<del> 'month' => 'MONTH',
<del> 'year' => 'YEAR',
<del> 'hour' => 'HOUR',
<del> 'minute' => 'MINUTE',
<del> 'meridian' => false
<del> ],
<del> 'default' => true
<del> ]);
<del>
<del> $this->assertRegExp('/<option value="">DAY<\/option>/', $result);
<del> $this->assertRegExp('/<option value="">MONTH<\/option>/', $result);
<del> $this->assertRegExp('/<option value="">YEAR<\/option>/', $result);
<del> $this->assertRegExp('/<option value="">HOUR<\/option>/', $result);
<del> $this->assertRegExp('/<option value="">MINUTE<\/option>/', $result);
<del> $this->assertNotRegExp('/<option value=""><\/option>/', $result);
<del>
<del> $result = $this->Form->dateTime('Contact.date', [
<del> 'empty' => ['day' => 'DAY', 'month' => 'MONTH', 'year' => 'YEAR'],
<del> 'default' => true
<del> ]);
<del>
<del> $this->assertRegExp('/<option value="">DAY<\/option>/', $result);
<del> $this->assertRegExp('/<option value="">MONTH<\/option>/', $result);
<del> $this->assertRegExp('/<option value="">YEAR<\/option>/', $result);
<del> }
<del>
<ide> /**
<ide> * testFormDateTimeMulti method
<ide> * | 2 |
Go | Go | remove the retries for service update | 7380935331f0c35315003578258f6c1f47c1a586 | <ide><path>integration-cli/daemon/daemon_swarm.go
<ide> func (d *Swarm) CheckLeader(c *check.C) (interface{}, check.CommentInterface) {
<ide> }
<ide> return fmt.Errorf("no leader"), check.Commentf("could not find leader")
<ide> }
<del>
<del>// CmdRetryOutOfSequence tries the specified command against the current daemon for 10 times
<del>func (d *Swarm) CmdRetryOutOfSequence(args ...string) (string, error) {
<del> for i := 0; ; i++ {
<del> out, err := d.Cmd(args...)
<del> if err != nil {
<del> if strings.Contains(out, "update out of sequence") {
<del> if i < 10 {
<del> continue
<del> }
<del> }
<del> }
<del> return out, err
<del> }
<del>}
<ide><path>integration-cli/docker_cli_service_update_test.go
<ide> func (s *DockerSwarmSuite) TestServiceUpdateSecrets(c *check.C) {
<ide> c.Assert(err, checker.IsNil, check.Commentf(out))
<ide>
<ide> // add secret
<del> out, err = d.CmdRetryOutOfSequence("service", "update", "--detach", "test", "--secret-add", fmt.Sprintf("source=%s,target=%s", testName, testTarget))
<add> out, err = d.Cmd("service", "update", "--detach", "test", "--secret-add", fmt.Sprintf("source=%s,target=%s", testName, testTarget))
<ide> c.Assert(err, checker.IsNil, check.Commentf(out))
<ide>
<ide> out, err = d.Cmd("service", "inspect", "--format", "{{ json .Spec.TaskTemplate.ContainerSpec.Secrets }}", serviceName)
<ide> func (s *DockerSwarmSuite) TestServiceUpdateSecrets(c *check.C) {
<ide> c.Assert(refs[0].File.Name, checker.Equals, testTarget)
<ide>
<ide> // remove
<del> out, err = d.CmdRetryOutOfSequence("service", "update", "--detach", "test", "--secret-rm", testName)
<add> out, err = d.Cmd("service", "update", "--detach", "test", "--secret-rm", testName)
<ide> c.Assert(err, checker.IsNil, check.Commentf(out))
<ide>
<ide> out, err = d.Cmd("service", "inspect", "--format", "{{ json .Spec.TaskTemplate.ContainerSpec.Secrets }}", serviceName)
<ide> func (s *DockerSwarmSuite) TestServiceUpdateConfigs(c *check.C) {
<ide> c.Assert(err, checker.IsNil, check.Commentf(out))
<ide>
<ide> // add config
<del> out, err = d.CmdRetryOutOfSequence("service", "update", "--detach", "test", "--config-add", fmt.Sprintf("source=%s,target=%s", testName, testTarget))
<add> out, err = d.Cmd("service", "update", "--detach", "test", "--config-add", fmt.Sprintf("source=%s,target=%s", testName, testTarget))
<ide> c.Assert(err, checker.IsNil, check.Commentf(out))
<ide>
<ide> out, err = d.Cmd("service", "inspect", "--format", "{{ json .Spec.TaskTemplate.ContainerSpec.Configs }}", serviceName)
<ide> func (s *DockerSwarmSuite) TestServiceUpdateConfigs(c *check.C) {
<ide> c.Assert(refs[0].File.Name, checker.Equals, testTarget)
<ide>
<ide> // remove
<del> out, err = d.CmdRetryOutOfSequence("service", "update", "--detach", "test", "--config-rm", testName)
<add> out, err = d.Cmd("service", "update", "--detach", "test", "--config-rm", testName)
<ide> c.Assert(err, checker.IsNil, check.Commentf(out))
<ide>
<ide> out, err = d.Cmd("service", "inspect", "--format", "{{ json .Spec.TaskTemplate.ContainerSpec.Configs }}", serviceName)
<ide><path>integration-cli/docker_cli_swarm_test.go
<ide> func (s *DockerSwarmSuite) TestSwarmPublishAdd(c *check.C) {
<ide> out, err = d.Cmd("service", "update", "--detach", "--publish-add", "80:80", name)
<ide> c.Assert(err, checker.IsNil)
<ide>
<del> out, err = d.CmdRetryOutOfSequence("service", "update", "--detach", "--publish-add", "80:80", name)
<add> out, err = d.Cmd("service", "update", "--detach", "--publish-add", "80:80", name)
<ide> c.Assert(err, checker.IsNil)
<ide>
<del> out, err = d.CmdRetryOutOfSequence("service", "update", "--detach", "--publish-add", "80:80", "--publish-add", "80:20", name)
<add> out, err = d.Cmd("service", "update", "--detach", "--publish-add", "80:80", "--publish-add", "80:20", name)
<ide> c.Assert(err, checker.NotNil)
<ide>
<ide> out, err = d.Cmd("service", "inspect", "--format", "{{ .Spec.EndpointSpec.Ports }}", name) | 3 |
Text | Text | restore original readme.md | 402fbec638c7133e2f5fda29f5cfd8c47208cc92 | <ide><path>language-adaptors/rxjava-scala/README.md
<add># Scala Adaptor for RxJava
<add>
<add>This adaptor allows to use RxJava in Scala with anonymous functions, e.g.
<add>
<add>```scala
<add>val o = Observable.interval(200 millis).take(5)
<add>o.subscribe(n => println("n = " + n))
<add>Observable(1, 2, 3, 4).reduce(_ + _)
<add>```
<add>
<add>For-comprehensions are also supported:
<add>
<add>```scala
<add>val first = Observable(10, 11, 12)
<add>val second = Observable(10, 11, 12)
<add>val booleans = for ((n1, n2) <- (first zip second)) yield (n1 == n2)
<add>```
<add>
<add>Further, this adaptor attempts to expose an API which is as Scala-idiomatic as possible. This means that certain methods have been renamed, their signature was changed, or static methods were changed to instance methods. Some examples:
<add>
<add>```scala
<add> // instead of concat:
<add>def ++[U >: T](that: Observable[U]): Observable[U]
<add>
<add>// instance method instead of static:
<add>def zip[U](that: Observable[U]): Observable[(T, U)]
<add>
<add>// the implicit evidence argument ensures that dematerialize can only be called on Observables of Notifications:
<add>def dematerialize[U](implicit evidence: T <:< Notification[U]): Observable[U]
<add>
<add>// additional type parameter U with lower bound to get covariance right:
<add>def onErrorResumeNext[U >: T](resumeFunction: Throwable => Observable[U]): Observable[U]
<add>
<add>// curried in Scala collections, so curry fold also here:
<add>def fold[R](initialValue: R)(accumulator: (R, T) => R): Observable[R]
<add>
<add>// using Duration instead of (long timepan, TimeUnit duration):
<add>def sample(duration: Duration): Observable[T]
<add>
<add>// called skip in Java, but drop in Scala
<add>def drop(n: Int): Observable[T]
<add>
<add>// there's only mapWithIndex in Java, because Java doesn't have tuples:
<add>def zipWithIndex: Observable[(T, Int)]
<add>
<add>// corresponds to Java's toList:
<add>def toSeq: Observable[Seq[T]]
<add>
<add>// the implicit evidence argument ensures that switch can only be called on Observables of Observables:
<add>def switch[U](implicit evidence: Observable[T] <:< Observable[Observable[U]]): Observable[U]
<add>
<add>// Java's from becomes apply, and we use Scala Range
<add>def apply(range: Range): Observable[Int]
<add>
<add>// use Bottom type:
<add>def never: Observable[Nothing]
<add>```
<add>
<add>Also, the Scala Observable is fully covariant in its type parameter, whereas the Java Observable only achieves partial covariance due to limitations of Java's type system (or if you can fix this, your suggestions are very welcome).
<add>
<add>For more examples, see [RxScalaDemo.scala](https://github.com/Netflix/RxJava/blob/master/language-adaptors/rxjava-scala/src/examples/scala/rx/lang/scala/examples/RxScalaDemo.scala).
<add>
<add>Scala code using Rx should only import members from `rx.lang.scala` and below.
<add>
<add>
<add>## Documentation
<add>
<add>The API documentation can be found [here](http://rxscala.github.io/scaladoc/index.html#rx.lang.scala.Observable).
<add>
<add>You can build the API documentation yourself by running `./gradlew scaladoc` in the RxJava root directory.
<add>
<add>Then navigate to `RxJava/language-adaptors/rxjava-scala/build/docs/scaladoc/index.html` to display it.
<add>
<add>
<add>## Binaries
<add>
<add>Binaries and dependency information for Maven, Ivy, Gradle and others can be found at [http://search.maven.org](http://search.maven.org/#search%7Cga%7C1%7Ca%3A%22rxjava-scala%22).
<add>
<add>Example for Maven:
<add>
<add>```xml
<add><dependency>
<add> <groupId>com.netflix.rxjava</groupId>
<add> <artifactId>rxjava-scala</artifactId>
<add> <version>x.y.z</version>
<add></dependency>
<add>```
<add>
<add>and for Ivy:
<add>
<add>```xml
<add><dependency org="com.netflix.rxjava" name="rxjava-scala" rev="x.y.z" />
<add>```
<add>
<add>and for sbt:
<add>
<add>```scala
<add>libraryDependencies ++= Seq(
<add> "com.netflix.rxjava" % "rxjava-scala" % "x.y.z"
<add>)
<add>``` | 1 |
Python | Python | fix stray order_by(taskinstance.execution_date) | bb577a98494369b22ae252ac8d23fb8e95508a1c | <ide><path>airflow/models/baseoperator.py
<ide> def get_task_instances(
<ide> end_date: Optional[datetime] = None,
<ide> session: Session = NEW_SESSION,
<ide> ) -> List[TaskInstance]:
<del> """
<del> Get a set of task instance related to this task for a specific date
<del> range.
<del> """
<add> """Get task instances related to this task for a specific date range."""
<add> from airflow.models import DagRun
<add>
<ide> end_date = end_date or timezone.utcnow()
<ide> return (
<ide> session.query(TaskInstance)
<add> .join(TaskInstance.dag_run)
<ide> .filter(TaskInstance.dag_id == self.dag_id)
<ide> .filter(TaskInstance.task_id == self.task_id)
<del> .filter(TaskInstance.execution_date >= start_date)
<del> .filter(TaskInstance.execution_date <= end_date)
<del> .order_by(TaskInstance.execution_date)
<add> .filter(DagRun.execution_date >= start_date)
<add> .filter(DagRun.execution_date <= end_date)
<add> .order_by(DagRun.execution_date)
<ide> .all()
<ide> )
<ide> | 1 |
Ruby | Ruby | allow skip_clean as a class method | cacf8d8aa4682ccb66738c98e93038a9a73b99be | <ide><path>Library/Homebrew/formula.rb
<ide> def download_strategy
<ide> else HttpDownloadStrategy
<ide> end
<ide> end
<del> # tell the user about any caveats regarding this package
<add>
<add> # tell the user about any caveats regarding this package, return a string
<ide> def caveats; nil end
<add>
<ide> # patches are automatically applied after extracting the tarball
<ide> # return an array of strings, or if you need a patch level other than -p0
<ide> # return a Hash eg.
<ide> def caveats; nil end
<ide> # The final option is to return DATA, then put a diff after __END__. You
<ide> # can still return a Hash with DATA as the value for a patch level key.
<ide> def patches; end
<del> # sometimes the clean process breaks things, return true to skip anything
<del> def skip_clean? path; false end
<add>
<ide> # rarely, you don't want your library symlinked into the main prefix
<ide> # see gettext.rb for an example
<ide> def keg_only?; false end
<ide>
<add> # sometimes the clean process breaks things
<add> # skip cleaning paths in a formula with a class method like this:
<add> # skip_clean [bin+"foo", lib+"bar"]
<add> # redefining skip_clean? in formulas is now deprecated
<add> def skip_clean? path
<add> to_check = path.relative_path_from(prefix).to_s
<add> self.class.skip_clean_paths.include?(to_check)
<add> end
<add>
<ide> # yields self with current working directory set to the uncompressed tarball
<ide> def brew
<ide> validate_variable :name
<ide> def method_added method
<ide> raise 'You cannot override Formula.brew' if method == 'brew'
<ide> end
<ide>
<del> class <<self
<add> class << self
<add>
<ide> def self.attr_rw(*attrs)
<ide> attrs.each do |attr|
<ide> class_eval %Q{
<ide> def #{attr}(val=nil)
<ide> }
<ide> end
<ide> end
<del>
<del> attr_rw :url, :version, :homepage, :head, :deps, *CHECKSUM_TYPES
<del>
<add>
<add> attr_rw :url, :version, :homepage, :head, :deps, :skip_clean_paths, *CHECKSUM_TYPES
<add>
<ide> def depends_on name, *args
<ide> @deps ||= []
<ide>
<ide> def depends_on name, *args
<ide> # step for some reason I am not sure about
<ide> @deps << name unless @deps.include? name
<ide> end
<del> end
<add>
<add> def skip_clean paths
<add> @skip_clean_paths ||= []
<add> [paths].flatten.each do |p|
<add> @skip_clean_paths << p.to_s unless @skip_clean_paths.include? p.to_s
<add> end
<add> end
<add> end
<ide> end
<ide>
<ide> # see ack.rb for an example usage | 1 |
Ruby | Ruby | move brew-audit to cmds | c5c1f40d0a5f0fa0643b11949365735f16b55e3e | <add><path>Library/Homebrew/cmd/audit.rb
<del><path>Library/Contributions/examples/brew-audit.rb
<ide> def audit_formula_options f, text
<ide> def audit_formula_urls f
<ide> problems = []
<ide>
<del> # To do:
<del> # Grab URLs out of patches as well
<del> # urls = ((f.patches rescue []) || [])
<del>
<ide> urls = [(f.url rescue nil), (f.head rescue nil)].reject {|p| p.nil?}
<ide>
<ide> # Check SourceForge urls
<ide> def audit_formula_instance f
<ide> return problems
<ide> end
<ide>
<del>def audit_some_formulae
<add>module Homebrew extend self
<add>def audit
<ide> ff.each do |f|
<ide> problems = []
<del>
<ide> problems += audit_formula_instance f
<ide> problems += audit_formula_urls f
<ide>
<ide> def audit_some_formulae
<ide> end
<ide> end
<ide> end
<del>
<del>audit_some_formulae
<add>end | 1 |
Javascript | Javascript | fix a bug with zero-delay transitions | fd101894588e218dcd3ea4e2ece7765462a566f8 | <ide><path>d3.js
<ide> try {
<ide> d3_style_setProperty.call(this, name, value + "", priority);
<ide> };
<ide> }
<del>d3 = {version: "2.1.0"}; // semver
<add>d3 = {version: "2.1.1"}; // semver
<ide> var d3_arraySubclass = [].__proto__?
<ide>
<ide> // Until ECMAScript supports array subclassing, prototype injection works well.
<ide> function d3_transition(groups, id) {
<ide>
<ide> ++lock.count;
<ide>
<del> delay <= elapsed ? start() : d3.timer(start, delay, then);
<add> delay <= elapsed ? start(elapsed) : d3.timer(start, delay, then);
<ide>
<ide> function start(elapsed) {
<ide> if (lock.active > id) return stop();
<ide><path>d3.min.js
<del>(function(){function dp(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,(db[2]=a)-c[2]),e=db[0]=b[0]-d*c[0],f=db[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{dc.apply(dd,de)}finally{d3.event=g}g.preventDefault()}function dn(){dg&&(d3.event.stopPropagation(),d3.event.preventDefault(),dg=!1)}function dm(){cZ&&(df&&(dg=!0),dl(),cZ=null)}function dl(){c$=null,cZ&&(df=!0,dp(db[2],d3.svg.mouse(dd),cZ))}function dk(){var a=d3.svg.touches(dd);switch(a.length){case 1:var b=a[0];dp(db[2],b,c_[b.identifier]);break;case 2:var c=a[0],d=a[1],e=[(c[0]+d[0])/2,(c[1]+d[1])/2],f=c_[c.identifier],g=c_[d.identifier],h=[(f[0]+g[0])/2,(f[1]+g[1])/2,f[2]];dp(Math.log(d3.event.scale)/Math.LN2+f[2],e,h)}}function dj(){var a=d3.svg.touches(dd),b=-1,c=a.length,d;while(++b<c)c_[(d=a[b]).identifier]=dh(d);return a}function di(){cY||(cY=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{cY.scrollTop=1e3,cY.dispatchEvent(a),b=1e3-cY.scrollTop}catch(c){b=a.wheelDelta||-a.detail*5}return b*.005}function dh(a){return[a[0]-db[0],a[1]-db[1],db[2]]}function cX(){d3.event.stopPropagation(),d3.event.preventDefault()}function cW(){cR&&(cX(),cR=!1)}function cV(){!cN||(cS("dragend"),cN=null,cQ&&(cR=!0,cX()))}function cU(){if(!!cN){var a=cN.parentNode;if(!a)return cV();cS("drag"),cX()}}function cT(a){return d3.event.touches?d3.svg.touches(a)[0]:d3.svg.mouse(a)}function cS(a){var b=d3.event,c=cN.parentNode,d=0,e=0;c&&(c=cT(c),d=c[0]-cP[0],e=c[1]-cP[1],cP=c,cQ|=d|e);try{d3.event={dx:d,dy:e},cM[a].dispatch.apply(cN,cO)}finally{d3.event=b}b.preventDefault()}function cL(a,b,c){e=[];if(c&&b.length>1){var d=bp(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 cK(a,b){a.attr("transform",function(a){return"translate(0,"+b(a)+")"})}function cJ(a,b){a.attr("transform",function(a){return"translate("+b(a)+",0)"})}function cF(){return"circle"}function cE(){return 64}function cD(a,b){var c=(a.ownerSVGElement||a).createSVGPoint();if(cC<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();cC=!e.f&&!e.e,d.remove()}cC?(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 cB(a){return function(){var b=a.apply(this,arguments),c=b[0],d=b[1]+bN;return[c*Math.cos(d),c*Math.sin(d)]}}function cA(a){return[a.x,a.y]}function cz(a){return a.endAngle}function cy(a){return a.startAngle}function cx(a){return a.radius}function cw(a){return a.target}function cv(a){return a.source}function cu(a){return function(b,c){return a[c][1]}}function ct(a){return function(b,c){return a[c][0]}}function cs(a){function i(f){if(f.length<1)return null;var i=bU(this,f,b,d),j=bU(this,f,b===c?ct(i):c,d===e?cu(i):e);return"M"+g(a(j),h)+"L"+g(a(i.reverse()),h)+"Z"}var b=bV,c=bV,d=0,e=bW,f="linear",g=bX[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=bX[f=a];return i},i.tension=function(a){if(!arguments.length)return h;h=a;return i};return i}function cr(a){var b,c=-1,d=a.length,e,f;while(++c<d)b=a[c],e=b[0],f=b[1]+bN,b[0]=e*Math.cos(f),b[1]=e*Math.sin(f);return a}function cq(a){return a.length<3?bY(a):a[0]+cc(a,cp(a))}function cp(a){var b=[],c,d,e,f,g=co(a),h=-1,i=a.length-1;while(++h<i)c=cn(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 co(a){var b=0,c=a.length-1,d=[],e=a[0],f=a[1],g=d[0]=cn(e,f);while(++b<c)d[b]=g+(g=cn(e=f,f=a[b+1]));d[b]=g;return d}function cn(a,b){return(b[1]-a[1])/(b[0]-a[0])}function cm(a,b,c){a.push("C",ci(cj,b),",",ci(cj,c),",",ci(ck,b),",",ci(ck,c),",",ci(cl,b),",",ci(cl,c))}function ci(a,b){return a[0]*b[0]+a[1]*b[1]+a[2]*b[2]+a[3]*b[3]}function ch(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 ce(a)}function cg(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=[ci(cl,g),",",ci(cl,h)],--c;while(++c<e)f=a[c%d],g.shift(),g.push(f[0]),h.shift(),h.push(f[1]),cm(b,g,h);return b.join("")}function cf(a){if(a.length<4)return bY(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(ci(cl,f)+","+ci(cl,g)),--c;while(++c<d)e=a[c],f.shift(),f.push(e[0]),g.shift(),g.push(e[1]),cm(b,f,g);return b.join("")}function ce(a){if(a.length<3)return bY(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),cm(b,h,i);while(++c<d)e=a[c],h.shift(),h.push(e[0]),i.shift(),i.push(e[1]),cm(b,h,i);c=-1;while(++c<2)h.shift(),h.push(e[0]),i.shift(),i.push(e[1]),cm(b,h,i);return b.join("")}function cd(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 cc(a,b){if(b.length<1||a.length!=b.length&&a.length!=b.length+2)return bY(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 cb(a,b,c){return a.length<3?bY(a):a[0]+cc(a,cd(a,b))}function ca(a,b){return a.length<3?bY(a):a[0]+cc((a.push(a[0]),a),cd([a[a.length-2]].concat(a,[a[1]]),b))}function b_(a,b){return a.length<4?bY(a):a[1]+cc(a.slice(1,a.length-1),cd(a,b))}function b$(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 bZ(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 bY(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 bW(a){return a[1]}function bV(a){return a[0]}function bU(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 bT(a){function g(d){return d.length<1?null:"M"+e(a(bU(this,d,b,c)),f)}var b=bV,c=bW,d="linear",e=bX[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=bX[d=a];return g},g.tension=function(a){if(!arguments.length)return f;f=a;return g};return g}function bS(a){return a.endAngle}function bR(a){return a.startAngle}function bQ(a){return a.outerRadius}function bP(a){return a.innerRadius}function bM(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 bM(a,b,c)};return g()}function bL(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 bL(a,b)};return d()}function bG(a,b){function f(b){return d[((c[b]||(c[b]=a.push(b)))-1)%d.length]}var c,d,e;f.domain=function(d){if(!arguments.length)return a;a=[],c={};var e=-1,g=d.length,h;while(++e<g)c[h=d[e]]||(c[h]=a.push(h));return f[b.t](b.x,b.p)},f.range=function(a){if(!arguments.length)return d;d=a,e=0,b={t:"range",x:a};return f},f.rangePoints=function(c,g){arguments.length<2&&(g=0);var h=c[0],i=c[1],j=(i-h)/(a.length-1+g);d=a.length<2?[(h+i)/2]:d3.range(h+j*g/2,i+j/2,j),e=0,b={t:"rangePoints",x:c,p:g};return f},f.rangeBands=function(c,g){arguments.length<2&&(g=0);var h=c[0],i=c[1],j=(i-h)/(a.length+g);d=d3.range(h+j*g,i,j),e=j*(1-g),b={t:"rangeBands",x:c,p:g};return f},f.rangeRoundBands=function(c,g){arguments.length<2&&(g=0);var h=c[0],i=c[1],j=Math.floor((i-h)/(a.length+g)),k=i-h-(a.length-g)*j;d=d3.range(h+Math.round(k/2),i,j),e=Math.round(j*(1-g)),b={t:"rangeRoundBands",x:c,p:g};return f},f.rangeBand=function(){return e},f.copy=function(){return bG(a,b)};return f.domain(a)}function bF(a){return function(b){return b<0?-Math.pow(-b,a):Math.pow(b,a)}}function bE(a,b){function e(b){return a(c(b))}var c=bF(b),d=bF(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 bw(e.domain(),a)},e.tickFormat=function(a){return bx(e.domain(),a)},e.nice=function(){return e.domain(bq(e.domain(),bu))},e.exponent=function(a){if(!arguments.length)return b;var f=e.domain();c=bF(b=a),d=bF(1/b);return e.domain(f)},e.copy=function(){return bE(a.copy(),b)};return bt(e,a)}function bD(a){return a.toPrecision(1)}function bC(a){return-Math.log(-a)/Math.LN10}function bB(a){return Math.log(a)/Math.LN10}function bA(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?bC:bB,c=b.pow,a.domain(e.map(b));return d},d.nice=function(){a.domain(bq(a.domain(),br));return d},d.ticks=function(){var d=bp(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===bC){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 bD},d.copy=function(){return bA(a.copy(),b)};return bt(d,a)}function bz(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 by(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 bx(a,b){return d3.format(",."+Math.max(0,-Math.floor(Math.log(bv(a,b)[2])/Math.LN10+.01))+"f")}function bw(a,b){return d3.range.apply(d3,bv(a,b))}function bv(a,b){var c=bp(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 bu(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 bt(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 bs(a,b,c,d){function h(a){return e(a)}function g(){var g=a.length==2?by:bz,i=d?G:F;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 bw(a,b)},h.tickFormat=function(b){return bx(a,b)},h.nice=function(){bq(a,bu);return g()},h.copy=function(){return bs(a,b,c,d)};return g()}function br(){return Math}function bq(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 bp(a){var b=a[0],c=a[a.length-1];return b<c?[b,c]:[c,b]}function bo(){}function bm(){var a=null,b=bi,c=Infinity;while(b)b.flush?b=a?a.next=b.next:bi=b.next:(c=Math.min(c,b.then+b.delay),b=(a=b).next);return c}function bl(){var a,b=Date.now(),c=bi;while(c)a=b-c.then,a>=c.delay&&(c.flush=c.callback(a)),c=c.next;var d=bm()-b;d>24?(isFinite(d)&&(clearTimeout(bk),bk=setTimeout(bl,d)),bj=0):(bj=1,bn(bl))}function bh(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 bc(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 bb(a,b){d(a,bd);var c={},e=d3.dispatch("start","end"),f=bg,g=Date.now();a.id=b,a.tween=function(b,d){if(arguments.length<2)return c[b];d==null?delete c[b]:c[b]=d;return a},a.ease=function(b){if(!arguments.length)return f;f=typeof b=="function"?b:d3.ease.apply(d3,arguments);return a},a.each=function(b,c){if(arguments.length<2)return bh.call(a,b);e[b].add(c);return a},d3.timer(function(d){a.each(function(h,i,j){function r(){--o.count||delete l.__transition__;return 1}function q(a){if(o.active!==b)return r();var c=Math.min(1,(a-m)/n),d=f(c),g=k.length;while(g>0)k[--g].call(l,d);if(c===1){r(),bf=b,e.end.dispatch.call(l,h,i),bf=0;return 1}}function p(a){if(o.active>b)return r();o.active=b;for(var d in c)(d=c[d].call(l,h,i))&&k.push(d);e.start.dispatch.call(l,h,i),q(a)||d3.timer(q,0,g);return 1}var k=[],l=this,m=a[j][i].delay,n=a[j][i].duration,o=l.__transition__||(l.__transition__={active:0,count:0});++o.count,m<=d?p():d3.timer(p,m,g)});return 1},0,g);return a}function _(a){arguments.length||(a=d3.ascending);return function(b,c){return a(b&&b.__data__,c&&c.__data__)}}function Z(a){d(a,$);return a}function Y(a){return{__data__:a}}function X(a){return function(){return U(a,this)}}function W(a){return function(){return T(a,this)}}function S(a){d(a,V);return a}function R(a,b,c){function g(a){return Math.round(f(a)*255)}function f(a){a>360?a-=360:a<0&&(a+=360);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 H(g(a+120),g(a),g(a-120))}function Q(a,b,c){this.h=a,this.s=b,this.l=c}function P(a,b,c){return new Q(a,b,c)}function M(a){var b=parseFloat(a);return a.charAt(a.length-1)==="%"?Math.round(b*2.55):b}function L(a,b,c){var d=Math.min(a/=255,b/=255,c/=255),e=Math.max(a,b,c),f=e-d,g,h,i=(e+d)/2;f?(h=i<.5?f/(e+d):f/(2-e-d),a==e?g=(b-c)/f+(b<c?6:0):b==e?g=(c-a)/f+2:g=(a-b)/f+4,g*=60):h=g=0;return P(g,h,i)}function K(a,b,c){var d=0,e=0,f=0,g,h,i;g=/([a-z]+)\((.*)\)/i.exec(a);if(g){h=g[2].split(",");switch(g[1]){case"hsl":return c(parseFloat(h[0]),parseFloat(h[1])/100,parseFloat(h[2])/100);case"rgb":return b(M(h[0]),M(h[1]),M(h[2]))}}if(i=N[a])return b(i.r,i.g,i.b);a!=null&&a.charAt(0)==="#"&&(a.length===4?(d=a.charAt(1),d+=d,e=a.charAt(2),e+=e,f=a.charAt(3),f+=f):a.length===7&&(d=a.substring(1,3),e=a.substring(3,5),f=a.substring(5,7)),d=parseInt(d,16),e=parseInt(e,16),f=parseInt(f,16));return b(d,e,f)}function J(a){return a<16?"0"+a.toString(16):a.toString(16)}function I(a,b,c){this.r=a,this.g=b,this.b=c}function H(a,b,c){return new I(a,b,c)}function G(a,b){b=b-(a=+a)?1/(b-a):0;return function(c){return Math.max(0,Math.min(1,(c-a)*b))}}function F(a,b){b=b-(a=+a)?1/(b-a):0;return function(c){return(c-a)*b}}function E(a){return a in D||/\bcolor\b/.test(a)?d3.interpolateRgb:d3.interpolate}function B(a){return a<1/2.75?7.5625*a*a:a<2/2.75?7.5625*(a-=1.5/2.75)*a+.75:a<2.5/2.75?7.5625*(a-=2.25/2.75)*a+.9375:7.5625*(a-=2.625/2.75)*a+.984375}function A(a){a||(a=1.70158);return function(b){return b*b*((a+1)*b-a)}}function z(a,b){var c;arguments.length<2&&(b=.45),arguments.length<1?(a=1,c=b/4):c=b/(2*Math.PI)*Math.asin(1/a);return function(d){return 1+a*Math.pow(2,10*-d)*Math.sin((d-c)*2*Math.PI/b)}}function y(a){return 1-Math.sqrt(1-a*a)}function x(a){return Math.pow(2,10*(a-1))}function w(a){return 1-Math.cos(a*Math.PI/2)}function v(a){return function(b){return Math.pow(b,a)}}function u(a){return a}function t(a){return function(b){return.5*(b<.5?a(2*b):2-a(2-2*b))}}function s(a){return function(b){return 1-a(1-b)}}function n(a){var b=a.lastIndexOf("."),c=b>=0?a.substring(b):(b=a.length,""),d=[];while(b>0)d.push(a.substring(b-=3,b+3));return d.reverse().join(",")+c}function m(a){return a+""}function j(a){var b={},c=[];b.add=function(a){for(var d=0;d<c.length;d++)if(c[d].listener==a)return b;c.push({listener:a,on:!0});return b},b.remove=function(a){for(var d=0;d<c.length;d++){var e=c[d];if(e.listener==a){e.on=!1,c=c.slice(0,d).concat(c.slice(d+1));break}}return b},b.dispatch=function(){var a=c;for(var b=0,d=a.length;b<d;b++){var e=a[b];e.on&&e.listener.apply(this,arguments)}};return b}function h(a){return a.replace(/(^\s+)|(\s+$)/g,"").replace(/\s+/g," ")}function g(a){return a==null}function f(a){return a.length}function e(){return this}Date.now||(Date.now=function(){return+(new Date)});try{document.createElement("div").style.setProperty("opacity",0,"")}catch(a){var b=CSSStyleDeclaration.prototype,c=b.setProperty;b.setProperty=function(a,b,d){c.call(this,a,b+"",d)}}d3={version:"2.1.0"};var d=[].__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(!(e=arguments.length))return[];for(var a=-1,b=d3.min(arguments,f),c=Array(b);++a<b;)for(var d=-1,e,g=c[a]=Array(e);++d<e;)g[d]=arguments[d][a];return c},d3.bisectLeft=function(a,b,c,d){arguments.length<3&&(c=0),arguments.length<4&&(d=a.length);while(c<d){var e=c+d>>1;a[e]<b?c=e+1:d=e}return c},d3.bisect=d3.bisectRight=function(a,b,c,d){arguments.length<3&&(c=0),arguments.length<4&&(d=a.length);while(c<d){var e=c+d>>1;b<a[e]?d=e:c=e+1}return c},d3.first=function(a,b){var c=0,d=a.length,e=a[0],f;arguments.length===1&&(b=d3.ascending);while(++c<d)b.call(a,e,f=a[c])>0&&(e=f);return e},d3.last=function(a,b){var c=0,d=a.length,e=a[0],f;arguments.length===1&&(b=d3.ascending);while(++c<d)b.call(a,e,f=a[c])<=0&&(e=f);return e},d3.nest=function(){function g(a,d){if(d>=b.length)return a;var e=[],f=c[d++],h;for(h in a)e.push({key:h,values:g(a[h],d)});f&&e.sort(function(a,b){return f(a.key,b.key)});return e}function f(c,g){if(g>=b.length)return e?e.call(a,c):d?c.sort(d):c;var h=-1,i=c.length,j=b[g++],k,l,m={};while(++h<i)(k=j(l=c[h]))in m?m[k].push(l):m[k]=[l];for(k in m)m[k]=f(m[k],g);return m}var a={},b=[],c=[],d,e;a.map=function(a){return f(a,0)},a.entries=function(a){return g(f(a,0),0)},a.key=function(c){b.push(c);return a},a.sortKeys=function(d){c[b.length-1]=d;return a},a.sortValues=function(b){d=b;return a},a.rollup=function(b){e=b;return a};return a},d3.keys=function(a){var b=[];for(var c in a)b.push(c);return b},d3.values=function(a){var b=[];for(var c in a)b.push(a[c]);return b},d3.entries=function(a){var b=[];for(var c in a)b.push({key:c,value:a[c]});return b},d3.permute=function(a,b){var c=[],d=-1,e=b.length;while(++d<e)c[d]=a[b[d]];return c},d3.merge=function(a){return Array.prototype.concat.apply([],a)},d3.split=function(a,b){var c=[],d=[],e,f=-1,h=a.length;arguments.length<2&&(b=g);while(++f<h)b.call(d,e=a[f],f)?d=[]:(d.length||c.push(d),d.push(e));return c},d3.range=function(a,b,c){arguments.length<3&&(c=1,arguments.length<2&&(b=a,a=0));if((b-a)/c==Infinity)throw new Error("infinite range");var d=[],e=-1,f;if(c<0)while((f=a+c*++e)>b)d.push(f);else while((f=a+c*++e)<b)d.push(f);return d},d3.requote=function(a){return a.replace(i,"\\$&")};var i=/[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g;d3.round=function(a,b){return b?Math.round(a*Math.pow(10,b))*Math.pow(10,-b):Math.round(a)},d3.xhr=function(a,b,c){var d=new XMLHttpRequest;arguments.length<3?c=b:b&&d.overrideMimeType&&d.overrideMimeType(b),d.open("GET",a,!0),d.onreadystatechange=function(){d.readyState===4&&c(d.status<300?d:null)},d.send(null)},d3.text=function(a,b,c){function d(a){c(a&&a.responseText)}arguments.length<3&&(c=b,b=null),d3.xhr(a,b,d)},d3.json=function(a,b){d3.text(a,"application/json",function(a){b(a?JSON.parse(a):null)})},d3.html=function(a,b){d3.text(a,"text/html",function(a){if(a!=null){var c=document.createRange();c.selectNode(document.body),a=c.createContextualFragment(a)}b(a)})},d3.xml=function(a,b,c){function d(a){c(a&&a.responseXML)}arguments.length<3&&(c=b,b=null),d3.xhr(a,b,d)},d3.ns={prefix:{svg:"http://www.w3.org/2000/svg",xhtml:"http://www.w3.org/1999/xhtml",xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"},qualify:function(a){var b=a.indexOf(":");return b<0?a:{space:d3.ns.prefix[a.substring(0,b)],local:a.substring(b+1)}}},d3.dispatch=function(a){var b={},c;for(var d=0,e=arguments.length;d<e;d++)c=arguments[d],b[c]=j(c);return b},d3.format=function(a){var b=k.exec(a),c=b[1]||" ",d=b[3]||"",e=b[5],f=+b[6],g=b[7],h=b[8],i=b[9],j=!1,o=!1;h&&(h=h.substring(1)),e&&(c="0",g&&(f-=Math.floor((f-1)/4)));switch(i){case"n":g=!0,i="g";break;case"%":j=!0,i="f";break;case"p":j=!0,i="r";break;case"d":o=!0,h="0"}i=l[i]||m;return function(a){var b=j?a*100:+a,k=b<0&&(b=-b)?"−":d;if(o&&b%1)return"";a=i(b,h);if(e){var l=a.length+k.length;l<f&&(a=Array(f-l+1).join(c)+a),g&&(a=n(a)),a=k+a}else{g&&(a=n(a)),a=k+a;var l=a.length;l<f&&(a=Array(f-l+1).join(c)+a)}j&&(a+="%");return a}};var k=/(?:([^{])?([<>=^]))?([+\- ])?(#)?(0)?([0-9]+)?(,)?(\.[0-9]+)?([a-zA-Z%])?/,l={g:function(a,b){return a.toPrecision(b)},e:function(a,b){return a.toExponential(b)},f:function(a,b){return a.toFixed(b)},r:function(a,b){var c=1+Math.floor(1e-15+Math.log(a)/Math.LN10);return d3.round(a,b-c).toFixed(Math.max(0,Math.min(20,b-c)))}},o=v(2),p=v(3),q={linear:function(){return u},poly:v,quad:function(){return o},cubic:function(){return p},sin:function(){return w},exp:function(){return x},circle:function(){return y},elastic:z,back:A,bounce:function(){return B}},r={"in":function(a){return a},out:s,"in-out":t,"out-in":function(a){return t(s(a))}};d3.ease=function(a){var b=a.indexOf("-"),c=b>=0?a.substring(0,b):a,d=b>=0?a.substring(b+1):"in";return r[d](q[c].apply(null,Array.prototype.slice.call(arguments,1)))},d3.event=null,d3.interpolate=function(a,b){var c=d3.interpolators.length,d;while(--c>=0&&!(d=d3.interpolators[c](a,b)));return d},d3.interpolateNumber=function(a,b){b-=a;return function(c){return a+b*c}},d3.interpolateRound=function(a,b){b-=a;return function(c){return Math.round(a+b*c)}},d3.interpolateString=function(a,b){var c,d,e,f=0,g=0,h=[],i=[],j,k;C.lastIndex=0;for(d=0;c=C.exec(b);++d)c.index&&h.push(b.substring(f,g=c.index)),i.push({i:h.length,x:c[0]}),h.push(null),f=C.lastIndex;f<b.length&&h.push(b.substring(f));for(d=0,j=i.length;(c=C.exec(a))&&d<j;++d){k=i[d];if(k.x==c[0]){if(k.i)if(h[k.i+1]==null){h[k.i-1]+=k.x,h.splice(k.i,1);for(e=d+1;e<j;++e)i[e].i--}else{h[k.i-1]+=k.x+h[k.i+1],h.splice(k.i,2);for(e=d+1;e<j;++e)i[e].i-=2}else if(h[k.i+1]==null)h[k.i]=k.x;else{h[k.i]=k.x+h[k.i+1],h.splice(k.i+1,1);for(e=d+1;e<j;++e)i[e].i--}i.splice(d,1),j--,d--}else k.x=d3.interpolateNumber(parseFloat(c[0]),parseFloat(k.x))}while(d<j)k=i.pop(),h[k.i+1]==null?h[k.i]=k.x:(h[k.i]=k.x+h[k.i+1],h.splice(k.i+1,1)),j--;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 R(c+f*a,d+g*a,e+h*a).toString()}},d3.interpolateArray=function(a,b){var c=[],d=[],e=a.length,f=b.length,g=Math.min(a.length,b.length),h;for(h=0;h<g;++h)c.push(d3.interpolate(a[h],b[h]));for(;h<e;++h)d[h]=a[h];for(;h<f;++h)d[h]=b[h];return function(a){for(h=0;h<g;++h)d[h]=c[h](a);return d}},d3.interpolateObject=function(a,b){var c={},d={},e;for(e in a)e in b?c[e]=E(e)(a[e],b[e]):d[e]=a[e];for(e in b)e in a||(d[e]=b[e]);return function(a){for(e in c)d[e]=c[e](a);return d}};var C=/[-+]?(?:\d+\.\d+|\d+\.|\.\d+|\d+)(?:[eE][-]?\d+)?/g,D={background:1,fill:1,stroke:1};d3.interpolators=[d3.interpolateObject,function(a,b){return b instanceof Array&&d3.interpolateArray(a,b)},function(a,b){return typeof b=="string"&&d3.interpolateString(String(a),b)},function(a,b){return(typeof b=="string"?b in N||/^(#|rgb\(|hsl\()/.test(b):b instanceof I||b instanceof Q)&&d3.interpolateRgb(String(a),b)},function(a,b){return typeof b=="number"&&d3.interpolateNumber(+a,b)}],d3.rgb=function(a,b,c){return arguments.length===1?K(""+a,H,R):H(~~a,~~b,~~c)},I.prototype.brighter=function(a){a=Math.pow(.7,arguments.length?a:1);var b=this.r,c=this.g,d=this.b,e=30;if(!b&&!c&&!d)return H(e,e,e);b&&b<e&&(b=e),c&&c<e&&(c=e),d&&d<e&&(d=e);return H(Math.min(255,Math.floor(b/a)),Math.min(255,Math.floor(c/a)),Math.min(255,Math.floor(d/a)))},I.prototype.darker=function(a){a=Math.pow(.7,arguments.length?a:1);return H(Math.max(0,Math.floor(a*this.r)),Math.max(0,Math.floor(a*this.g)),Math.max(0,Math.floor(a*this.b)))},I.prototype.hsl=function(){return L(this.r,this.g,this.b)},I.prototype.toString=function(){return"#"+J(this.r)+J(this.g)+J(this.b)};var N={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"};for(var O in N)N[O]=K(N[O],H,R);d3.hsl=function(a,b,c){return arguments.length===1?K(""+a,L,P):P(+a,+b,+c)},Q.prototype.brighter=function(a){a=Math.pow(.7,arguments.length?a:1);return P(this.h,this.s,this.l/a)},Q.prototype.darker=function(a){a=Math.pow(.7,arguments.length?a:1);return P(this.h,this.s,a*this.l)},Q.prototype.rgb=function(){return R(this.h,this.s,this.l)},Q.prototype.toString=function(){return"hsl("+this.h+","+this.s*100+"%,"+this.l*100+"%)"};var T=function(a,b){return b.querySelector(a)},U=function(a,b){return b.querySelectorAll(a)};typeof Sizzle=="function"&&(T=function(a,b){return Sizzle(a,b)[0]},U=function(a,b){return Sizzle.uniqueSort(Sizzle(a,b))});var V=[];d3.selection=function(){return ba},d3.selection.prototype=V,V.select=function(a){var b=[],c,d,e,f;typeof a!="function"&&(a=W(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 S(b)},V.selectAll=function(a){var b=[],c,d;typeof a!="function"&&(a=X(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 S(b)},V.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)},V.classed=function(a,b){function i(){(b.apply(this,arguments)?f:g).call(this)}function g(){if(b=this.classList)return b.remove(a);var b=this.className,d=b.baseVal!=null,e=d?b.baseVal:b;e=h(e.replace(c," ")),d?b.baseVal=e:this.className=e}function f(){if(b=this.classList)return b.add(a);var b=this.className,d=b.baseVal!=null,e=d?b.baseVal:b;c.lastIndex=0,c.test(e)||(e=h(e+" "+a),d?b.baseVal=e:this.className=e)}var c=new RegExp("(^|\\s+)"+d3.requote(a)+"(\\s+|$)","g");if(arguments.length<2){var d=this.node();if(e=d.classList)return e.contains(a);var e=d.className;c.lastIndex=0;return c.test(e
<del>.baseVal!=null?e.baseVal:e)}return this.each(typeof b=="function"?i:b?f:g)},V.style=function(a,b,c){function f(){var d=b.apply(this,arguments);d==null?this.style.removeProperty(a):this.style.setProperty(a,d,c)}function e(){this.style.setProperty(a,b,c)}function d(){this.style.removeProperty(a)}arguments.length<3&&(c="");return arguments.length<2?window.getComputedStyle(this.node(),null).getPropertyValue(a):this.each(b==null?d:typeof b=="function"?f:e)},V.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)},V.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})},V.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})},V.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)},V.insert=function(a,b){function d(){return this.insertBefore(document.createElementNS(a.space,a.local),T(b,this))}function c(){return this.insertBefore(document.createElement(a),T(b,this))}a=d3.ns.qualify(a);return this.select(a.local?d:c)},V.remove=function(){return this.each(function(){var a=this.parentNode;a&&a.removeChild(this)})},V.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]=Y(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]=Y(p),l[g]=n[g]=null);for(;g<i;++g)m[g]=Y(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=S(d);j.enter=function(){return Z(c)},j.exit=function(){return S(e)};return j};var $=[];$.append=V.append,$.insert=V.insert,$.empty=V.empty,$.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 S(b)},V.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 S(b)},V.map=function(a){return this.each(function(){this.__data__=a.apply(this,arguments)})},V.sort=function(a){a=_.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},V.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})},V.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},V.call=function(a){a.apply(this,(arguments[0]=this,arguments));return this},V.empty=function(){return!this.node()},V.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},V.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 bb(a,bf||++be)};var ba=S([[document]]);ba[0].parentNode=document.documentElement,d3.select=function(a){return typeof a=="string"?ba.select(a):S([[a]])},d3.selectAll=function(a){return typeof a=="string"?ba.selectAll(a):S([a])};var bd=[],be=0,bf=0,bg=d3.ease("cubic-in-out");bd.call=V.call,d3.transition=function(){return ba.transition()},d3.transition.prototype=bd,bd.select=function(a){var b=[],c,d,e;typeof a!="function"&&(a=W(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 bb(b,this.id).ease(this.ease())},bd.selectAll=function(a){var b=[],c,d;typeof a!="function"&&(a=X(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 bb(b,this.id).ease(this.ease())},bd.attr=function(a,b){return this.attrTween(a,bc(b))},bd.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)},bd.style=function(a,b,c){arguments.length<3&&(c="");return this.styleTween(a,bc(b),c)},bd.styleTween=function(a,b,c){arguments.length<3&&(c="");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)}})},bd.text=function(a){return this.tween("text",function(b,c){this.textContent=typeof a=="function"?a.call(this,b,c):a})},bd.remove=function(){return this.each("end",function(){var a;!this.__transition__&&(a=this.parentNode)&&a.removeChild(this)})},bd.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}))},bd.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}))},bd.transition=function(){return this.select(e)};var bi=null,bj,bk;d3.timer=function(a,b,c){var d=!1,e,f=bi;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||(bi={callback:a,then:c,delay:b,next:bi}),bj||(bk=clearTimeout(bk),bj=1,bn(bl))},d3.timer.flush=function(){var a,b=Date.now(),c=bi;while(c)a=b-c.then,c.delay||(c.flush=c.callback(a)),c=c.next;bm()};var bn=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(a){setTimeout(a,17)};d3.scale={},d3.scale.linear=function(){return bs([0,1],[0,1],d3.interpolate,!1)},d3.scale.log=function(){return bA(d3.scale.linear(),bB)},bB.pow=function(a){return Math.pow(10,a)},bC.pow=function(a){return-Math.pow(10,-a)},d3.scale.pow=function(){return bE(d3.scale.linear(),1)},d3.scale.sqrt=function(){return d3.scale.pow().exponent(.5)},d3.scale.ordinal=function(){return bG([],{t:"range",x:[]})},d3.scale.category10=function(){return d3.scale.ordinal().range(bH)},d3.scale.category20=function(){return d3.scale.ordinal().range(bI)},d3.scale.category20b=function(){return d3.scale.ordinal().range(bJ)},d3.scale.category20c=function(){return d3.scale.ordinal().range(bK)};var bH=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],bI=["#1f77b4","#aec7e8","#ff7f0e","#ffbb78","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5","#8c564b","#c49c94","#e377c2","#f7b6d2","#7f7f7f","#c7c7c7","#bcbd22","#dbdb8d","#17becf","#9edae5"],bJ=["#393b79","#5254a3","#6b6ecf","#9c9ede","#637939","#8ca252","#b5cf6b","#cedb9c","#8c6d31","#bd9e39","#e7ba52","#e7cb94","#843c39","#ad494a","#d6616b","#e7969c","#7b4173","#a55194","#ce6dbd","#de9ed6"],bK=["#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 bL([],[])},d3.scale.quantize=function(){return bM(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)+bN,h=d.apply(this,arguments)+bN,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>=bO?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=bP,b=bQ,c=bR,d=bS;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+bN;return[Math.cos(f)*e,Math.sin(f)*e]};return e};var bN=-Math.PI/2,bO=2*Math.PI-1e-6;d3.svg.line=function(){return bT(Object)};var bX={linear:bY,"step-before":bZ,"step-after":b$,basis:ce,"basis-open":cf,"basis-closed":cg,bundle:ch,cardinal:cb,"cardinal-open":b_,"cardinal-closed":ca,monotone:cq},cj=[0,2/3,1/3,0],ck=[0,1/3,2/3,0],cl=[0,1/6,2/3,1/6];d3.svg.line.radial=function(){var a=bT(cr);a.radius=a.x,delete a.x,a.angle=a.y,delete a.y;return a},d3.svg.area=function(){return cs(Object)},d3.svg.area.radial=function(){var a=cs(cr);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)+bN,k=e.call(a,h,g)+bN;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=cv,b=cw,c=cx,d=bR,e=bS;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=cv,b=cw,c=cA;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=cA,c=a.projection;a.projection=function(a){return arguments.length?c(cB(b=a)):b};return a},d3.svg.mouse=function(a){return cD(a,d3.event)};var cC=/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=cD(a,b);c.identifier=b.identifier;return c}):[]},d3.svg.symbol=function(){function c(c,d){return(cG[a.call(this,c,d)]||cG.circle)(b.call(this,c,d))}var a=cF,b=cE;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 cG={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*cI)),c=b*cI;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/cH),c=b*cH/2;return"M0,"+c+"L"+b+","+ -c+" "+ -b+","+ -c+"Z"},"triangle-up":function(a){var b=Math.sqrt(a/cH),c=b*cH/2;return"M0,"+ -c+"L"+b+","+c+" "+ -b+","+c+"Z"}};d3.svg.symbolTypes=d3.keys(cG);var cH=Math.sqrt(3),cI=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=cL(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=bp(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=cJ,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=cJ,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=cK,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=cK,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),cS("dragstart")}function c(){cM=a,cP=cT((cN=this).parentNode),cQ=0,cO=arguments}function b(){this.on("mousedown.drag",d).on("touchstart.drag",d),d3.select(window).on("mousemove.drag",cU).on("touchmove.drag",cU).on("mouseup.drag",cV,!0).on("touchend.drag",cV,!0).on("click.drag",cW,!0)}var a=d3.dispatch("drag","dragstart","dragend");b.on=function(c,d){a[c].add(d);return b};return b};var cM,cN,cO,cP,cQ,cR;d3.behavior.zoom=function(){function h(){d.apply(this,arguments);var b=dj(),c,e=Date.now();b.length===1&&e-da<300&&dp(1+Math.floor(a[2]),c=b[0],c_[c.identifier]),da=e}function g(){d.apply(this,arguments);var b=d3.svg.mouse(dd);dp(d3.event.shiftKey?Math.ceil(a[2]-1):Math.floor(a[2]+1),b,dh(b))}function f(){d.apply(this,arguments),c$||(c$=dh(d3.svg.mouse(dd))),dp(di()+a[2],d3.svg.mouse(dd),c$)}function e(){d.apply(this,arguments),cZ=dh(d3.svg.mouse(dd)),df=!1,d3.event.preventDefault(),window.focus()}function d(){db=a,dc=b.zoom.dispatch,dd=this,de=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",dl).on("mouseup.zoom",dm).on("touchmove.zoom",dk).on("touchend.zoom",dj).on("click.zoom",dn,!0)}var a=[0,0,0],b=d3.dispatch("zoom");c.on=function(a,d){b[a].add(d);return c};return c};var cY,cZ,c$,c_={},da=0,db,dc,dd,de,df,dg})()
<ide>\ No newline at end of file
<add>(function(){function dp(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,(db[2]=a)-c[2]),e=db[0]=b[0]-d*c[0],f=db[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{dc.apply(dd,de)}finally{d3.event=g}g.preventDefault()}function dn(){dg&&(d3.event.stopPropagation(),d3.event.preventDefault(),dg=!1)}function dm(){cZ&&(df&&(dg=!0),dl(),cZ=null)}function dl(){c$=null,cZ&&(df=!0,dp(db[2],d3.svg.mouse(dd),cZ))}function dk(){var a=d3.svg.touches(dd);switch(a.length){case 1:var b=a[0];dp(db[2],b,c_[b.identifier]);break;case 2:var c=a[0],d=a[1],e=[(c[0]+d[0])/2,(c[1]+d[1])/2],f=c_[c.identifier],g=c_[d.identifier],h=[(f[0]+g[0])/2,(f[1]+g[1])/2,f[2]];dp(Math.log(d3.event.scale)/Math.LN2+f[2],e,h)}}function dj(){var a=d3.svg.touches(dd),b=-1,c=a.length,d;while(++b<c)c_[(d=a[b]).identifier]=dh(d);return a}function di(){cY||(cY=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{cY.scrollTop=1e3,cY.dispatchEvent(a),b=1e3-cY.scrollTop}catch(c){b=a.wheelDelta||-a.detail*5}return b*.005}function dh(a){return[a[0]-db[0],a[1]-db[1],db[2]]}function cX(){d3.event.stopPropagation(),d3.event.preventDefault()}function cW(){cR&&(cX(),cR=!1)}function cV(){!cN||(cS("dragend"),cN=null,cQ&&(cR=!0,cX()))}function cU(){if(!!cN){var a=cN.parentNode;if(!a)return cV();cS("drag"),cX()}}function cT(a){return d3.event.touches?d3.svg.touches(a)[0]:d3.svg.mouse(a)}function cS(a){var b=d3.event,c=cN.parentNode,d=0,e=0;c&&(c=cT(c),d=c[0]-cP[0],e=c[1]-cP[1],cP=c,cQ|=d|e);try{d3.event={dx:d,dy:e},cM[a].dispatch.apply(cN,cO)}finally{d3.event=b}b.preventDefault()}function cL(a,b,c){e=[];if(c&&b.length>1){var d=bp(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 cK(a,b){a.attr("transform",function(a){return"translate(0,"+b(a)+")"})}function cJ(a,b){a.attr("transform",function(a){return"translate("+b(a)+",0)"})}function cF(){return"circle"}function cE(){return 64}function cD(a,b){var c=(a.ownerSVGElement||a).createSVGPoint();if(cC<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();cC=!e.f&&!e.e,d.remove()}cC?(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 cB(a){return function(){var b=a.apply(this,arguments),c=b[0],d=b[1]+bN;return[c*Math.cos(d),c*Math.sin(d)]}}function cA(a){return[a.x,a.y]}function cz(a){return a.endAngle}function cy(a){return a.startAngle}function cx(a){return a.radius}function cw(a){return a.target}function cv(a){return a.source}function cu(a){return function(b,c){return a[c][1]}}function ct(a){return function(b,c){return a[c][0]}}function cs(a){function i(f){if(f.length<1)return null;var i=bU(this,f,b,d),j=bU(this,f,b===c?ct(i):c,d===e?cu(i):e);return"M"+g(a(j),h)+"L"+g(a(i.reverse()),h)+"Z"}var b=bV,c=bV,d=0,e=bW,f="linear",g=bX[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=bX[f=a];return i},i.tension=function(a){if(!arguments.length)return h;h=a;return i};return i}function cr(a){var b,c=-1,d=a.length,e,f;while(++c<d)b=a[c],e=b[0],f=b[1]+bN,b[0]=e*Math.cos(f),b[1]=e*Math.sin(f);return a}function cq(a){return a.length<3?bY(a):a[0]+cc(a,cp(a))}function cp(a){var b=[],c,d,e,f,g=co(a),h=-1,i=a.length-1;while(++h<i)c=cn(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 co(a){var b=0,c=a.length-1,d=[],e=a[0],f=a[1],g=d[0]=cn(e,f);while(++b<c)d[b]=g+(g=cn(e=f,f=a[b+1]));d[b]=g;return d}function cn(a,b){return(b[1]-a[1])/(b[0]-a[0])}function cm(a,b,c){a.push("C",ci(cj,b),",",ci(cj,c),",",ci(ck,b),",",ci(ck,c),",",ci(cl,b),",",ci(cl,c))}function ci(a,b){return a[0]*b[0]+a[1]*b[1]+a[2]*b[2]+a[3]*b[3]}function ch(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 ce(a)}function cg(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=[ci(cl,g),",",ci(cl,h)],--c;while(++c<e)f=a[c%d],g.shift(),g.push(f[0]),h.shift(),h.push(f[1]),cm(b,g,h);return b.join("")}function cf(a){if(a.length<4)return bY(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(ci(cl,f)+","+ci(cl,g)),--c;while(++c<d)e=a[c],f.shift(),f.push(e[0]),g.shift(),g.push(e[1]),cm(b,f,g);return b.join("")}function ce(a){if(a.length<3)return bY(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),cm(b,h,i);while(++c<d)e=a[c],h.shift(),h.push(e[0]),i.shift(),i.push(e[1]),cm(b,h,i);c=-1;while(++c<2)h.shift(),h.push(e[0]),i.shift(),i.push(e[1]),cm(b,h,i);return b.join("")}function cd(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 cc(a,b){if(b.length<1||a.length!=b.length&&a.length!=b.length+2)return bY(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 cb(a,b,c){return a.length<3?bY(a):a[0]+cc(a,cd(a,b))}function ca(a,b){return a.length<3?bY(a):a[0]+cc((a.push(a[0]),a),cd([a[a.length-2]].concat(a,[a[1]]),b))}function b_(a,b){return a.length<4?bY(a):a[1]+cc(a.slice(1,a.length-1),cd(a,b))}function b$(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 bZ(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 bY(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 bW(a){return a[1]}function bV(a){return a[0]}function bU(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 bT(a){function g(d){return d.length<1?null:"M"+e(a(bU(this,d,b,c)),f)}var b=bV,c=bW,d="linear",e=bX[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=bX[d=a];return g},g.tension=function(a){if(!arguments.length)return f;f=a;return g};return g}function bS(a){return a.endAngle}function bR(a){return a.startAngle}function bQ(a){return a.outerRadius}function bP(a){return a.innerRadius}function bM(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 bM(a,b,c)};return g()}function bL(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 bL(a,b)};return d()}function bG(a,b){function f(b){return d[((c[b]||(c[b]=a.push(b)))-1)%d.length]}var c,d,e;f.domain=function(d){if(!arguments.length)return a;a=[],c={};var e=-1,g=d.length,h;while(++e<g)c[h=d[e]]||(c[h]=a.push(h));return f[b.t](b.x,b.p)},f.range=function(a){if(!arguments.length)return d;d=a,e=0,b={t:"range",x:a};return f},f.rangePoints=function(c,g){arguments.length<2&&(g=0);var h=c[0],i=c[1],j=(i-h)/(a.length-1+g);d=a.length<2?[(h+i)/2]:d3.range(h+j*g/2,i+j/2,j),e=0,b={t:"rangePoints",x:c,p:g};return f},f.rangeBands=function(c,g){arguments.length<2&&(g=0);var h=c[0],i=c[1],j=(i-h)/(a.length+g);d=d3.range(h+j*g,i,j),e=j*(1-g),b={t:"rangeBands",x:c,p:g};return f},f.rangeRoundBands=function(c,g){arguments.length<2&&(g=0);var h=c[0],i=c[1],j=Math.floor((i-h)/(a.length+g)),k=i-h-(a.length-g)*j;d=d3.range(h+Math.round(k/2),i,j),e=Math.round(j*(1-g)),b={t:"rangeRoundBands",x:c,p:g};return f},f.rangeBand=function(){return e},f.copy=function(){return bG(a,b)};return f.domain(a)}function bF(a){return function(b){return b<0?-Math.pow(-b,a):Math.pow(b,a)}}function bE(a,b){function e(b){return a(c(b))}var c=bF(b),d=bF(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 bw(e.domain(),a)},e.tickFormat=function(a){return bx(e.domain(),a)},e.nice=function(){return e.domain(bq(e.domain(),bu))},e.exponent=function(a){if(!arguments.length)return b;var f=e.domain();c=bF(b=a),d=bF(1/b);return e.domain(f)},e.copy=function(){return bE(a.copy(),b)};return bt(e,a)}function bD(a){return a.toPrecision(1)}function bC(a){return-Math.log(-a)/Math.LN10}function bB(a){return Math.log(a)/Math.LN10}function bA(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?bC:bB,c=b.pow,a.domain(e.map(b));return d},d.nice=function(){a.domain(bq(a.domain(),br));return d},d.ticks=function(){var d=bp(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===bC){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 bD},d.copy=function(){return bA(a.copy(),b)};return bt(d,a)}function bz(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 by(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 bx(a,b){return d3.format(",."+Math.max(0,-Math.floor(Math.log(bv(a,b)[2])/Math.LN10+.01))+"f")}function bw(a,b){return d3.range.apply(d3,bv(a,b))}function bv(a,b){var c=bp(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 bu(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 bt(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 bs(a,b,c,d){function h(a){return e(a)}function g(){var g=a.length==2?by:bz,i=d?G:F;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 bw(a,b)},h.tickFormat=function(b){return bx(a,b)},h.nice=function(){bq(a,bu);return g()},h.copy=function(){return bs(a,b,c,d)};return g()}function br(){return Math}function bq(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 bp(a){var b=a[0],c=a[a.length-1];return b<c?[b,c]:[c,b]}function bo(){}function bm(){var a=null,b=bi,c=Infinity;while(b)b.flush?b=a?a.next=b.next:bi=b.next:(c=Math.min(c,b.then+b.delay),b=(a=b).next);return c}function bl(){var a,b=Date.now(),c=bi;while(c)a=b-c.then,a>=c.delay&&(c.flush=c.callback(a)),c=c.next;var d=bm()-b;d>24?(isFinite(d)&&(clearTimeout(bk),bk=setTimeout(bl,d)),bj=0):(bj=1,bn(bl))}function bh(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 bc(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 bb(a,b){d(a,bd);var c={},e=d3.dispatch("start","end"),f=bg,g=Date.now();a.id=b,a.tween=function(b,d){if(arguments.length<2)return c[b];d==null?delete c[b]:c[b]=d;return a},a.ease=function(b){if(!arguments.length)return f;f=typeof b=="function"?b:d3.ease.apply(d3,arguments);return a},a.each=function(b,c){if(arguments.length<2)return bh.call(a,b);e[b].add(c);return a},d3.timer(function(d){a.each(function(h,i,j){function r(){--o.count||delete l.__transition__;return 1}function q(a){if(o.active!==b)return r();var c=Math.min(1,(a-m)/n),d=f(c),g=k.length;while(g>0)k[--g].call(l,d);if(c===1){r(),bf=b,e.end.dispatch.call(l,h,i),bf=0;return 1}}function p(a){if(o.active>b)return r();o.active=b;for(var d in c)(d=c[d].call(l,h,i))&&k.push(d);e.start.dispatch.call(l,h,i),q(a)||d3.timer(q,0,g);return 1}var k=[],l=this,m=a[j][i].delay,n=a[j][i].duration,o=l.__transition__||(l.__transition__={active:0,count:0});++o.count,m<=d?p(d):d3.timer(p,m,g)});return 1},0,g);return a}function _(a){arguments.length||(a=d3.ascending);return function(b,c){return a(b&&b.__data__,c&&c.__data__)}}function Z(a){d(a,$);return a}function Y(a){return{__data__:a}}function X(a){return function(){return U(a,this)}}function W(a){return function(){return T(a,this)}}function S(a){d(a,V);return a}function R(a,b,c){function g(a){return Math.round(f(a)*255)}function f(a){a>360?a-=360:a<0&&(a+=360);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 H(g(a+120),g(a),g(a-120))}function Q(a,b,c){this.h=a,this.s=b,this.l=c}function P(a,b,c){return new Q(a,b,c)}function M(a){var b=parseFloat(a);return a.charAt(a.length-1)==="%"?Math.round(b*2.55):b}function L(a,b,c){var d=Math.min(a/=255,b/=255,c/=255),e=Math.max(a,b,c),f=e-d,g,h,i=(e+d)/2;f?(h=i<.5?f/(e+d):f/(2-e-d),a==e?g=(b-c)/f+(b<c?6:0):b==e?g=(c-a)/f+2:g=(a-b)/f+4,g*=60):h=g=0;return P(g,h,i)}function K(a,b,c){var d=0,e=0,f=0,g,h,i;g=/([a-z]+)\((.*)\)/i.exec(a);if(g){h=g[2].split(",");switch(g[1]){case"hsl":return c(parseFloat(h[0]),parseFloat(h[1])/100,parseFloat(h[2])/100);case"rgb":return b(M(h[0]),M(h[1]),M(h[2]))}}if(i=N[a])return b(i.r,i.g,i.b);a!=null&&a.charAt(0)==="#"&&(a.length===4?(d=a.charAt(1),d+=d,e=a.charAt(2),e+=e,f=a.charAt(3),f+=f):a.length===7&&(d=a.substring(1,3),e=a.substring(3,5),f=a.substring(5,7)),d=parseInt(d,16),e=parseInt(e,16),f=parseInt(f,16));return b(d,e,f)}function J(a){return a<16?"0"+a.toString(16):a.toString(16)}function I(a,b,c){this.r=a,this.g=b,this.b=c}function H(a,b,c){return new I(a,b,c)}function G(a,b){b=b-(a=+a)?1/(b-a):0;return function(c){return Math.max(0,Math.min(1,(c-a)*b))}}function F(a,b){b=b-(a=+a)?1/(b-a):0;return function(c){return(c-a)*b}}function E(a){return a in D||/\bcolor\b/.test(a)?d3.interpolateRgb:d3.interpolate}function B(a){return a<1/2.75?7.5625*a*a:a<2/2.75?7.5625*(a-=1.5/2.75)*a+.75:a<2.5/2.75?7.5625*(a-=2.25/2.75)*a+.9375:7.5625*(a-=2.625/2.75)*a+.984375}function A(a){a||(a=1.70158);return function(b){return b*b*((a+1)*b-a)}}function z(a,b){var c;arguments.length<2&&(b=.45),arguments.length<1?(a=1,c=b/4):c=b/(2*Math.PI)*Math.asin(1/a);return function(d){return 1+a*Math.pow(2,10*-d)*Math.sin((d-c)*2*Math.PI/b)}}function y(a){return 1-Math.sqrt(1-a*a)}function x(a){return Math.pow(2,10*(a-1))}function w(a){return 1-Math.cos(a*Math.PI/2)}function v(a){return function(b){return Math.pow(b,a)}}function u(a){return a}function t(a){return function(b){return.5*(b<.5?a(2*b):2-a(2-2*b))}}function s(a){return function(b){return 1-a(1-b)}}function n(a){var b=a.lastIndexOf("."),c=b>=0?a.substring(b):(b=a.length,""),d=[];while(b>0)d.push(a.substring(b-=3,b+3));return d.reverse().join(",")+c}function m(a){return a+""}function j(a){var b={},c=[];b.add=function(a){for(var d=0;d<c.length;d++)if(c[d].listener==a)return b;c.push({listener:a,on:!0});return b},b.remove=function(a){for(var d=0;d<c.length;d++){var e=c[d];if(e.listener==a){e.on=!1,c=c.slice(0,d).concat(c.slice(d+1));break}}return b},b.dispatch=function(){var a=c;for(var b=0,d=a.length;b<d;b++){var e=a[b];e.on&&e.listener.apply(this,arguments)}};return b}function h(a){return a.replace(/(^\s+)|(\s+$)/g,"").replace(/\s+/g," ")}function g(a){return a==null}function f(a){return a.length}function e(){return this}Date.now||(Date.now=function(){return+(new Date)});try{document.createElement("div").style.setProperty("opacity",0,"")}catch(a){var b=CSSStyleDeclaration.prototype,c=b.setProperty;b.setProperty=function(a,b,d){c.call(this,a,b+"",d)}}d3={version:"2.1.1"};var d=[].__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(!(e=arguments.length))return[];for(var a=-1,b=d3.min(arguments,f),c=Array(b);++a<b;)for(var d=-1,e,g=c[a]=Array(e);++d<e;)g[d]=arguments[d][a];return c},d3.bisectLeft=function(a,b,c,d){arguments.length<3&&(c=0),arguments.length<4&&(d=a.length);while(c<d){var e=c+d>>1;a[e]<b?c=e+1:d=e}return c},d3.bisect=d3.bisectRight=function(a,b,c,d){arguments.length<3&&(c=0),arguments.length<4&&(d=a.length);while(c<d){var e=c+d>>1;b<a[e]?d=e:c=e+1}return c},d3.first=function(a,b){var c=0,d=a.length,e=a[0],f;arguments.length===1&&(b=d3.ascending);while(++c<d)b.call(a,e,f=a[c])>0&&(e=f);return e},d3.last=function(a,b){var c=0,d=a.length,e=a[0],f;arguments.length===1&&(b=d3.ascending);while(++c<d)b.call(a,e,f=a[c])<=0&&(e=f);return e},d3.nest=function(){function g(a,d){if(d>=b.length)return a;var e=[],f=c[d++],h;for(h in a)e.push({key:h,values:g(a[h],d)});f&&e.sort(function(a,b){return f(a.key,b.key)});return e}function f(c,g){if(g>=b.length)return e?e.call(a,c):d?c.sort(d):c;var h=-1,i=c.length,j=b[g++],k,l,m={};while(++h<i)(k=j(l=c[h]))in m?m[k].push(l):m[k]=[l];for(k in m)m[k]=f(m[k],g);return m}var a={},b=[],c=[],d,e;a.map=function(a){return f(a,0)},a.entries=function(a){return g(f(a,0),0)},a.key=function(c){b.push(c);return a},a.sortKeys=function(d){c[b.length-1]=d;return a},a.sortValues=function(b){d=b;return a},a.rollup=function(b){e=b;return a};return a},d3.keys=function(a){var b=[];for(var c in a)b.push(c);return b},d3.values=function(a){var b=[];for(var c in a)b.push(a[c]);return b},d3.entries=function(a){var b=[];for(var c in a)b.push({key:c,value:a[c]});return b},d3.permute=function(a,b){var c=[],d=-1,e=b.length;while(++d<e)c[d]=a[b[d]];return c},d3.merge=function(a){return Array.prototype.concat.apply([],a)},d3.split=function(a,b){var c=[],d=[],e,f=-1,h=a.length;arguments.length<2&&(b=g);while(++f<h)b.call(d,e=a[f],f)?d=[]:(d.length||c.push(d),d.push(e));return c},d3.range=function(a,b,c){arguments.length<3&&(c=1,arguments.length<2&&(b=a,a=0));if((b-a)/c==Infinity)throw new Error("infinite range");var d=[],e=-1,f;if(c<0)while((f=a+c*++e)>b)d.push(f);else while((f=a+c*++e)<b)d.push(f);return d},d3.requote=function(a){return a.replace(i,"\\$&")};var i=/[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g;d3.round=function(a,b){return b?Math.round(a*Math.pow(10,b))*Math.pow(10,-b):Math.round(a)},d3.xhr=function(a,b,c){var d=new XMLHttpRequest;arguments.length<3?c=b:b&&d.overrideMimeType&&d.overrideMimeType(b),d.open("GET",a,!0),d.onreadystatechange=function(){d.readyState===4&&c(d.status<300?d:null)},d.send(null)},d3.text=function(a,b,c){function d(a){c(a&&a.responseText)}arguments.length<3&&(c=b,b=null),d3.xhr(a,b,d)},d3.json=function(a,b){d3.text(a,"application/json",function(a){b(a?JSON.parse(a):null)})},d3.html=function(a,b){d3.text(a,"text/html",function(a){if(a!=null){var c=document.createRange();c.selectNode(document.body),a=c.createContextualFragment(a)}b(a)})},d3.xml=function(a,b,c){function d(a){c(a&&a.responseXML)}arguments.length<3&&(c=b,b=null),d3.xhr(a,b,d)},d3.ns={prefix:{svg:"http://www.w3.org/2000/svg",xhtml:"http://www.w3.org/1999/xhtml",xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"},qualify:function(a){var b=a.indexOf(":");return b<0?a:{space:d3.ns.prefix[a.substring(0,b)],local:a.substring(b+1)}}},d3.dispatch=function(a){var b={},c;for(var d=0,e=arguments.length;d<e;d++)c=arguments[d],b[c]=j(c);return b},d3.format=function(a){var b=k.exec(a),c=b[1]||" ",d=b[3]||"",e=b[5],f=+b[6],g=b[7],h=b[8],i=b[9],j=!1,o=!1;h&&(h=h.substring(1)),e&&(c="0",g&&(f-=Math.floor((f-1)/4)));switch(i){case"n":g=!0,i="g";break;case"%":j=!0,i="f";break;case"p":j=!0,i="r";break;case"d":o=!0,h="0"}i=l[i]||m;return function(a){var b=j?a*100:+a,k=b<0&&(b=-b)?"−":d;if(o&&b%1)return"";a=i(b,h);if(e){var l=a.length+k.length;l<f&&(a=Array(f-l+1).join(c)+a),g&&(a=n(a)),a=k+a}else{g&&(a=n(a)),a=k+a;var l=a.length;l<f&&(a=Array(f-l+1).join(c)+a)}j&&(a+="%");return a}};var k=/(?:([^{])?([<>=^]))?([+\- ])?(#)?(0)?([0-9]+)?(,)?(\.[0-9]+)?([a-zA-Z%])?/,l={g:function(a,b){return a.toPrecision(b)},e:function(a,b){return a.toExponential(b)},f:function(a,b){return a.toFixed(b)},r:function(a,b){var c=1+Math.floor(1e-15+Math.log(a)/Math.LN10);return d3.round(a,b-c).toFixed(Math.max(0,Math.min(20,b-c)))}},o=v(2),p=v(3),q={linear:function(){return u},poly:v,quad:function(){return o},cubic:function(){return p},sin:function(){return w},exp:function(){return x},circle:function(){return y},elastic:z,back:A,bounce:function(){return B}},r={"in":function(a){return a},out:s,"in-out":t,"out-in":function(a){return t(s(a))}};d3.ease=function(a){var b=a.indexOf("-"),c=b>=0?a.substring(0,b):a,d=b>=0?a.substring(b+1):"in";return r[d](q[c].apply(null,Array.prototype.slice.call(arguments,1)))},d3.event=null,d3.interpolate=function(a,b){var c=d3.interpolators.length,d;while(--c>=0&&!(d=d3.interpolators[c](a,b)));return d},d3.interpolateNumber=function(a,b){b-=a;return function(c){return a+b*c}},d3.interpolateRound=function(a,b){b-=a;return function(c){return Math.round(a+b*c)}},d3.interpolateString=function(a,b){var c,d,e,f=0,g=0,h=[],i=[],j,k;C.lastIndex=0;for(d=0;c=C.exec(b);++d)c.index&&h.push(b.substring(f,g=c.index)),i.push({i:h.length,x:c[0]}),h.push(null),f=C.lastIndex;f<b.length&&h.push(b.substring(f));for(d=0,j=i.length;(c=C.exec(a))&&d<j;++d){k=i[d];if(k.x==c[0]){if(k.i)if(h[k.i+1]==null){h[k.i-1]+=k.x,h.splice(k.i,1);for(e=d+1;e<j;++e)i[e].i--}else{h[k.i-1]+=k.x+h[k.i+1],h.splice(k.i,2);for(e=d+1;e<j;++e)i[e].i-=2}else if(h[k.i+1]==null)h[k.i]=k.x;else{h[k.i]=k.x+h[k.i+1],h.splice(k.i+1,1);for(e=d+1;e<j;++e)i[e].i--}i.splice(d,1),j--,d--}else k.x=d3.interpolateNumber(parseFloat(c[0]),parseFloat(k.x))}while(d<j)k=i.pop(),h[k.i+1]==null?h[k.i]=k.x:(h[k.i]=k.x+h[k.i+1],h.splice(k.i+1,1)),j--;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 R(c+f*a,d+g*a,e+h*a).toString()}},d3.interpolateArray=function(a,b){var c=[],d=[],e=a.length,f=b.length,g=Math.min(a.length,b.length),h;for(h=0;h<g;++h)c.push(d3.interpolate(a[h],b[h]));for(;h<e;++h)d[h]=a[h];for(;h<f;++h)d[h]=b[h];return function(a){for(h=0;h<g;++h)d[h]=c[h](a);return d}},d3.interpolateObject=function(a,b){var c={},d={},e;for(e in a)e in b?c[e]=E(e)(a[e],b[e]):d[e]=a[e];for(e in b)e in a||(d[e]=b[e]);return function(a){for(e in c)d[e]=c[e](a);return d}};var C=/[-+]?(?:\d+\.\d+|\d+\.|\.\d+|\d+)(?:[eE][-]?\d+)?/g,D={background:1,fill:1,stroke:1};d3.interpolators=[d3.interpolateObject,function(a,b){return b instanceof Array&&d3.interpolateArray(a,b)},function(a,b){return typeof b=="string"&&d3.interpolateString(String(a),b)},function(a,b){return(typeof b=="string"?b in N||/^(#|rgb\(|hsl\()/.test(b):b instanceof I||b instanceof Q)&&d3.interpolateRgb(String(a),b)},function(a,b){return typeof b=="number"&&d3.interpolateNumber(+a,b)}],d3.rgb=function(a,b,c){return arguments.length===1?K(""+a,H,R):H(~~a,~~b,~~c)},I.prototype.brighter=function(a){a=Math.pow(.7,arguments.length?a:1);var b=this.r,c=this.g,d=this.b,e=30;if(!b&&!c&&!d)return H(e,e,e);b&&b<e&&(b=e),c&&c<e&&(c=e),d&&d<e&&(d=e);return H(Math.min(255,Math.floor(b/a)),Math.min(255,Math.floor(c/a)),Math.min(255,Math.floor(d/a)))},I.prototype.darker=function(a){a=Math.pow(.7,arguments.length?a:1);return H(Math.max(0,Math.floor(a*this.r)),Math.max(0,Math.floor(a*this.g)),Math.max(0,Math.floor(a*this.b)))},I.prototype.hsl=function(){return L(this.r,this.g,this.b)},I.prototype.toString=function(){return"#"+J(this.r)+J(this.g)+J(this.b)};var N={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"};for(var O in N)N[O]=K(N[O],H,R);d3.hsl=function(a,b,c){return arguments.length===1?K(""+a,L,P):P(+a,+b,+c)},Q.prototype.brighter=function(a){a=Math.pow(.7,arguments.length?a:1);return P(this.h,this.s,this.l/a)},Q.prototype.darker=function(a){a=Math.pow(.7,arguments.length?a:1);return P(this.h,this.s,a*this.l)},Q.prototype.rgb=function(){return R(this.h,this.s,this.l)},Q.prototype.toString=function(){return"hsl("+this.h+","+this.s*100+"%,"+this.l*100+"%)"};var T=function(a,b){return b.querySelector(a)},U=function(a,b){return b.querySelectorAll(a)};typeof Sizzle=="function"&&(T=function(a,b){return Sizzle(a,b)[0]},U=function(a,b){return Sizzle.uniqueSort(Sizzle(a,b))});var V=[];d3.selection=function(){return ba},d3.selection.prototype=V,V.select=function(a){var b=[],c,d,e,f;typeof a!="function"&&(a=W(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 S(b)},V.selectAll=function(a){var b=[],c,d;typeof a!="function"&&(a=X(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 S(b)},V.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)},V.classed=function(a,b){function i(){(b.apply(this,arguments)?f:g).call(this)}function g(){if(b=this.classList)return b.remove(a);var b=this.className,d=b.baseVal!=null,e=d?b.baseVal:b;e=h(e.replace(c," ")),d?b.baseVal=e:this.className=e}function f(){if(b=this.classList)return b.add(a);var b=this.className,d=b.baseVal!=null,e=d?b.baseVal:b;c.lastIndex=0,c.test(e)||(e=h(e+" "+a),d?b.baseVal=e:this.className=e)}var c=new RegExp("(^|\\s+)"+d3.requote(a)+"(\\s+|$)","g");if(arguments.length<2){var d=this.node();if(e=d.classList)return e.contains(a);var e=d.className;c.lastIndex=0;return c.test(
<add>e.baseVal!=null?e.baseVal:e)}return this.each(typeof b=="function"?i:b?f:g)},V.style=function(a,b,c){function f(){var d=b.apply(this,arguments);d==null?this.style.removeProperty(a):this.style.setProperty(a,d,c)}function e(){this.style.setProperty(a,b,c)}function d(){this.style.removeProperty(a)}arguments.length<3&&(c="");return arguments.length<2?window.getComputedStyle(this.node(),null).getPropertyValue(a):this.each(b==null?d:typeof b=="function"?f:e)},V.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)},V.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})},V.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})},V.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)},V.insert=function(a,b){function d(){return this.insertBefore(document.createElementNS(a.space,a.local),T(b,this))}function c(){return this.insertBefore(document.createElement(a),T(b,this))}a=d3.ns.qualify(a);return this.select(a.local?d:c)},V.remove=function(){return this.each(function(){var a=this.parentNode;a&&a.removeChild(this)})},V.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]=Y(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]=Y(p),l[g]=n[g]=null);for(;g<i;++g)m[g]=Y(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=S(d);j.enter=function(){return Z(c)},j.exit=function(){return S(e)};return j};var $=[];$.append=V.append,$.insert=V.insert,$.empty=V.empty,$.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 S(b)},V.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 S(b)},V.map=function(a){return this.each(function(){this.__data__=a.apply(this,arguments)})},V.sort=function(a){a=_.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},V.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})},V.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},V.call=function(a){a.apply(this,(arguments[0]=this,arguments));return this},V.empty=function(){return!this.node()},V.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},V.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 bb(a,bf||++be)};var ba=S([[document]]);ba[0].parentNode=document.documentElement,d3.select=function(a){return typeof a=="string"?ba.select(a):S([[a]])},d3.selectAll=function(a){return typeof a=="string"?ba.selectAll(a):S([a])};var bd=[],be=0,bf=0,bg=d3.ease("cubic-in-out");bd.call=V.call,d3.transition=function(){return ba.transition()},d3.transition.prototype=bd,bd.select=function(a){var b=[],c,d,e;typeof a!="function"&&(a=W(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 bb(b,this.id).ease(this.ease())},bd.selectAll=function(a){var b=[],c,d;typeof a!="function"&&(a=X(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 bb(b,this.id).ease(this.ease())},bd.attr=function(a,b){return this.attrTween(a,bc(b))},bd.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)},bd.style=function(a,b,c){arguments.length<3&&(c="");return this.styleTween(a,bc(b),c)},bd.styleTween=function(a,b,c){arguments.length<3&&(c="");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)}})},bd.text=function(a){return this.tween("text",function(b,c){this.textContent=typeof a=="function"?a.call(this,b,c):a})},bd.remove=function(){return this.each("end",function(){var a;!this.__transition__&&(a=this.parentNode)&&a.removeChild(this)})},bd.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}))},bd.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}))},bd.transition=function(){return this.select(e)};var bi=null,bj,bk;d3.timer=function(a,b,c){var d=!1,e,f=bi;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||(bi={callback:a,then:c,delay:b,next:bi}),bj||(bk=clearTimeout(bk),bj=1,bn(bl))},d3.timer.flush=function(){var a,b=Date.now(),c=bi;while(c)a=b-c.then,c.delay||(c.flush=c.callback(a)),c=c.next;bm()};var bn=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(a){setTimeout(a,17)};d3.scale={},d3.scale.linear=function(){return bs([0,1],[0,1],d3.interpolate,!1)},d3.scale.log=function(){return bA(d3.scale.linear(),bB)},bB.pow=function(a){return Math.pow(10,a)},bC.pow=function(a){return-Math.pow(10,-a)},d3.scale.pow=function(){return bE(d3.scale.linear(),1)},d3.scale.sqrt=function(){return d3.scale.pow().exponent(.5)},d3.scale.ordinal=function(){return bG([],{t:"range",x:[]})},d3.scale.category10=function(){return d3.scale.ordinal().range(bH)},d3.scale.category20=function(){return d3.scale.ordinal().range(bI)},d3.scale.category20b=function(){return d3.scale.ordinal().range(bJ)},d3.scale.category20c=function(){return d3.scale.ordinal().range(bK)};var bH=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],bI=["#1f77b4","#aec7e8","#ff7f0e","#ffbb78","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5","#8c564b","#c49c94","#e377c2","#f7b6d2","#7f7f7f","#c7c7c7","#bcbd22","#dbdb8d","#17becf","#9edae5"],bJ=["#393b79","#5254a3","#6b6ecf","#9c9ede","#637939","#8ca252","#b5cf6b","#cedb9c","#8c6d31","#bd9e39","#e7ba52","#e7cb94","#843c39","#ad494a","#d6616b","#e7969c","#7b4173","#a55194","#ce6dbd","#de9ed6"],bK=["#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 bL([],[])},d3.scale.quantize=function(){return bM(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)+bN,h=d.apply(this,arguments)+bN,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>=bO?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=bP,b=bQ,c=bR,d=bS;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+bN;return[Math.cos(f)*e,Math.sin(f)*e]};return e};var bN=-Math.PI/2,bO=2*Math.PI-1e-6;d3.svg.line=function(){return bT(Object)};var bX={linear:bY,"step-before":bZ,"step-after":b$,basis:ce,"basis-open":cf,"basis-closed":cg,bundle:ch,cardinal:cb,"cardinal-open":b_,"cardinal-closed":ca,monotone:cq},cj=[0,2/3,1/3,0],ck=[0,1/3,2/3,0],cl=[0,1/6,2/3,1/6];d3.svg.line.radial=function(){var a=bT(cr);a.radius=a.x,delete a.x,a.angle=a.y,delete a.y;return a},d3.svg.area=function(){return cs(Object)},d3.svg.area.radial=function(){var a=cs(cr);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)+bN,k=e.call(a,h,g)+bN;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=cv,b=cw,c=cx,d=bR,e=bS;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=cv,b=cw,c=cA;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=cA,c=a.projection;a.projection=function(a){return arguments.length?c(cB(b=a)):b};return a},d3.svg.mouse=function(a){return cD(a,d3.event)};var cC=/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=cD(a,b);c.identifier=b.identifier;return c}):[]},d3.svg.symbol=function(){function c(c,d){return(cG[a.call(this,c,d)]||cG.circle)(b.call(this,c,d))}var a=cF,b=cE;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 cG={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*cI)),c=b*cI;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/cH),c=b*cH/2;return"M0,"+c+"L"+b+","+ -c+" "+ -b+","+ -c+"Z"},"triangle-up":function(a){var b=Math.sqrt(a/cH),c=b*cH/2;return"M0,"+ -c+"L"+b+","+c+" "+ -b+","+c+"Z"}};d3.svg.symbolTypes=d3.keys(cG);var cH=Math.sqrt(3),cI=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=cL(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=bp(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=cJ,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=cJ,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=cK,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=cK,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),cS("dragstart")}function c(){cM=a,cP=cT((cN=this).parentNode),cQ=0,cO=arguments}function b(){this.on("mousedown.drag",d).on("touchstart.drag",d),d3.select(window).on("mousemove.drag",cU).on("touchmove.drag",cU).on("mouseup.drag",cV,!0).on("touchend.drag",cV,!0).on("click.drag",cW,!0)}var a=d3.dispatch("drag","dragstart","dragend");b.on=function(c,d){a[c].add(d);return b};return b};var cM,cN,cO,cP,cQ,cR;d3.behavior.zoom=function(){function h(){d.apply(this,arguments);var b=dj(),c,e=Date.now();b.length===1&&e-da<300&&dp(1+Math.floor(a[2]),c=b[0],c_[c.identifier]),da=e}function g(){d.apply(this,arguments);var b=d3.svg.mouse(dd);dp(d3.event.shiftKey?Math.ceil(a[2]-1):Math.floor(a[2]+1),b,dh(b))}function f(){d.apply(this,arguments),c$||(c$=dh(d3.svg.mouse(dd))),dp(di()+a[2],d3.svg.mouse(dd),c$)}function e(){d.apply(this,arguments),cZ=dh(d3.svg.mouse(dd)),df=!1,d3.event.preventDefault(),window.focus()}function d(){db=a,dc=b.zoom.dispatch,dd=this,de=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",dl).on("mouseup.zoom",dm).on("touchmove.zoom",dk).on("touchend.zoom",dj).on("click.zoom",dn,!0)}var a=[0,0,0],b=d3.dispatch("zoom");c.on=function(a,d){b[a].add(d);return c};return c};var cY,cZ,c$,c_={},da=0,db,dc,dd,de,df,dg})()
<ide>\ No newline at end of file
<ide><path>src/core/core.js
<del>d3 = {version: "2.1.0"}; // semver
<add>d3 = {version: "2.1.1"}; // semver
<ide><path>src/core/transition.js
<ide> function d3_transition(groups, id) {
<ide>
<ide> ++lock.count;
<ide>
<del> delay <= elapsed ? start() : d3.timer(start, delay, then);
<add> delay <= elapsed ? start(elapsed) : d3.timer(start, delay, then);
<ide>
<ide> function start(elapsed) {
<ide> if (lock.active > id) return stop(); | 4 |
Ruby | Ruby | fix nil modification time | 14cba7f648f0ccd2235cbd815855abe6cb909c1a | <ide><path>Library/Homebrew/tab.rb
<ide> def version_scheme
<ide> end
<ide>
<ide> def source_modified_time
<del> Time.at(super)
<add> Time.at(super || 0)
<ide> end
<ide>
<ide> def to_json(options = nil) | 1 |
Java | Java | improve jndi detection logic | 2077388f383c9c57fcf9473b3def51dacea3cdf3 | <ide><path>spring-context/src/main/java/org/springframework/jndi/JndiLocatorDelegate.java
<ide> public static JndiLocatorDelegate createDefaultResourceRefLocator() {
<ide> */
<ide> public static boolean isDefaultJndiEnvironmentAvailable() {
<ide> try {
<del> new InitialContext();
<add> new InitialContext().getEnvironment();
<ide> return true;
<ide> }
<ide> catch (Throwable ex) {
<ide><path>spring-context/src/test/java/org/springframework/jndi/JndiLocatorDelegateTests.java
<add>/*
<add> * Copyright 2002-2014 the original author or authors.
<add> *
<add> * Licensed under the Apache License, Version 2.0 (the "License");
<add> * you may not use this file except in compliance with the License.
<add> * You may obtain a copy of the License at
<add> *
<add> * http://www.apache.org/licenses/LICENSE-2.0
<add> *
<add> * Unless required by applicable law or agreed to in writing, software
<add> * distributed under the License is distributed on an "AS IS" BASIS,
<add> * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
<add> * See the License for the specific language governing permissions and
<add> * limitations under the License.
<add> */
<add>
<add>package org.springframework.jndi;
<add>
<add>import org.junit.Test;
<add>
<add>import static org.hamcrest.Matchers.*;
<add>
<add>import static org.junit.Assert.*;
<add>
<add>/**
<add> * Tests for {@link JndiLocatorDelegate}.
<add> *
<add> * @author Phillip Webb
<add> */
<add>public class JndiLocatorDelegateTests {
<add>
<add> @Test
<add> public void isDefaultJndiEnvironmentAvailableFalse() {
<add> assertThat(JndiLocatorDelegate.isDefaultJndiEnvironmentAvailable(), equalTo(false));
<add> }
<add>
<add>} | 2 |
PHP | PHP | remove usage of deprecated ``type()`` method | d33aa5a7689595ff9d35d8a5dec37c2ec840d4aa | <ide><path>src/Database/Query.php
<ide> public function update($table)
<ide> public function set($key, $value = null, $types = [])
<ide> {
<ide> if (empty($this->_parts['set'])) {
<del> $this->_parts['set'] = $this->newExpr()->type(',');
<add> $this->_parts['set'] = $this->newExpr()->tieWith(',');
<ide> }
<ide>
<ide> if ($this->_parts['set']->isCallable($key)) {
<del> $exp = $this->newExpr()->type(',');
<add> $exp = $this->newExpr()->tieWith(',');
<ide> $this->_parts['set']->add($key($exp));
<ide> return $this;
<ide> }
<ide> protected function _conjugate($part, $append, $conjunction, $types)
<ide> $append = $append($this->newExpr(), $this);
<ide> }
<ide>
<del> if ($expression->type() === $conjunction) {
<add> if ($expression->tieWith() === $conjunction) {
<ide> $expression->add($append, $types);
<ide> } else {
<ide> $expression = $this->newExpr()
<del> ->type($conjunction)
<add> ->tieWith($conjunction)
<ide> ->add([$append, $expression], $types);
<ide> }
<ide>
<ide><path>src/ORM/Behavior/TreeBehavior.php
<ide> protected function _sync($shift, $dir, $conditions, $mark = false)
<ide> $exp = $query->newExpr();
<ide>
<ide> $movement = clone $exp;
<del> $movement ->add($field)->add("$shift")->type($dir);
<add> $movement ->add($field)->add("$shift")->tieWith($dir);
<ide>
<ide> $inverse = clone $exp;
<ide> $movement = $mark ?
<del> $inverse->add($movement)->type('*')->add('-1'):
<add> $inverse->add($movement)->tieWith('*')->add('-1'):
<ide> $movement;
<ide>
<ide> $where = clone $exp;
<del> $where->add($field)->add($conditions)->type('');
<add> $where->add($field)->add($conditions)->tieWith('');
<ide>
<ide> $query->update()
<ide> ->set($exp->eq($field, $movement)) | 2 |
Go | Go | add named context support | 87512bbc8490aca261133a7f3a3ea6518d703c34 | <ide><path>builder/dockerfile/dispatchers.go
<ide> func dispatchCopy(b *Builder, args []string, attributes map[string]bool, origina
<ide>
<ide> var contextID *int
<ide> if flFrom.IsUsed() {
<del> var err error
<del> context, err := strconv.Atoi(flFrom.Value)
<del> if err != nil {
<del> return errors.Wrap(err, "from expects an integer value corresponding to the context number")
<del> }
<del> if err := b.imageContexts.validate(context); err != nil {
<del> return err
<add> flFrom.Value = strings.ToLower(flFrom.Value)
<add> if context, ok := b.imageContexts.byName[flFrom.Value]; ok {
<add> contextID = &context
<add> } else {
<add> var err error
<add> context, err := strconv.Atoi(flFrom.Value)
<add> if err != nil {
<add> return errors.Wrap(err, "from expects an integer value corresponding to the context number")
<add> }
<add> if err := b.imageContexts.validate(context); err != nil {
<add> return err
<add> }
<add> contextID = &context
<ide> }
<del> contextID = &context
<ide> }
<ide>
<ide> return b.runContextCommand(args, false, false, "COPY", contextID)
<ide> func dispatchCopy(b *Builder, args []string, attributes map[string]bool, origina
<ide> // This sets the image the dockerfile will build on top of.
<ide> //
<ide> func from(b *Builder, args []string, attributes map[string]bool, original string) error {
<del> if len(args) != 1 {
<add> ctxName := ""
<add> if len(args) == 3 && strings.EqualFold(args[1], "as") {
<add> ctxName = strings.ToLower(args[2])
<add> if ok, _ := regexp.MatchString("^[a-z][a-z0-9-_\\.]*$", ctxName); !ok {
<add> return errors.Errorf("invalid name for build stage: %q, name can't start with a number or contain symbols", ctxName)
<add> }
<add> } else if len(args) != 1 {
<ide> return errExactlyOneArgument("FROM")
<ide> }
<ide>
<ide> func from(b *Builder, args []string, attributes map[string]bool, original string
<ide> var image builder.Image
<ide>
<ide> b.resetImageCache()
<del> b.imageContexts.new()
<add> if err := b.imageContexts.new(ctxName); err != nil {
<add> return err
<add> }
<ide>
<ide> // Windows cannot support a container with no base image.
<ide> if name == api.NoBaseImageSpecifier {
<ide><path>builder/dockerfile/imagecontext.go
<ide> import (
<ide> // imageContexts is a helper for stacking up built image rootfs and reusing
<ide> // them as contexts
<ide> type imageContexts struct {
<del> b *Builder
<del> list []*imageMount
<del> cache *pathCache
<add> b *Builder
<add> list []*imageMount
<add> byName map[string]int
<add> cache *pathCache
<ide> }
<ide>
<ide> type imageMount struct {
<ide> type imageMount struct {
<ide> release func() error
<ide> }
<ide>
<del>func (ic *imageContexts) new() {
<add>func (ic *imageContexts) new(name string) error {
<add> if len(name) > 0 {
<add> if ic.byName == nil {
<add> ic.byName = make(map[string]int)
<add> }
<add> if _, ok := ic.byName[name]; ok {
<add> return errors.Errorf("duplicate name %s", name)
<add> }
<add> ic.byName[name] = len(ic.list)
<add> }
<ide> ic.list = append(ic.list, &imageMount{})
<add> return nil
<ide> }
<ide>
<ide> func (ic *imageContexts) update(imageID string) {
<ide><path>builder/dockerfile/parser/parser.go
<ide> func init() {
<ide> command.Entrypoint: parseMaybeJSON,
<ide> command.Env: parseEnv,
<ide> command.Expose: parseStringsWhitespaceDelimited,
<del> command.From: parseString,
<add> command.From: parseStringsWhitespaceDelimited,
<ide> command.Healthcheck: parseHealthConfig,
<ide> command.Label: parseLabel,
<ide> command.Maintainer: parseString,
<ide><path>integration-cli/docker_cli_build_test.go
<ide> func (s *DockerSuite) TestBuildContChar(c *check.C) {
<ide>
<ide> func (s *DockerSuite) TestBuildCopyFromPreviousRootFS(c *check.C) {
<ide> dockerfile := `
<del> FROM busybox
<add> FROM busybox AS first
<ide> COPY foo bar
<ide> FROM busybox
<ide> %s
<ide> func (s *DockerSuite) TestBuildCopyFromPreviousRootFS(c *check.C) {
<ide> COPY bar /
<ide> COPY --from=1 baz sub/
<ide> COPY --from=0 bar baz
<del> COPY --from=0 bar bay`
<add> COPY --from=first bar bay`
<add>
<ide> ctx := fakeContext(c, fmt.Sprintf(dockerfile, ""), map[string]string{
<ide> "Dockerfile": dockerfile,
<ide> "foo": "abc",
<ide> func (s *DockerSuite) TestBuildCopyFromPreviousRootFSErrors(c *check.C) {
<ide> ExitCode: 1,
<ide> Err: "invalid from flag value 0 refers current build block",
<ide> })
<add>
<add> dockerfile = `
<add> FROM busybox AS foo
<add> COPY --from=bar foo bar`
<add>
<add> ctx = fakeContext(c, dockerfile, map[string]string{
<add> "Dockerfile": dockerfile,
<add> "foo": "abc",
<add> })
<add> defer ctx.Close()
<add>
<add> buildImage("build1", withExternalBuildContext(ctx)).Assert(c, icmd.Expected{
<add> ExitCode: 1,
<add> Err: "invalid context value bar",
<add> })
<add>
<add> dockerfile = `
<add> FROM busybox AS 1
<add> COPY --from=1 foo bar`
<add>
<add> ctx = fakeContext(c, dockerfile, map[string]string{
<add> "Dockerfile": dockerfile,
<add> "foo": "abc",
<add> })
<add> defer ctx.Close()
<add>
<add> buildImage("build1", withExternalBuildContext(ctx)).Assert(c, icmd.Expected{
<add> ExitCode: 1,
<add> Err: "invalid name for build stage",
<add> })
<ide> }
<ide>
<ide> func (s *DockerSuite) TestBuildCopyFromPreviousFrom(c *check.C) {
<ide> func (s *DockerSuite) TestBuildCopyFromPreviousFrom(c *check.C) {
<ide> result.Assert(c, icmd.Success)
<ide>
<ide> dockerfile = `
<del> FROM build1:latest
<add> FROM build1:latest AS foo
<ide> FROM busybox
<del> COPY --from=0 bar /
<add> COPY --from=foo bar /
<ide> COPY foo /`
<ide> ctx = fakeContext(c, dockerfile, map[string]string{
<ide> "Dockerfile": dockerfile, | 4 |
Javascript | Javascript | add support for string/boolean/number object types | 7b51243be597900b1f765495dadfea5fccd2228e | <ide><path>src/Angular.js
<ide> function copy(source, destination) {
<ide> }
<ide>
<ide> var needsRecurse = false;
<del> var destination;
<add> var destination = copyType(source);
<ide>
<del> if (isArray(source)) {
<del> destination = [];
<del> needsRecurse = true;
<del> } else if (isTypedArray(source)) {
<del> destination = new source.constructor(source);
<del> } else if (isDate(source)) {
<del> destination = new Date(source.getTime());
<del> } else if (isRegExp(source)) {
<del> destination = new RegExp(source.source, source.toString().match(/[^\/]*$/)[0]);
<del> destination.lastIndex = source.lastIndex;
<del> } else if (isFunction(source.cloneNode)) {
<del> destination = source.cloneNode(true);
<del> } else {
<del> destination = Object.create(getPrototypeOf(source));
<add> if (destination === undefined) {
<add> destination = isArray(source) ? [] : Object.create(getPrototypeOf(source));
<ide> needsRecurse = true;
<ide> }
<ide>
<ide> function copy(source, destination) {
<ide> ? copyRecurse(source, destination)
<ide> : destination;
<ide> }
<add>
<add> function copyType(source) {
<add> switch (toString.call(source)) {
<add> case '[object Int8Array]':
<add> case '[object Int16Array]':
<add> case '[object Int32Array]':
<add> case '[object Float32Array]':
<add> case '[object Float64Array]':
<add> case '[object Uint8Array]':
<add> case '[object Uint8ClampedArray]':
<add> case '[object Uint16Array]':
<add> case '[object Uint32Array]':
<add> return new source.constructor(source);
<add>
<add> case '[object Boolean]':
<add> case '[object Number]':
<add> case '[object String]':
<add> case '[object Date]':
<add> return new source.constructor(source.valueOf());
<add>
<add> case '[object RegExp]':
<add> var re = new RegExp(source.source, source.toString().match(/[^\/]*$/)[0]);
<add> re.lastIndex = source.lastIndex;
<add> return re;
<add> }
<add>
<add> if (isFunction(source.cloneNode)) {
<add> return source.cloneNode(true);
<add> }
<add> }
<ide> }
<ide>
<ide> /**
<ide><path>test/AngularSpec.js
<ide> describe('angular', function() {
<ide> expect(dest.c).toBe(3);
<ide> expect(Object.keys(dest)).toEqual(['a', 'b', 'c']);
<ide> });
<add>
<add> it('should copy String() objects', function() {
<add> /*jshint -W053 */
<add> var obj = new String('foo');
<add> /*jshint +W053 */
<add> var dest = copy(obj);
<add> expect(dest).not.toBe(obj);
<add> expect(isObject(dest)).toBe(true);
<add> expect(dest.valueOf()).toBe(obj.valueOf());
<add> });
<add>
<add> it('should copy Boolean() objects', function() {
<add> /*jshint -W053 */
<add> var obj = new Boolean(true);
<add> /*jshint +W053 */
<add> var dest = copy(obj);
<add> expect(dest).not.toBe(obj);
<add> expect(isObject(dest)).toBe(true);
<add> expect(dest.valueOf()).toBe(obj.valueOf());
<add> });
<add>
<add> it('should copy Number() objects', function() {
<add> /*jshint -W053 */
<add> var obj = new Number(42);
<add> /*jshint +W053 */
<add> var dest = copy(obj);
<add> expect(dest).not.toBe(obj);
<add> expect(isObject(dest)).toBe(true);
<add> expect(dest.valueOf()).toBe(obj.valueOf());
<add> });
<add>
<add> it('should copy falsy String/Boolean/Number objects', function() {
<add> /*jshint -W053 */
<add> expect(copy(new String('')).valueOf()).toBe('');
<add> expect(copy(new Boolean(false)).valueOf()).toBe(false);
<add> expect(copy(new Number(0)).valueOf()).toBe(0);
<add> expect(copy(new Number(NaN)).valueOf()).toBeNaN();
<add> /*jshint +W053 */
<add> });
<ide> });
<ide>
<ide> describe("extend", function() { | 2 |
Ruby | Ruby | handle unavailable missing formulae | e63d490874dd57d363643e49d6a7ce8fe17818d2 | <ide><path>Library/Homebrew/formula.rb
<ide> def missing_dependencies(hide: nil)
<ide> runtime_formula_dependencies.select do |f|
<ide> hide.include?(f.name) || f.installed_prefixes.empty?
<ide> end
<add> # If we're still getting unavailable formulae at this stage the best we can
<add> # do is just return no results.
<add> rescue FormulaUnavailableError
<add> []
<ide> end
<ide>
<ide> # @private | 1 |
Go | Go | introduce discoverapi.discover interface | 247e8034b81c6631db8017263f3e6fa7041914e8 | <ide><path>libnetwork/controller.go
<ide> import (
<ide> "github.com/docker/docker/pkg/stringid"
<ide> "github.com/docker/libnetwork/config"
<ide> "github.com/docker/libnetwork/datastore"
<add> "github.com/docker/libnetwork/discoverapi"
<ide> "github.com/docker/libnetwork/driverapi"
<ide> "github.com/docker/libnetwork/hostdiscovery"
<ide> "github.com/docker/libnetwork/ipamapi"
<ide> func (c *controller) pushNodeDiscovery(d *driverData, nodes []net.IP, add bool)
<ide> return
<ide> }
<ide> for _, node := range nodes {
<del> nodeData := driverapi.NodeDiscoveryData{Address: node.String(), Self: node.Equal(self)}
<add> nodeData := discoverapi.NodeDiscoveryData{Address: node.String(), Self: node.Equal(self)}
<ide> var err error
<ide> if add {
<del> err = d.driver.DiscoverNew(driverapi.NodeDiscovery, nodeData)
<add> err = d.driver.DiscoverNew(discoverapi.NodeDiscovery, nodeData)
<ide> } else {
<del> err = d.driver.DiscoverDelete(driverapi.NodeDiscovery, nodeData)
<add> err = d.driver.DiscoverDelete(discoverapi.NodeDiscovery, nodeData)
<ide> }
<ide> if err != nil {
<ide> log.Debugf("discovery notification error : %v", err)
<ide><path>libnetwork/discoverapi/discoverapi.go
<add>package discoverapi
<add>
<add>// Discover is an interface to be implemented by the componenet interested in receiving discover events
<add>// like new node joining the cluster or datastore updates
<add>type Discover interface {
<add> // DiscoverNew is a notification for a new discovery event, Example:a new node joining a cluster
<add> DiscoverNew(dType DiscoveryType, data interface{}) error
<add>
<add> // DiscoverDelete is a notification for a discovery delete event, Example:a node leaving a cluster
<add> DiscoverDelete(dType DiscoveryType, data interface{}) error
<add>}
<add>
<add>// DiscoveryType represents the type of discovery element the DiscoverNew function is invoked on
<add>type DiscoveryType int
<add>
<add>const (
<add> // NodeDiscovery represents Node join/leave events provided by discovery
<add> NodeDiscovery = iota + 1
<add> // DatastoreUpdate represents a add/remove datastore event
<add> DatastoreUpdate
<add>)
<add>
<add>// NodeDiscoveryData represents the structure backing the node discovery data json string
<add>type NodeDiscoveryData struct {
<add> Address string
<add> Self bool
<add>}
<add>
<add>// DatastoreUpdateData is the data for the datastore update event message
<add>type DatastoreUpdateData struct {
<add> Provider string
<add> Address string
<add> Config interface{}
<add>}
<ide><path>libnetwork/driverapi/driverapi.go
<ide> package driverapi
<ide>
<del>import "net"
<add>import (
<add> "net"
<add>
<add> "github.com/docker/libnetwork/discoverapi"
<add>)
<ide>
<ide> // NetworkPluginEndpointType represents the Endpoint Type used by Plugin system
<ide> const NetworkPluginEndpointType = "NetworkDriver"
<ide>
<ide> // Driver is an interface that every plugin driver needs to implement.
<ide> type Driver interface {
<add> discoverapi.Discover
<add>
<ide> // CreateNetwork invokes the driver method to create a network passing
<ide> // the network id and network specific config. The config mechanism will
<ide> // eventually be replaced with labels which are yet to be introduced.
<ide> type Driver interface {
<ide> // Leave method is invoked when a Sandbox detaches from an endpoint.
<ide> Leave(nid, eid string) error
<ide>
<del> // DiscoverNew is a notification for a new discovery event, Example:a new node joining a cluster
<del> DiscoverNew(dType DiscoveryType, data interface{}) error
<del>
<del> // DiscoverDelete is a notification for a discovery delete event, Example:a node leaving a cluster
<del> DiscoverDelete(dType DiscoveryType, data interface{}) error
<del>
<ide> // Type returns the the type of this driver, the network type this driver manages
<ide> Type() string
<ide> }
<ide> type Capability struct {
<ide> DataScope string
<ide> }
<ide>
<del>// DiscoveryType represents the type of discovery element the DiscoverNew function is invoked on
<del>type DiscoveryType int
<del>
<del>const (
<del> // NodeDiscovery represents Node join/leave events provided by discovery
<del> NodeDiscovery = iota + 1
<del>)
<del>
<del>// NodeDiscoveryData represents the structure backing the node discovery data json string
<del>type NodeDiscoveryData struct {
<del> Address string
<del> Self bool
<del>}
<del>
<ide> // IPAMData represents the per-network ip related
<ide> // operational information libnetwork will send
<ide> // to the network driver during CreateNetwork()
<ide><path>libnetwork/drivers/bridge/bridge.go
<ide> import (
<ide>
<ide> "github.com/Sirupsen/logrus"
<ide> "github.com/docker/libnetwork/datastore"
<add> "github.com/docker/libnetwork/discoverapi"
<ide> "github.com/docker/libnetwork/driverapi"
<ide> "github.com/docker/libnetwork/iptables"
<ide> "github.com/docker/libnetwork/netlabel"
<ide> func (d *driver) Type() string {
<ide> }
<ide>
<ide> // DiscoverNew is a notification for a new discovery event, such as a new node joining a cluster
<del>func (d *driver) DiscoverNew(dType driverapi.DiscoveryType, data interface{}) error {
<add>func (d *driver) DiscoverNew(dType discoverapi.DiscoveryType, data interface{}) error {
<ide> return nil
<ide> }
<ide>
<ide> // DiscoverDelete is a notification for a discovery delete event, such as a node leaving a cluster
<del>func (d *driver) DiscoverDelete(dType driverapi.DiscoveryType, data interface{}) error {
<add>func (d *driver) DiscoverDelete(dType discoverapi.DiscoveryType, data interface{}) error {
<ide> return nil
<ide> }
<ide>
<ide><path>libnetwork/drivers/host/host.go
<ide> import (
<ide> "sync"
<ide>
<ide> "github.com/docker/libnetwork/datastore"
<add> "github.com/docker/libnetwork/discoverapi"
<ide> "github.com/docker/libnetwork/driverapi"
<ide> "github.com/docker/libnetwork/types"
<ide> )
<ide> func (d *driver) Type() string {
<ide> }
<ide>
<ide> // DiscoverNew is a notification for a new discovery event, such as a new node joining a cluster
<del>func (d *driver) DiscoverNew(dType driverapi.DiscoveryType, data interface{}) error {
<add>func (d *driver) DiscoverNew(dType discoverapi.DiscoveryType, data interface{}) error {
<ide> return nil
<ide> }
<ide>
<ide> // DiscoverDelete is a notification for a discovery delete event, such as a node leaving a cluster
<del>func (d *driver) DiscoverDelete(dType driverapi.DiscoveryType, data interface{}) error {
<add>func (d *driver) DiscoverDelete(dType discoverapi.DiscoveryType, data interface{}) error {
<ide> return nil
<ide> }
<ide><path>libnetwork/drivers/null/null.go
<ide> import (
<ide> "sync"
<ide>
<ide> "github.com/docker/libnetwork/datastore"
<add> "github.com/docker/libnetwork/discoverapi"
<ide> "github.com/docker/libnetwork/driverapi"
<ide> "github.com/docker/libnetwork/types"
<ide> )
<ide> func (d *driver) Type() string {
<ide> }
<ide>
<ide> // DiscoverNew is a notification for a new discovery event, such as a new node joining a cluster
<del>func (d *driver) DiscoverNew(dType driverapi.DiscoveryType, data interface{}) error {
<add>func (d *driver) DiscoverNew(dType discoverapi.DiscoveryType, data interface{}) error {
<ide> return nil
<ide> }
<ide>
<ide> // DiscoverDelete is a notification for a discovery delete event, such as a node leaving a cluster
<del>func (d *driver) DiscoverDelete(dType driverapi.DiscoveryType, data interface{}) error {
<add>func (d *driver) DiscoverDelete(dType discoverapi.DiscoveryType, data interface{}) error {
<ide> return nil
<ide> }
<ide><path>libnetwork/drivers/overlay/overlay.go
<ide> import (
<ide> "github.com/Sirupsen/logrus"
<ide> "github.com/docker/libkv/store"
<ide> "github.com/docker/libnetwork/datastore"
<add> "github.com/docker/libnetwork/discoverapi"
<ide> "github.com/docker/libnetwork/driverapi"
<ide> "github.com/docker/libnetwork/idm"
<ide> "github.com/docker/libnetwork/netlabel"
<ide> func (d *driver) pushLocalEndpointEvent(action, nid, eid string) {
<ide> }
<ide>
<ide> // DiscoverNew is a notification for a new discovery event, such as a new node joining a cluster
<del>func (d *driver) DiscoverNew(dType driverapi.DiscoveryType, data interface{}) error {
<del> if dType == driverapi.NodeDiscovery {
<del> nodeData, ok := data.(driverapi.NodeDiscoveryData)
<add>func (d *driver) DiscoverNew(dType discoverapi.DiscoveryType, data interface{}) error {
<add> if dType == discoverapi.NodeDiscovery {
<add> nodeData, ok := data.(discoverapi.NodeDiscoveryData)
<ide> if !ok || nodeData.Address == "" {
<ide> return fmt.Errorf("invalid discovery data")
<ide> }
<ide> func (d *driver) DiscoverNew(dType driverapi.DiscoveryType, data interface{}) er
<ide> }
<ide>
<ide> // DiscoverDelete is a notification for a discovery delete event, such as a node leaving a cluster
<del>func (d *driver) DiscoverDelete(dType driverapi.DiscoveryType, data interface{}) error {
<add>func (d *driver) DiscoverDelete(dType discoverapi.DiscoveryType, data interface{}) error {
<ide> return nil
<ide> }
<ide><path>libnetwork/drivers/overlay/overlay_test.go
<ide> import (
<ide> "testing"
<ide> "time"
<ide>
<add> "github.com/docker/libnetwork/discoverapi"
<ide> "github.com/docker/libnetwork/driverapi"
<ide> _ "github.com/docker/libnetwork/testutils"
<ide> )
<ide> func setupDriver(t *testing.T) *driverTester {
<ide> if err != nil || len(addrs) == 0 {
<ide> t.Fatal(err)
<ide> }
<del> data := driverapi.NodeDiscoveryData{
<add> data := discoverapi.NodeDiscoveryData{
<ide> Address: addrs[0].String(),
<ide> Self: true,
<ide> }
<del> dt.d.DiscoverNew(driverapi.NodeDiscovery, data)
<add> dt.d.DiscoverNew(discoverapi.NodeDiscovery, data)
<ide> return dt
<ide> }
<ide>
<ide><path>libnetwork/drivers/remote/api/api.go
<ide> package api
<ide> import (
<ide> "net"
<ide>
<add> "github.com/docker/libnetwork/discoverapi"
<ide> "github.com/docker/libnetwork/driverapi"
<ide> )
<ide>
<ide> type LeaveResponse struct {
<ide>
<ide> // DiscoveryNotification represents a discovery notification
<ide> type DiscoveryNotification struct {
<del> DiscoveryType driverapi.DiscoveryType
<add> DiscoveryType discoverapi.DiscoveryType
<ide> DiscoveryData interface{}
<ide> }
<ide>
<ide><path>libnetwork/drivers/remote/driver.go
<ide> import (
<ide> log "github.com/Sirupsen/logrus"
<ide> "github.com/docker/docker/pkg/plugins"
<ide> "github.com/docker/libnetwork/datastore"
<add> "github.com/docker/libnetwork/discoverapi"
<ide> "github.com/docker/libnetwork/driverapi"
<ide> "github.com/docker/libnetwork/drivers/remote/api"
<ide> "github.com/docker/libnetwork/types"
<ide> func (d *driver) Type() string {
<ide> }
<ide>
<ide> // DiscoverNew is a notification for a new discovery event, such as a new node joining a cluster
<del>func (d *driver) DiscoverNew(dType driverapi.DiscoveryType, data interface{}) error {
<del> if dType != driverapi.NodeDiscovery {
<add>func (d *driver) DiscoverNew(dType discoverapi.DiscoveryType, data interface{}) error {
<add> if dType != discoverapi.NodeDiscovery {
<ide> return fmt.Errorf("Unknown discovery type : %v", dType)
<ide> }
<ide> notif := &api.DiscoveryNotification{
<ide> func (d *driver) DiscoverNew(dType driverapi.DiscoveryType, data interface{}) er
<ide> }
<ide>
<ide> // DiscoverDelete is a notification for a discovery delete event, such as a node leaving a cluster
<del>func (d *driver) DiscoverDelete(dType driverapi.DiscoveryType, data interface{}) error {
<del> if dType != driverapi.NodeDiscovery {
<add>func (d *driver) DiscoverDelete(dType discoverapi.DiscoveryType, data interface{}) error {
<add> if dType != discoverapi.NodeDiscovery {
<ide> return fmt.Errorf("Unknown discovery type : %v", dType)
<ide> }
<ide> notif := &api.DiscoveryNotification{
<ide><path>libnetwork/drivers/remote/driver_test.go
<ide> import (
<ide>
<ide> "github.com/docker/docker/pkg/plugins"
<ide> "github.com/docker/libnetwork/datastore"
<add> "github.com/docker/libnetwork/discoverapi"
<ide> "github.com/docker/libnetwork/driverapi"
<ide> _ "github.com/docker/libnetwork/testutils"
<ide> "github.com/docker/libnetwork/types"
<ide> func TestRemoteDriver(t *testing.T) {
<ide> t.Fatal(err)
<ide> }
<ide>
<del> data := driverapi.NodeDiscoveryData{
<add> data := discoverapi.NodeDiscoveryData{
<ide> Address: "192.168.1.1",
<ide> }
<del> if err = d.DiscoverNew(driverapi.NodeDiscovery, data); err != nil {
<add> if err = d.DiscoverNew(discoverapi.NodeDiscovery, data); err != nil {
<ide> t.Fatal(err)
<ide> }
<del> if err = d.DiscoverDelete(driverapi.NodeDiscovery, data); err != nil {
<add> if err = d.DiscoverDelete(discoverapi.NodeDiscovery, data); err != nil {
<ide> t.Fatal(err)
<ide> }
<ide> }
<ide><path>libnetwork/drivers/windows/windows.go
<ide> package windows
<ide>
<ide> import (
<ide> "github.com/docker/libnetwork/datastore"
<add> "github.com/docker/libnetwork/discoverapi"
<ide> "github.com/docker/libnetwork/driverapi"
<ide> )
<ide>
<ide> func (d *driver) Type() string {
<ide> }
<ide>
<ide> // DiscoverNew is a notification for a new discovery event, such as a new node joining a cluster
<del>func (d *driver) DiscoverNew(dType driverapi.DiscoveryType, data interface{}) error {
<add>func (d *driver) DiscoverNew(dType discoverapi.DiscoveryType, data interface{}) error {
<ide> return nil
<ide> }
<ide>
<ide> // DiscoverDelete is a notification for a discovery delete event, such as a node leaving a cluster
<del>func (d *driver) DiscoverDelete(dType driverapi.DiscoveryType, data interface{}) error {
<add>func (d *driver) DiscoverDelete(dType discoverapi.DiscoveryType, data interface{}) error {
<ide> return nil
<ide> }
<ide><path>libnetwork/libnetwork_internal_test.go
<ide> import (
<ide> "testing"
<ide>
<ide> "github.com/docker/libnetwork/datastore"
<add> "github.com/docker/libnetwork/discoverapi"
<ide> "github.com/docker/libnetwork/driverapi"
<ide> "github.com/docker/libnetwork/ipamapi"
<ide> "github.com/docker/libnetwork/netlabel"
<ide> func (b *badDriver) Join(nid, eid string, sboxKey string, jinfo driverapi.JoinIn
<ide> func (b *badDriver) Leave(nid, eid string) error {
<ide> return nil
<ide> }
<del>func (b *badDriver) DiscoverNew(dType driverapi.DiscoveryType, data interface{}) error {
<add>func (b *badDriver) DiscoverNew(dType discoverapi.DiscoveryType, data interface{}) error {
<ide> return nil
<ide> }
<del>func (b *badDriver) DiscoverDelete(dType driverapi.DiscoveryType, data interface{}) error {
<add>func (b *badDriver) DiscoverDelete(dType discoverapi.DiscoveryType, data interface{}) error {
<ide> return nil
<ide> }
<ide> func (b *badDriver) Type() string { | 13 |
Python | Python | fix lint errors | 122bb0129fde57cf310af1a698f10e9d3ce1a078 | <ide><path>official/utils/misc/distribution_utils.py
<ide> import tensorflow as tf
<ide>
<ide>
<del>def get_distribution_strategy(
<del> num_gpus, all_reduce_alg=None, turn_off_distribution_strategy=False):
<add>def get_distribution_strategy(num_gpus,
<add> all_reduce_alg=None,
<add> turn_off_distribution_strategy=False):
<ide> """Return a DistributionStrategy for running the model.
<ide>
<ide> Args:
<ide> def get_distribution_strategy(
<ide> larger than 1
<ide> """
<ide> if num_gpus == 0:
<del> if turn_off_distribution_strategy:
<del> return None
<del> else:
<del> return tf.contrib.distribute.OneDeviceStrategy("device:CPU:0")
<add> if turn_off_distribution_strategy:
<add> return None
<add> else:
<add> return tf.contrib.distribute.OneDeviceStrategy("device:CPU:0")
<ide> elif num_gpus == 1:
<ide> if turn_off_distribution_strategy:
<ide> return None
<ide> else:
<ide> return tf.contrib.distribute.OneDeviceStrategy("device:GPU:0")
<ide> elif turn_off_distribution_strategy:
<del> raise ValueError("When %d GPUs are specified, turn_off_distribution_strategy"
<del> " flag cannot be set to True.".format(num_gpus))
<del> else: # num_gpus > 1 and not turn_off_distribution_strategy
<add> raise ValueError("When {} GPUs are specified, "
<add> "turn_off_distribution_strategy flag cannot be set to"
<add> "True.".format(num_gpus))
<add> else: # num_gpus > 1 and not turn_off_distribution_strategy
<ide> if all_reduce_alg:
<ide> return tf.contrib.distribute.MirroredStrategy(
<ide> num_gpus=num_gpus, | 1 |
Ruby | Ruby | define the configuration at active support | 53e877f7d9291b2bf0b8c425f9e32ef35829f35b | <ide><path>activesupport/lib/active_support.rb
<ide> def self.eager_load!
<ide>
<ide> NumberHelper.eager_load!
<ide> end
<add>
<add> @@test_order = nil
<add>
<add> def self.test_order=(new_order)
<add> @@test_order = new_order
<add> end
<add>
<add> def self.test_order
<add> @@test_order
<add> end
<ide> end
<ide>
<ide> autoload :I18n, "active_support/i18n"
<ide><path>activesupport/lib/active_support/test_case.rb
<ide> require 'active_support/deprecation'
<ide>
<ide> module ActiveSupport
<del> class << self
<del> delegate :test_order, :test_order=, to: :'ActiveSupport::TestCase'
<del> end
<del>
<ide> class TestCase < ::Minitest::Test
<ide> Assertion = Minitest::Assertion
<ide>
<del> @@test_order = nil
<del>
<ide> class << self
<ide> def test_order=(new_order)
<del> @@test_order = new_order
<add> ActiveSupport.test_order = new_order
<ide> end
<ide>
<ide> def test_order
<del> if @@test_order.nil?
<add> test_order = ActiveSupport.test_order
<add>
<add> if test_order.nil?
<ide> ActiveSupport::Deprecation.warn "You did not specify a value for the " \
<ide> "configuration option 'active_support.test_order'. In Rails 5.0, " \
<ide> "the default value of this option will change from `:sorted` to " \
<ide> def test_order
<ide> "Alternatively, you can opt into the future behavior by setting this " \
<ide> "option to `:random`."
<ide>
<del> @@test_order = :sorted
<add> test_order = :sorted
<add> self.test_order = test_order
<ide> end
<ide>
<del> @@test_order
<add> test_order
<ide> end
<ide>
<ide> alias :my_tests_are_order_dependent! :i_suck_and_my_tests_are_order_dependent!
<ide><path>railties/test/configuration/middleware_stack_proxy_test.rb
<add>require 'active_support'
<ide> require 'active_support/testing/autorun'
<ide> require 'rails/configuration'
<ide> require 'active_support/test_case'
<ide><path>railties/test/isolation/abstract_unit.rb
<ide> require 'fileutils'
<ide>
<ide> require 'bundler/setup' unless defined?(Bundler)
<add>require 'active_support'
<ide> require 'active_support/testing/autorun'
<ide> require 'active_support/test_case'
<ide> | 4 |
Go | Go | fix race in attachable network attachment | c379d2681ffe8495a888fb1d0f14973fbdbdc969 | <ide><path>daemon/container_operations.go
<ide> func (daemon *Daemon) updateNetwork(container *container.Container) error {
<ide> }
<ide>
<ide> func (daemon *Daemon) findAndAttachNetwork(container *container.Container, idOrName string, epConfig *networktypes.EndpointSettings) (libnetwork.Network, *networktypes.NetworkingConfig, error) {
<del> n, err := daemon.FindNetwork(getNetworkID(idOrName, epConfig))
<add> id := getNetworkID(idOrName, epConfig)
<add>
<add> n, err := daemon.FindNetwork(id)
<ide> if err != nil {
<ide> // We should always be able to find the network for a
<ide> // managed container.
<ide> func (daemon *Daemon) findAndAttachNetwork(container *container.Container, idOrN
<ide> retryCount int
<ide> )
<ide>
<add> if n == nil && daemon.attachableNetworkLock != nil {
<add> daemon.attachableNetworkLock.Lock(id)
<add> defer daemon.attachableNetworkLock.Unlock(id)
<add> }
<add>
<ide> for {
<ide> // In all other cases, attempt to attach to the network to
<ide> // trigger attachment in the swarm cluster manager.
<ide> if daemon.clusterProvider != nil {
<ide> var err error
<del> config, err = daemon.clusterProvider.AttachNetwork(getNetworkID(idOrName, epConfig), container.ID, addresses)
<add> config, err = daemon.clusterProvider.AttachNetwork(id, container.ID, addresses)
<ide> if err != nil {
<ide> return nil, nil, err
<ide> }
<ide> }
<ide>
<del> n, err = daemon.FindNetwork(getNetworkID(idOrName, epConfig))
<add> n, err = daemon.FindNetwork(id)
<ide> if err != nil {
<ide> if daemon.clusterProvider != nil {
<del> if err := daemon.clusterProvider.DetachNetwork(getNetworkID(idOrName, epConfig), container.ID); err != nil {
<add> if err := daemon.clusterProvider.DetachNetwork(id, container.ID); err != nil {
<ide> logrus.Warnf("Could not rollback attachment for container %s to network %s: %v", container.ID, idOrName, err)
<ide> }
<ide> }
<ide><path>daemon/daemon.go
<ide> import (
<ide> "github.com/docker/docker/migrate/v1"
<ide> "github.com/docker/docker/pkg/containerfs"
<ide> "github.com/docker/docker/pkg/idtools"
<add> "github.com/docker/docker/pkg/locker"
<ide> "github.com/docker/docker/pkg/plugingetter"
<ide> "github.com/docker/docker/pkg/sysinfo"
<ide> "github.com/docker/docker/pkg/system"
<ide> type Daemon struct {
<ide> hosts map[string]bool // hosts stores the addresses the daemon is listening on
<ide> startupDone chan struct{}
<ide>
<del> attachmentStore network.AttachmentStore
<add> attachmentStore network.AttachmentStore
<add> attachableNetworkLock *locker.Locker
<ide> }
<ide>
<ide> // StoreHosts stores the addresses the daemon is listening on
<ide> func (daemon *Daemon) DaemonLeavesCluster() {
<ide> func (daemon *Daemon) setClusterProvider(clusterProvider cluster.Provider) {
<ide> daemon.clusterProvider = clusterProvider
<ide> daemon.netController.SetClusterProvider(clusterProvider)
<add> daemon.attachableNetworkLock = locker.New()
<ide> }
<ide>
<ide> // IsSwarmCompatible verifies if the current daemon | 2 |
Java | Java | check all handlermapping beans for named mappings | e6fef9555da4f887eb1cfa37428c97e6d2d430d2 | <ide><path>spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/MvcUriComponentsBuilder.java
<ide> public static MethodArgumentBuilder fromMappingName(String mappingName) {
<ide> */
<ide> public static MethodArgumentBuilder fromMappingName(@Nullable UriComponentsBuilder builder, String name) {
<ide> WebApplicationContext wac = getWebApplicationContext();
<del> Assert.notNull(wac, "Cannot lookup handler method mappings without WebApplicationContext");
<del> RequestMappingInfoHandlerMapping mapping = wac.getBean(RequestMappingInfoHandlerMapping.class);
<del> List<HandlerMethod> handlerMethods = mapping.getHandlerMethodsForMappingName(name);
<add> Assert.notNull(wac, "No WebApplicationContext. ");
<add> Map<String, RequestMappingInfoHandlerMapping> map = wac.getBeansOfType(RequestMappingInfoHandlerMapping.class);
<add> List<HandlerMethod> handlerMethods = null;
<add> for (RequestMappingInfoHandlerMapping mapping : map.values()) {
<add> handlerMethods = mapping.getHandlerMethodsForMappingName(name);
<add> if (handlerMethods != null) {
<add> break;
<add> }
<add> }
<ide> if (handlerMethods == null) {
<ide> throw new IllegalArgumentException("Mapping not found: " + name);
<ide> } | 1 |
Python | Python | increase default number of epochs | a955843684cdbc5c2ac26a89bf2b1b3efeebbaff | <ide><path>spacy/cli/train.py
<ide> version=("Model version", "option", "V", str),
<ide> meta_path=("Optional path to meta.json. All relevant properties will be overwritten.", "option", "m", Path)
<ide> )
<del>def train(cmd, lang, output_dir, train_data, dev_data, n_iter=10, n_sents=0,
<add>def train(cmd, lang, output_dir, train_data, dev_data, n_iter=30, n_sents=0,
<ide> use_gpu=-1, vectors=None, no_tagger=False, no_parser=False, no_entities=False,
<ide> gold_preproc=False, version="0.0.0", meta_path=None):
<ide> """ | 1 |
Javascript | Javascript | use path library to normalize filepath | d77e161f99d09c55ca3134419cc2428df331d96e | <ide><path>scripts/jest/ts-preprocessor.js
<ide> function compile(content, contentFilename) {
<ide> var output = null;
<ide> var compilerHost = {
<ide> getSourceFile: function(filename, languageVersion) {
<del> var source, reactRegex;
<add> var source;
<ide>
<del> // Accomodations for backslashes in Windows file paths.
<del> if (process.platform === 'win32') {
<del> filename = filename.replace(/\//g, '\\');
<del> reactRegex = /\\(?:React|ReactDOM)(?:\.d)?\.ts$/;
<del> } else {
<del> reactRegex = /\/(?:React|ReactDOM)(?:\.d)?\.ts$/;
<del> }
<add> // `path.normalize` and `path.join` are used to turn forward slashes in
<add> // the file path into backslashes on Windows.
<add> filename = path.normalize(filename);
<add> var reactRegex = new RegExp(
<add> path.join('/', '(?:React|ReactDOM)(?:\.d)?\.ts$')
<add> );
<ide>
<ide> if (filename === 'lib.d.ts') {
<ide> source = fs.readFileSync( | 1 |
PHP | PHP | remove unused function | 7cb429ab6d5ec273cbb2b9d38644a9b53944b6e3 | <ide><path>src/View/BakeView.php
<ide> protected function _evaluate($viewFile, $dataForView) {
<ide> return str_replace(array_values($unPhp), array_keys($unPhp), $content);
<ide> }
<ide>
<del>/**
<del> * Returns filename of given template file (.ctp) as a string.
<del> * CamelCased template names will be under_scored! This means that you can have
<del> * LongTemplateNames that refer to long_template_names.ctp views.
<del> *
<del> * Also allows rendering a template string directly
<del> *
<del> * @param string $name Bake template name
<del> * @return string Template filename or a Bake template string
<del> * @throws \Cake\View\Exception\MissingTemplateException when a view file could not be found.
<del> */
<del> protected function _getViewFileName($name = null) {
<del> if (strpos($name, '<') !== false) {
<del> return $name;
<del> }
<del> return parent::_getViewFileName($name);
<del> }
<del>
<ide> /**
<ide> * Get the contents of the template file
<ide> * | 1 |
Go | Go | fix error message in export | 8b31d30601f487bca5e4985c6a14b89e47ac83be | <ide><path>api.go
<ide> func getContainersExport(srv *Server, w http.ResponseWriter, r *http.Request, va
<ide>
<ide> if err := srv.ContainerExport(name, w); err != nil {
<ide> Debugf("%s", err.Error())
<del> //return nil, err
<add> return err
<ide> }
<ide> return nil
<ide> }
<ide><path>commands.go
<ide> func stream(method, path string) error {
<ide> return err
<ide> }
<ide> defer resp.Body.Close()
<add> if resp.StatusCode < 200 || resp.StatusCode >= 400 {
<add> body, err := ioutil.ReadAll(resp.Body)
<add> if err != nil {
<add> return err
<add> }
<add> return fmt.Errorf("error: %s", body)
<add> }
<add>
<ide> if _, err := io.Copy(os.Stdout, resp.Body); err != nil {
<ide> return err
<ide> } | 2 |
Go | Go | make tests less dependent on others | fe6706a2ce086304001fb812a41ed28c88f15c6c | <ide><path>libnetwork/libnetwork_linux_test.go
<ide> var (
<ide> testns = netns.None()
<ide> )
<ide>
<add>var createTesthostNetworkOnce sync.Once
<add>
<add>func getTesthostNetwork(t *testing.T) libnetwork.Network {
<add> t.Helper()
<add> createTesthostNetworkOnce.Do(func() {
<add> _, err := createTestNetwork("host", "testhost", options.Generic{}, nil, nil)
<add> if err != nil {
<add> t.Fatal(err)
<add> }
<add> })
<add> n, err := controller.NetworkByName("testhost")
<add> if err != nil {
<add> t.Fatal(err)
<add> }
<add> return n
<add>}
<add>
<ide> func createGlobalInstance(t *testing.T) {
<ide> var err error
<ide> defer close(start)
<ide> func createGlobalInstance(t *testing.T) {
<ide> },
<ide> }
<ide>
<del> net1, err := controller.NetworkByName("testhost")
<del> if err != nil {
<del> t.Fatal(err)
<del> }
<del>
<add> net1 := getTesthostNetwork(t)
<ide> net2, err := createTestNetwork("bridge", "network2", netOption, nil, nil)
<ide> if err != nil {
<ide> t.Fatal(err)
<ide> func TestHost(t *testing.T) {
<ide> }
<ide> }()
<ide>
<del> network, err := createTestNetwork("host", "testhost", options.Generic{}, nil, nil)
<del> if err != nil {
<del> t.Fatal(err)
<del> }
<del>
<add> network := getTesthostNetwork(t)
<ide> ep1, err := network.CreateEndpoint("testep1")
<ide> if err != nil {
<ide> t.Fatal(err)
<ide> func TestResolvConfHost(t *testing.T) {
<ide> }
<ide> }()
<ide>
<del> n, err := controller.NetworkByName("testhost")
<del> if err != nil {
<del> t.Fatal(err)
<del> }
<del>
<add> n := getTesthostNetwork(t)
<ide> ep1, err := n.CreateEndpoint("ep1", libnetwork.CreateOptionDisableResolution())
<ide> if err != nil {
<ide> t.Fatal(err)
<ide> func runParallelTests(t *testing.T, thrNumber int) {
<ide> }
<ide> }()
<ide>
<del> net1, err := controller.NetworkByName("testhost")
<del> if err != nil {
<del> t.Fatal(err)
<del> }
<add> net1 := getTesthostNetwork(t)
<ide> if net1 == nil {
<ide> t.Fatal("Could not find testhost")
<ide> } | 1 |
Javascript | Javascript | parse json only when template is needed | d2a4f10f77e75f48453de49f5eb85c32fd33d625 | <ide><path>packages/ember-template-compiler/lib/system/template.js
<ide> if (isEnabled('ember-glimmer')) {
<ide> }
<ide>
<ide> template = function(json) {
<del> let spec = JSON.parse(json);
<del>
<ide> return class extends Wrapper {
<ide> constructor(options) {
<ide> super(options);
<del> this.spec = spec;
<add> this.spec = JSON.parse(json);
<ide> }
<ide> };
<ide> }; | 1 |
Ruby | Ruby | add statement when upgrade won't be installed | 1f43bf32a4b1724d4cbedb81188f84eea93da491 | <ide><path>Library/Homebrew/cask/cmd/upgrade.rb
<ide> def self.upgrade_casks(
<ide> casks.select do |cask|
<ide> raise CaskNotInstalledError, cask if !cask.installed? && !force
<ide>
<del> cask.outdated?(greedy: true)
<add> if cask.outdated?(greedy: true)
<add> true
<add> elsif cask.version.latest?
<add> opoo "Not upgrading #{cask.token}, the downloaded artifact has not changed"
<add> false
<add> else
<add> opoo "Not upgrading #{cask.token}, the latest version is already installed"
<add> false
<add> end
<ide> end
<ide> end
<ide> | 1 |
Text | Text | add usage docs for streamed train corpora | 673e2bc4c0ca46f1c026e0823d32f35c52d2f38e | <ide><path>website/docs/api/data-formats.md
<ide> process that are used when you run [`spacy train`](/api/cli#train).
<ide> | `frozen_components` | Pipeline component names that are "frozen" and shouldn't be initialized or updated during training. See [here](/usage/training#config-components) for details. Defaults to `[]`. ~~List[str]~~ |
<ide> | `gpu_allocator` | Library for cupy to route GPU memory allocation to. Can be `"pytorch"` or `"tensorflow"`. Defaults to variable `${system.gpu_allocator}`. ~~str~~ |
<ide> | `logger` | Callable that takes the `nlp` and stdout and stderr `IO` objects, sets up the logger, and returns two new callables to log a training step and to finalize the logger. Defaults to [`ConsoleLogger`](/api/top-level#ConsoleLogger). ~~Callable[[Language, IO, IO], [Tuple[Callable[[Dict[str, Any]], None], Callable[[], None]]]]~~ |
<del>| `max_epochs` | Maximum number of epochs to train for. Defaults to `0`. ~~int~~ |
<del>| `max_steps` | Maximum number of update steps to train for. Defaults to `20000`. ~~int~~ |
<add>| `max_epochs` | Maximum number of epochs to train for. `0` means an unlimited number of epochs. `-1` means that the train corpus should be streamed rather than loaded into memory with no shuffling within the training loop. Defaults to `0`. ~~int~~ |
<add>| `max_steps` | Maximum number of update steps to train for. `0` means an unlimited number of steps. Defaults to `20000`. ~~int~~ |
<ide> | `optimizer` | The optimizer. The learning rate schedule and other settings can be configured as part of the optimizer. Defaults to [`Adam`](https://thinc.ai/docs/api-optimizers#adam). ~~Optimizer~~ |
<del>| `patience` | How many steps to continue without improvement in evaluation score. Defaults to `1600`. ~~int~~ |
<add>| `patience` | How many steps to continue without improvement in evaluation score. `0` disables early stopping. Defaults to `1600`. ~~int~~ |
<ide> | `score_weights` | Score names shown in metrics mapped to their weight towards the final weighted score. See [here](/usage/training#metrics) for details. Defaults to `{}`. ~~Dict[str, float]~~ |
<ide> | `seed` | The random seed. Defaults to variable `${system.seed}`. ~~int~~ |
<ide> | `train_corpus` | Dot notation of the config location defining the train corpus. Defaults to `corpora.train`. ~~str~~ |
<ide><path>website/docs/usage/training.md
<ide> any other custom workflows. `corpora.train` and `corpora.dev` are used as
<ide> conventions within spaCy's default configs, but you can also define any other
<ide> custom blocks. Each section in the corpora config should resolve to a
<ide> [`Corpus`](/api/corpus) – for example, using spaCy's built-in
<del>[corpus reader](/api/top-level#readers) that takes a path to a binary `.spacy`
<del>file. The `train_corpus` and `dev_corpus` fields in the
<add>[corpus reader](/api/top-level#corpus-readers) that takes a path to a binary
<add>`.spacy` file. The `train_corpus` and `dev_corpus` fields in the
<ide> [`[training]`](/api/data-formats#config-training) block specify where to find
<ide> the corpus in your config. This makes it easy to **swap out** different corpora
<ide> by only changing a single config setting.
<ide> corpora, keyed by corpus name, e.g. `"train"` and `"dev"`. This can be
<ide> especially useful if you need to split a single file into corpora for training
<ide> and evaluation, without loading the same file twice.
<ide>
<add>By default, the training data is loaded into memory and shuffled before each
<add>epoch. If the corpus is **too large to fit into memory** during training, stream
<add>the corpus using a custom reader as described in the next section.
<add>
<ide> ### Custom data reading and batching {#custom-code-readers-batchers}
<ide>
<ide> Some use-cases require **streaming in data** or manipulating datasets on the
<del>fly, rather than generating all data beforehand and storing it to file. Instead
<add>fly, rather than generating all data beforehand and storing it to disk. Instead
<ide> of using the built-in [`Corpus`](/api/corpus) reader, which uses static file
<ide> paths, you can create and register a custom function that generates
<del>[`Example`](/api/example) objects. The resulting generator can be infinite. When
<del>using this dataset for training, stopping criteria such as maximum number of
<del>steps, or stopping when the loss does not decrease further, can be used.
<del>
<del>In this example we assume a custom function `read_custom_data` which loads or
<del>generates texts with relevant text classification annotations. Then, small
<del>lexical variations of the input text are created before generating the final
<del>[`Example`](/api/example) objects. The `@spacy.registry.readers` decorator lets
<del>you register the function creating the custom reader in the `readers`
<add>[`Example`](/api/example) objects.
<add>
<add>In the following example we assume a custom function `read_custom_data` which
<add>loads or generates texts with relevant text classification annotations. Then,
<add>small lexical variations of the input text are created before generating the
<add>final [`Example`](/api/example) objects. The `@spacy.registry.readers` decorator
<add>lets you register the function creating the custom reader in the `readers`
<ide> [registry](/api/top-level#registry) and assign it a string name, so it can be
<ide> used in your config. All arguments on the registered function become available
<ide> as **config settings** – in this case, `source`.
<ide> Remember that a registered function should always be a function that spaCy
<ide>
<ide> </Infobox>
<ide>
<add>If the corpus is **too large to load into memory** or the corpus reader is an
<add>**infinite generator**, use the setting `max_epochs = -1` to indicate that the
<add>train corpus should be streamed. With this setting the train corpus is merely
<add>streamed and batched, not shuffled, so any shuffling needs to be implemented in
<add>the corpus reader itself. In the example below, a corpus reader that generates
<add>sentences containing even or odd numbers is used with an unlimited number of
<add>examples for the train corpus and a limited number of examples for the dev
<add>corpus. The dev corpus should always be finite and fit in memory during the
<add>evaluation step. `max_steps` and/or `patience` are used to determine when the
<add>training should stop.
<add>
<add>> #### config.cfg
<add>>
<add>> ```ini
<add>> [corpora.dev]
<add>> @readers = "even_odd.v1"
<add>> limit = 100
<add>>
<add>> [corpora.train]
<add>> @readers = "even_odd.v1"
<add>> limit = -1
<add>>
<add>> [training]
<add>> max_epochs = -1
<add>> patience = 500
<add>> max_steps = 2000
<add>> ```
<add>
<add>```python
<add>### functions.py
<add>from typing import Callable, Iterable, Iterator
<add>from spacy import util
<add>import random
<add>from spacy.training import Example
<add>from spacy import Language
<add>
<add>
<add>@util.registry.readers("even_odd.v1")
<add>def create_even_odd_corpus(limit: int = -1) -> Callable[[Language], Iterable[Example]]:
<add> return EvenOddCorpus(limit)
<add>
<add>
<add>class EvenOddCorpus:
<add> def __init__(self, limit):
<add> self.limit = limit
<add>
<add> def __call__(self, nlp: Language) -> Iterator[Example]:
<add> i = 0
<add> while i < self.limit or self.limit < 0:
<add> r = random.randint(0, 1000)
<add> cat = r % 2 == 0
<add> text = "This is sentence " + str(r)
<add> yield Example.from_dict(
<add> nlp.make_doc(text), {"cats": {"EVEN": cat, "ODD": not cat}}
<add> )
<add> i += 1
<add>```
<add>
<add>> #### config.cfg
<add>>
<add>> ```ini
<add>> [initialize.components.textcat.labels]
<add>> @readers = "spacy.read_labels.v1"
<add>> path = "labels/textcat.json"
<add>> require = true
<add>> ```
<add>
<add>If the train corpus is streamed, the initialize step peeks at the first 100
<add>examples in the corpus to find the labels for each component. If this isn't
<add>sufficient, you'll need to [provide the labels](#initialization-labels) for each
<add>component in the `[initialize]` block. [`init labels`](/api/cli#init-labels) can
<add>be used to generate JSON files in the correct format, which you can extend with
<add>the full label set.
<add>
<ide> We can also customize the **batching strategy** by registering a new batcher
<ide> function in the `batchers` [registry](/api/top-level#registry). A batcher turns
<ide> a stream of items into a stream of batches. spaCy has several useful built-in | 2 |
Javascript | Javascript | detect @types/ package for compiled packages | 8d219c23712441f5d5abae580e8c7924151a2806 | <ide><path>packages/next/taskfile-ncc.js
<ide> function writePackageManifest (packageName) {
<ide> let typesFile = types || typings
<ide> if (typesFile) {
<ide> typesFile = require.resolve(join(packageName, typesFile))
<add> } else {
<add> try {
<add> const typesPackage = `@types/${packageName}`
<add>
<add> const { types, typings } = require(join(typesPackage, `package.json`))
<add> typesFile = types || typings
<add> if (typesFile) {
<add> if (!typesFile.endsWith('.d.ts')) {
<add> typesFile += '.d.ts'
<add> }
<add>
<add> typesFile = require.resolve(join(typesPackage, typesFile))
<add> }
<add> } catch (_) {
<add> typesFile = undefined
<add> }
<ide> }
<ide>
<ide> const compiledPackagePath = join(__dirname, `dist/compiled/${packageName}`) | 1 |
Mixed | Javascript | assign error codes to remaining errors | ab8bf26994677a5f0823b3810668f6cfa18374d9 | <ide><path>doc/api/errors.md
<ide> Encoding provided to `util.TextDecoder()` API was not one of the
<ide> A `Promise` that was callbackified via `util.callbackify()` was rejected with a
<ide> falsy value.
<ide>
<add><a id="ERR_FS_FILE_TOO_LARGE"></a>
<add>### ERR_FS_FILE_TOO_LARGE
<add>
<add>An attempt has been made to read a file whose size is larger than the maximum
<add>allowed size for a `Buffer`.
<add>
<ide> <a id="ERR_FS_INVALID_SYMLINK_TYPE"></a>
<ide> ### ERR_FS_INVALID_SYMLINK_TYPE
<ide>
<ide><path>lib/fs.js
<ide> const fs = exports;
<ide> const { Buffer } = require('buffer');
<ide> const errors = require('internal/errors');
<ide> const {
<add> ERR_FS_FILE_TOO_LARGE,
<ide> ERR_INVALID_ARG_TYPE,
<ide> ERR_INVALID_CALLBACK,
<ide> ERR_OUT_OF_RANGE
<ide> function readFileAfterStat(err) {
<ide> }
<ide>
<ide> if (size > kMaxLength) {
<del> err = new RangeError('File size is greater than possible Buffer: ' +
<del> `0x${kMaxLength.toString(16)} bytes`);
<add> err = new ERR_FS_FILE_TOO_LARGE(size);
<ide> return context.close(err);
<ide> }
<ide>
<ide> function tryCreateBuffer(size, fd, isUserFd) {
<ide> var threw = true;
<ide> var buffer;
<ide> try {
<add> if (size > kMaxLength) {
<add> throw new ERR_FS_FILE_TOO_LARGE(size);
<add> }
<ide> buffer = Buffer.allocUnsafe(size);
<ide> threw = false;
<ide> } finally {
<ide><path>lib/fs/promises.js
<ide> const {
<ide> const binding = process.binding('fs');
<ide> const { Buffer, kMaxLength } = require('buffer');
<ide> const {
<del> ERR_BUFFER_TOO_LARGE,
<add> ERR_FS_FILE_TOO_LARGE,
<ide> ERR_INVALID_ARG_TYPE,
<ide> ERR_METHOD_NOT_IMPLEMENTED,
<ide> ERR_OUT_OF_RANGE
<ide> async function readFileHandle(filehandle, options) {
<ide> return Buffer.alloc(0);
<ide>
<ide> if (size > kMaxLength)
<del> throw new ERR_BUFFER_TOO_LARGE();
<add> throw new ERR_FS_FILE_TOO_LARGE(size);
<ide>
<ide> const chunks = [];
<ide> const chunkSize = Math.min(size, 16384);
<ide><path>lib/internal/cluster/master.js
<ide> const RoundRobinHandle = require('internal/cluster/round_robin_handle');
<ide> const SharedHandle = require('internal/cluster/shared_handle');
<ide> const Worker = require('internal/cluster/worker');
<ide> const { internal, sendHelper, handles } = require('internal/cluster/utils');
<add>const { ERR_SOCKET_BAD_PORT } = require('internal/errors').codes;
<ide> const keys = Object.keys;
<ide> const cluster = new EventEmitter();
<ide> const intercom = new EventEmitter();
<ide> function createWorkerProcess(id, env) {
<ide> inspectPort = cluster.settings.inspectPort;
<ide>
<ide> if (!isLegalPort(inspectPort)) {
<del> throw new TypeError('cluster.settings.inspectPort' +
<del> ' is invalid');
<add> throw new ERR_SOCKET_BAD_PORT(inspectPort);
<ide> }
<ide> } else {
<ide> inspectPort = process.debugPort + debugPortOffset;
<ide><path>lib/internal/errors.js
<ide> E('ERR_ENCODING_INVALID_ENCODED_DATA',
<ide> E('ERR_ENCODING_NOT_SUPPORTED', 'The "%s" encoding is not supported',
<ide> RangeError);
<ide> E('ERR_FALSY_VALUE_REJECTION', 'Promise was rejected with falsy value', Error);
<add>E('ERR_FS_FILE_TOO_LARGE', 'File size (%s) is greater than possible Buffer: ' +
<add> `${kMaxLength} bytes`,
<add> RangeError);
<ide> E('ERR_FS_INVALID_SYMLINK_TYPE',
<ide> 'Symlink type must be one of "dir", "file", or "junction". Received "%s"',
<ide> Error); // Switch to TypeError. The current implementation does not seem right
<ide><path>lib/net.js
<ide> function internalConnect(
<ide> localAddress = localAddress || '::';
<ide> err = self._handle.bind6(localAddress, localPort);
<ide> } else {
<del> self.destroy(new TypeError('Invalid addressType: ' + addressType));
<add> self.destroy(new ERR_INVALID_ADDRESS_FAMILY(addressType));
<ide> return;
<ide> }
<ide> debug('binding to localAddress: %s and localPort: %d (addressType: %d)',
<ide><path>test/sequential/test-inspector-port-cluster.js
<ide> function testRunnerMain() {
<ide> function masterProcessMain() {
<ide> const workers = JSON.parse(process.env.workers);
<ide> const clusterSettings = JSON.parse(process.env.clusterSettings);
<add> const badPortError = { type: RangeError, code: 'ERR_SOCKET_BAD_PORT' };
<ide> let debugPort = process.debugPort;
<ide>
<ide> for (const worker of workers) {
<ide> function masterProcessMain() {
<ide> clusterSettings.inspectPort = 'string';
<ide> cluster.setupMaster(clusterSettings);
<ide>
<del> assert.throws(() => {
<add> common.expectsError(() => {
<ide> cluster.fork(params).on('exit', common.mustCall(checkExitCode));
<del> }, TypeError);
<add> }, badPortError);
<ide>
<ide> return;
<ide> } else if (clusterSettings.inspectPort === 'null') {
<ide> clusterSettings.inspectPort = null;
<ide> cluster.setupMaster(clusterSettings);
<ide>
<del> assert.throws(() => {
<add> common.expectsError(() => {
<ide> cluster.fork(params).on('exit', common.mustCall(checkExitCode));
<del> }, TypeError);
<add> }, badPortError);
<ide>
<ide> return;
<ide> } else if (clusterSettings.inspectPort === 'bignumber') {
<ide> clusterSettings.inspectPort = 1293812;
<ide> cluster.setupMaster(clusterSettings);
<ide>
<del> assert.throws(() => {
<add> common.expectsError(() => {
<ide> cluster.fork(params).on('exit', common.mustCall(checkExitCode));
<del> }, TypeError);
<add> }, badPortError);
<ide>
<ide> return;
<ide> } else if (clusterSettings.inspectPort === 'negativenumber') {
<ide> clusterSettings.inspectPort = -9776;
<ide> cluster.setupMaster(clusterSettings);
<ide>
<del> assert.throws(() => {
<add> common.expectsError(() => {
<ide> cluster.fork(params).on('exit', common.mustCall(checkExitCode));
<del> }, TypeError);
<add> }, badPortError);
<ide>
<ide> return;
<ide> } else if (clusterSettings.inspectPort === 'bignumberfunc') {
<ide> function masterProcessMain() {
<ide>
<ide> cluster.setupMaster(clusterSettings);
<ide>
<del> assert.throws(() => {
<add> common.expectsError(() => {
<ide> cluster.fork(params).on('exit', common.mustCall(checkExitCode));
<del> }, TypeError);
<add> }, badPortError);
<ide>
<ide> return;
<ide> } else if (clusterSettings.inspectPort === 'strfunc') {
<ide> function masterProcessMain() {
<ide>
<ide> cluster.setupMaster(clusterSettings);
<ide>
<del> assert.throws(() => {
<add> common.expectsError(() => {
<ide> cluster.fork(params).on('exit', common.mustCall(checkExitCode));
<del> }, TypeError);
<add> }, badPortError);
<ide>
<ide> return;
<ide> } | 7 |
Javascript | Javascript | add crypto modules to cannotusecache | 47062f12a7095658f1f7cff7d25234ea21a839cf | <ide><path>lib/internal/bootstrap/cache.js
<ide> if (!process.versions.openssl) {
<ide> 'internal/crypto/util',
<ide> 'internal/http2/core',
<ide> 'internal/http2/compat',
<add> 'internal/policy/manifest',
<add> 'internal/process/policy',
<ide> 'internal/streams/lazy_transform',
<ide> );
<ide> } | 1 |
Javascript | Javascript | remove options object | fd1a1325f309929777a2812f1c70f24161257286 | <ide><path>packager/react-packager/src/Bundler/index.js
<ide> class Bundler {
<ide> cacheKey: transformCacheKey,
<ide> });
<ide>
<del> this._transformer = new Transformer({
<del> transformModulePath: opts.transformModulePath,
<del> });
<add> /* $FlowFixMe: in practice it's always here. */
<add> this._transformer = new Transformer(opts.transformModulePath);
<ide>
<ide> this._resolver = new Resolver({
<ide> assetExts: opts.assetExts,
<ide><path>packager/react-packager/src/JSTransformer/__tests__/Transformer-test.js
<ide> var Transformer = require('../');
<ide> const {any} = jasmine;
<ide>
<ide> describe('Transformer', function() {
<del> let options, workers, Cache;
<add> let workers, Cache;
<ide> const fileName = '/an/arbitrary/file.js';
<ide> const transformModulePath = __filename;
<ide>
<ide> describe('Transformer', function() {
<ide> Cache.prototype.get = jest.fn((a, b, c) => c());
<ide>
<ide> fs.writeFileSync.mockClear();
<del> options = {transformModulePath};
<ide> workerFarm.mockClear();
<ide> workerFarm.mockImplementation((opts, path, methods) => {
<ide> const api = workers = {};
<ide> describe('Transformer', function() {
<ide> });
<ide> });
<ide>
<del> it('passes transform module path, file path, source code,' +
<del> ' and options to the worker farm when transforming', () => {
<add> it('passes transform module path, file path, source code' +
<add> ' to the worker farm when transforming', () => {
<ide> const transformOptions = {arbitrary: 'options'};
<ide> const code = 'arbitrary(code)';
<del> new Transformer(options).transformFile(fileName, code, transformOptions);
<add> new Transformer(transformModulePath).transformFile(fileName, code, transformOptions);
<ide> expect(workers.transformAndExtractDependencies).toBeCalledWith(
<ide> transformModulePath,
<ide> fileName,
<ide> describe('Transformer', function() {
<ide> });
<ide>
<ide> it('should add file info to parse errors', function() {
<del> const transformer = new Transformer(options);
<add> const transformer = new Transformer(transformModulePath);
<ide> var message = 'message';
<ide> var snippet = 'snippet';
<ide>
<ide><path>packager/react-packager/src/JSTransformer/index.js
<ide>
<ide> const Logger = require('../Logger');
<ide>
<del>const declareOpts = require('../lib/declareOpts');
<add>const debug = require('debug')('RNP:JStransformer');
<ide> const denodeify = require('denodeify');
<add>const invariant = require('fbjs/lib/invariant');
<ide> const os = require('os');
<add>const path = require('path');
<ide> const util = require('util');
<ide> const workerFarm = require('worker-farm');
<del>const debug = require('debug')('RNP:JStransformer');
<ide>
<ide> import type {Data as TransformData, Options as TransformOptions} from './worker/worker';
<ide> import type {SourceMap} from '../lib/SourceMap';
<ide> const TRANSFORM_TIMEOUT_INTERVAL = 301000;
<ide> // How may times can we tolerate failures from the worker.
<ide> const MAX_RETRIES = 2;
<ide>
<del>const validateOpts = declareOpts({
<del> transformModulePath: {
<del> type:'string',
<del> required: false,
<del> },
<del>});
<del>
<del>type Options = {
<del> transformModulePath?: ?string,
<del>};
<del>
<ide> const maxConcurrentWorkers = ((cores, override) => {
<ide> if (override) {
<ide> return Math.min(cores, override);
<ide> function makeFarm(worker, methods, timeout) {
<ide>
<ide> class Transformer {
<ide>
<del> _opts: {
<del> transformModulePath?: ?string,
<del> };
<ide> _workers: {[name: string]: mixed};
<del> _transformModulePath: ?string;
<add> _transformModulePath: string;
<ide> _transform: (
<ide> transform: string,
<ide> filename: string,
<ide> class Transformer {
<ide> sourceMap: SourceMap,
<ide> ) => Promise<{code: string, map: SourceMap}>;
<ide>
<del> constructor(options: Options) {
<del> const opts = this._opts = validateOpts(options);
<del>
<del> const {transformModulePath} = opts;
<del>
<del> if (transformModulePath) {
<del> this._transformModulePath = require.resolve(transformModulePath);
<del>
<del> this._workers = makeFarm(
<del> require.resolve('./worker'),
<del> ['minify', 'transformAndExtractDependencies'],
<del> TRANSFORM_TIMEOUT_INTERVAL,
<del> );
<del> this._transform = denodeify(this._workers.transformAndExtractDependencies);
<del> this.minify = denodeify(this._workers.minify);
<del> }
<add> constructor(transformModulePath: string) {
<add> invariant(path.isAbsolute(transformModulePath), 'transform module path should be absolute');
<add> this._transformModulePath = transformModulePath;
<add>
<add> this._workers = makeFarm(
<add> require.resolve('./worker'),
<add> ['minify', 'transformAndExtractDependencies'],
<add> TRANSFORM_TIMEOUT_INTERVAL,
<add> );
<add> this._transform = denodeify(this._workers.transformAndExtractDependencies);
<add> this.minify = denodeify(this._workers.minify);
<ide> }
<ide>
<ide> kill() {
<ide> class Transformer {
<ide> }
<ide> debug('transforming file', fileName);
<ide> return this
<del> /* $FlowFixMe: _transformModulePath may be empty, see constructor */
<ide> ._transform(this._transformModulePath, fileName, code, options)
<ide> .then(data => {
<ide> Logger.log(data.transformFileStartLogEntry);
<ide> class Transformer {
<ide> } else if (error.type === 'ProcessTerminatedError') {
<ide> const uncaughtError = new Error(
<ide> 'Uncaught error in the transformer worker: ' +
<del> /* $FlowFixMe: _transformModulePath may be empty, see constructor */
<del> this._opts.transformModulePath
<add> this._transformModulePath
<ide> );
<ide> /* $FlowFixMe: monkey-patch Error */
<ide> uncaughtError.type = 'ProcessTerminatedError'; | 3 |
Javascript | Javascript | fix linting issues | 8149c5e1f15dfeeb07764f4130c6bd76d6ff74de | <ide><path>examples/code-splitted-css-bundle/webpack.config.js
<del>const LoaderOptionsPlugin = require("webpack").LoaderOptionsPlugin;
<del>
<add>const LoaderOptionsPlugin = require("../../lib/LoaderOptionsPlugin");
<ide> const ExtractTextPlugin = require("extract-text-webpack-plugin");
<ide> module.exports = {
<ide> module: {
<ide><path>examples/css-bundle/webpack.config.js
<del>const LoaderOptionsPlugin = require("webpack").LoaderOptionsPlugin;
<del>
<add>const LoaderOptionsPlugin = require("../../lib/LoaderOptionsPlugin");
<ide> const ExtractTextPlugin = require("extract-text-webpack-plugin");
<ide> module.exports = {
<ide> module: {
<ide><path>examples/multiple-entry-points-commons-chunk-css-bundle/webpack.config.js
<del>var path = require("path");
<del>const LoaderOptionsPlugin = require("webpack").LoaderOptionsPlugin;
<del>var CommonsChunkPlugin = require("../../lib/optimize/CommonsChunkPlugin");
<del>var ExtractTextPlugin = require("extract-text-webpack-plugin");
<add>const path = require("path");
<add>const LoaderOptionsPlugin = require("../../lib/LoaderOptionsPlugin");
<add>const CommonsChunkPlugin = require("../../lib/optimize/CommonsChunkPlugin");
<add>const ExtractTextPlugin = require("extract-text-webpack-plugin");
<ide> module.exports = {
<ide> entry: {
<ide> A: "./a",
<ide><path>lib/webpack.js
<ide> exportPlugins(exports, {
<ide> "SetVarMainTemplatePlugin": () => require("./SetVarMainTemplatePlugin"),
<ide> "UmdMainTemplatePlugin": () => require("./UmdMainTemplatePlugin"),
<ide> "NoEmitOnErrorsPlugin": () => require("./NoEmitOnErrorsPlugin"),
<del> "NewWatchingPlugin": () => require("./NewWatchingPlugin"),
<ide> "EnvironmentPlugin": () => require("./EnvironmentPlugin"),
<ide> "DllPlugin": () => require("./DllPlugin"),
<ide> "DllReferencePlugin": () => require("./DllReferencePlugin"), | 4 |
Python | Python | fix file_utils on python 2 | fa765202402499486efd1cb3484c5e70555479c2 | <ide><path>pytorch_pretrained_bert/file_utils.py
<ide> def get_from_cache(url, cache_dir=None):
<ide> meta = {'url': url, 'etag': etag}
<ide> meta_path = cache_path + '.json'
<ide> with open(meta_path, 'w', encoding="utf-8") as meta_file:
<del> meta_file.write(json.dumps(meta))
<add> json.dump(meta, meta_file)
<ide>
<ide> logger.info("removing temp file %s", temp_file.name)
<ide> | 1 |
Go | Go | move auth header on run cmd | ded973219e997f52634eb18d0cfe828472412dd8 | <ide><path>commands.go
<ide> func (cli *DockerCli) CmdRun(args ...string) error {
<ide> if err != nil {
<ide> return err
<ide> }
<del> v.Set("authConfig", base64.URLEncoding.EncodeToString(buf))
<ide>
<del> err = cli.stream("POST", "/images/create?"+v.Encode(), nil, cli.err, nil)
<add> registryAuthHeader := []string{
<add> base64.URLEncoding.EncodeToString(buf),
<add> }
<add> err = cli.stream("POST", "/images/create?"+v.Encode(), nil, cli.err, map[string][]string{
<add> "X-Registry-Auth": registryAuthHeader,
<add> })
<ide> if err != nil {
<ide> return err
<ide> } | 1 |
Text | Text | add section on blockchain consensus protocols | 7b68723cf5d855c1876706170df41f59adf1c985 | <ide><path>guide/english/blockchain/cryptocurrency/index.md
<ide> Artist have to deal through intermediaries to get your work sold. This can be so
<ide>
<ide> There are many more ways that cryptocurrency is changing aspects of our lives; ranging from economic to social. As crypto gains popularity more and more uses will come into the world of Cryptocurrency.
<ide>
<add>## Consensus Protocols:
<add>
<add>#### Proof of Work:
<add>In this more well-known protocol, miners compete with each other to solve a math problem first and to be rewarded with a cryptocurrency reward for their work in securing the network. When a math problem is solved, a new block full of transactions gets added onto the blockchain. Bitcoin operates on a proof-of-work algorithm.
<add>
<add>#### Proof of Stake:
<add>In proof of stake, the network is secured via network participants staking or wagering their coins. If network participants misbehave, they will lose the coins that they staked. As a reward for properly securing the network, stakers will periodically receive a small amount of coins relative to how many coins they put up for staking. Instead of competing to solve a difficult math problem to validate blocks, block validators under proof of stake are randomly chosen. Proof of stake is typically significantly less energy-intensive than proof of work.
<add>
<ide>
<ide> ### Background History on Origins of Cryptocurrency:
<ide> [Blockchain Origins Story](https://www.activism.net/cypherpunk/manifesto.html) | 1 |
Ruby | Ruby | fix example code of `eachvalidator` [ci skip] | 524f7b494a758f554d899f11bcbc9827cec6d963 | <ide><path>activemodel/lib/active_model/validator.rb
<ide> module ActiveModel
<ide> # include ActiveModel::Validations
<ide> # attr_accessor :title
<ide> #
<del> # validates :title, presence: true
<add> # validates :title, presence: true, title: true
<ide> # end
<ide> #
<ide> # It can be useful to access the class that is using that validator when there are prerequisites such | 1 |
Java | Java | add serverhttprequest builder | 3df902c6cc62770d5ef49f18fac8a3f6e35e7526 | <ide><path>spring-web/src/main/java/org/springframework/http/server/reactive/DefaultServerHttpRequestBuilder.java
<add>/*
<add> * Copyright 2002-2016 the original author or authors.
<add> *
<add> * Licensed under the Apache License, Version 2.0 (the "License");
<add> * you may not use this file except in compliance with the License.
<add> * You may obtain a copy of the License at
<add> *
<add> * http://www.apache.org/licenses/LICENSE-2.0
<add> *
<add> * Unless required by applicable law or agreed to in writing, software
<add> * distributed under the License is distributed on an "AS IS" BASIS,
<add> * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
<add> * See the License for the specific language governing permissions and
<add> * limitations under the License.
<add> */
<add>package org.springframework.http.server.reactive;
<add>
<add>import java.net.URI;
<add>
<add>import reactor.core.publisher.Flux;
<add>
<add>import org.springframework.core.io.buffer.DataBuffer;
<add>import org.springframework.http.HttpCookie;
<add>import org.springframework.http.HttpHeaders;
<add>import org.springframework.http.HttpMethod;
<add>import org.springframework.util.Assert;
<add>import org.springframework.util.MultiValueMap;
<add>
<add>/**
<add> * Package private default implementation of {@link ServerHttpRequest.Builder}.
<add> *
<add> * @author Rossen Stoyanchev
<add> * @since 5.0
<add> */
<add>class DefaultServerHttpRequestBuilder implements ServerHttpRequest.Builder {
<add>
<add> private final ServerHttpRequest delegate;
<add>
<add>
<add> private HttpMethod httpMethod;
<add>
<add> private URI uri;
<add>
<add> private String contextPath;
<add>
<add> private MultiValueMap<String, String> queryParams;
<add>
<add> private HttpHeaders headers;
<add>
<add> private MultiValueMap<String, HttpCookie> cookies;
<add>
<add> private Flux<DataBuffer> body;
<add>
<add>
<add> public DefaultServerHttpRequestBuilder(ServerHttpRequest delegate) {
<add> Assert.notNull(delegate, "ServerHttpRequest delegate is required.");
<add> this.delegate = delegate;
<add> }
<add>
<add>
<add> @Override
<add> public ServerHttpRequest.Builder method(HttpMethod httpMethod) {
<add> this.httpMethod = httpMethod;
<add> return this;
<add> }
<add>
<add> @Override
<add> public ServerHttpRequest.Builder uri(URI uri) {
<add> this.uri = uri;
<add> return this;
<add> }
<add>
<add> @Override
<add> public ServerHttpRequest.Builder contextPath(String contextPath) {
<add> this.contextPath = contextPath;
<add> return this;
<add> }
<add>
<add> @Override
<add> public ServerHttpRequest.Builder queryParams(MultiValueMap<String, String> queryParams) {
<add> this.queryParams = queryParams;
<add> return this;
<add> }
<add>
<add> @Override
<add> public ServerHttpRequest.Builder headers(HttpHeaders headers) {
<add> this.headers = headers;
<add> return this;
<add> }
<add>
<add> @Override
<add> public ServerHttpRequest.Builder cookies(MultiValueMap<String, HttpCookie> cookies) {
<add> this.cookies = cookies;
<add> return this;
<add> }
<add>
<add> @Override
<add> public ServerHttpRequest.Builder body(Flux<DataBuffer> body) {
<add> this.body = body;
<add> return this;
<add> }
<add>
<add> @Override
<add> public ServerHttpRequest build() {
<add> return new MutativeDecorator(this.delegate, this.httpMethod, this.uri, this.contextPath,
<add> this.queryParams, this.headers, this.cookies, this.body);
<add> }
<add>
<add>
<add> /**
<add> * An immutable wrapper of a request returning property overrides -- given
<add> * to the constructor -- or original values otherwise.
<add> */
<add> private static class MutativeDecorator extends ServerHttpRequestDecorator {
<add>
<add> private final HttpMethod httpMethod;
<add>
<add> private final URI uri;
<add>
<add> private final String contextPath;
<add>
<add> private final MultiValueMap<String, String> queryParams;
<add>
<add> private final HttpHeaders headers;
<add>
<add> private final MultiValueMap<String, HttpCookie> cookies;
<add>
<add> private final Flux<DataBuffer> body;
<add>
<add>
<add> public MutativeDecorator(ServerHttpRequest delegate, HttpMethod httpMethod, URI uri,
<add> String contextPath, MultiValueMap<String, String> queryParams, HttpHeaders headers,
<add> MultiValueMap<String, HttpCookie> cookies, Flux<DataBuffer> body) {
<add>
<add> super(delegate);
<add> this.httpMethod = httpMethod;
<add> this.uri = uri;
<add> this.contextPath = contextPath;
<add> this.queryParams = queryParams;
<add> this.headers = headers;
<add> this.cookies = cookies;
<add> this.body = body;
<add> }
<add>
<add> @Override
<add> public HttpMethod getMethod() {
<add> return (this.httpMethod != null ? this.httpMethod : super.getMethod());
<add> }
<add>
<add> @Override
<add> public URI getURI() {
<add> return (this.uri != null ? this.uri : super.getURI());
<add> }
<add>
<add> @Override
<add> public String getContextPath() {
<add> return (this.contextPath != null ? this.contextPath : super.getContextPath());
<add> }
<add>
<add> @Override
<add> public MultiValueMap<String, String> getQueryParams() {
<add> return (this.queryParams != null ? this.queryParams : super.getQueryParams());
<add> }
<add>
<add> @Override
<add> public HttpHeaders getHeaders() {
<add> return (this.headers != null ? this.headers : super.getHeaders());
<add> }
<add>
<add> @Override
<add> public MultiValueMap<String, HttpCookie> getCookies() {
<add> return (this.cookies != null ? this.cookies : super.getCookies());
<add> }
<add>
<add> @Override
<add> public Flux<DataBuffer> getBody() {
<add> return (this.body != null ? this.body : super.getBody());
<add> }
<add> }
<add>
<add>}
<ide><path>spring-web/src/main/java/org/springframework/http/server/reactive/HttpHandlerAdapterSupport.java
<ide> public Mono<Void> handle(ServerHttpRequest request, ServerHttpResponse response)
<ide> .filter(entry -> path.startsWith(entry.getKey()))
<ide> .findFirst()
<ide> .map(entry -> {
<add> // Preserve "native" contextPath from underlying request..
<add> String contextPath = request.getContextPath() + entry.getKey();
<add> ServerHttpRequest mutatedRequest = request.mutate().contextPath(contextPath).build();
<ide> HttpHandler handler = entry.getValue();
<del> ServerHttpRequest req = new ContextPathRequestDecorator(request, entry.getKey());
<del> return handler.handle(req, response);
<add> return handler.handle(mutatedRequest, response);
<ide> })
<ide> .orElseGet(() -> {
<ide> response.setStatusCode(HttpStatus.NOT_FOUND);
<ide> private String getPathToUse(ServerHttpRequest request) {
<ide> }
<ide> }
<ide>
<del> private static class ContextPathRequestDecorator extends ServerHttpRequestDecorator {
<del>
<del> private final String contextPath;
<del>
<del> public ContextPathRequestDecorator(ServerHttpRequest delegate, String contextPath) {
<del> super(delegate);
<del> this.contextPath = delegate.getContextPath() + contextPath;
<del> }
<del>
<del> @Override
<del> public String getContextPath() {
<del> return this.contextPath;
<del> }
<del> }
<del>
<ide> }
<ide><path>spring-web/src/main/java/org/springframework/http/server/reactive/ServerHttpRequest.java
<ide>
<ide> package org.springframework.http.server.reactive;
<ide>
<add>import java.net.URI;
<add>
<add>import reactor.core.publisher.Flux;
<add>
<add>import org.springframework.core.io.buffer.DataBuffer;
<ide> import org.springframework.http.HttpCookie;
<add>import org.springframework.http.HttpHeaders;
<add>import org.springframework.http.HttpMethod;
<ide> import org.springframework.http.HttpRequest;
<ide> import org.springframework.http.ReactiveHttpInputMessage;
<ide> import org.springframework.util.MultiValueMap;
<ide> default String getContextPath() {
<ide> */
<ide> MultiValueMap<String, HttpCookie> getCookies();
<ide>
<add>
<add> /**
<add> * Return a builder to mutate properties of this request. The resulting
<add> * new request is an immutable {@link ServerHttpRequestDecorator decorator}
<add> * around the current exchange instance returning mutated values.
<add> */
<add> default ServerHttpRequest.Builder mutate() {
<add> return new DefaultServerHttpRequestBuilder(this);
<add> }
<add>
<add>
<add> /**
<add> * Builder for mutating properties of a {@link ServerHttpRequest}.
<add> */
<add> interface Builder {
<add>
<add> /**
<add> * Set the HTTP method.
<add> */
<add> Builder method(HttpMethod httpMethod);
<add>
<add> /**
<add> * Set the request URI.
<add> */
<add> Builder uri(URI uri);
<add>
<add>
<add> /**
<add> * Set the contextPath for the request.
<add> */
<add> Builder contextPath(String contextPath);
<add>
<add> /**
<add> * Set the query params to return.
<add> */
<add> Builder queryParams(MultiValueMap<String, String> queryParams);
<add>
<add> /**
<add> * Set the headers to use.
<add> */
<add> Builder headers(HttpHeaders headers);
<add>
<add> /**
<add> * Set the cookies to use.
<add> */
<add> Builder cookies(MultiValueMap<String, HttpCookie> cookies);
<add>
<add> /**
<add> * Set the body to return.
<add> */
<add> Builder body(Flux<DataBuffer> body);
<add>
<add> /**
<add> * Build an immutable wrapper that returning the mutated properties.
<add> */
<add> ServerHttpRequest build();
<add>
<add> }
<add>
<ide> }
<ide><path>spring-web/src/test/java/org/springframework/http/server/reactive/HttpHandlerAdapterSupportTests.java
<ide> package org.springframework.http.server.reactive;
<ide>
<ide> import java.util.Arrays;
<add>import java.util.Collections;
<add>import java.util.HashMap;
<ide> import java.util.LinkedHashMap;
<ide> import java.util.Map;
<ide>
<ide> public void invalidContextPath() throws Exception {
<ide>
<ide> private void testInvalidContextPath(String contextPath, String errorMessage) {
<ide> try {
<del> new TestHttpHandlerAdapter(new TestHttpHandler(contextPath));
<add> new TestHttpHandlerAdapter(Collections.singletonMap(contextPath, new TestHttpHandler()));
<ide> fail();
<ide> }
<ide> catch (IllegalArgumentException ex) {
<ide> private void testInvalidContextPath(String contextPath, String errorMessage) {
<ide>
<ide> @Test
<ide> public void match() throws Exception {
<del> TestHttpHandler handler1 = new TestHttpHandler("/path");
<del> TestHttpHandler handler2 = new TestHttpHandler("/another/path");
<del> TestHttpHandler handler3 = new TestHttpHandler("/yet/another/path");
<add> TestHttpHandler handler1 = new TestHttpHandler();
<add> TestHttpHandler handler2 = new TestHttpHandler();
<add> TestHttpHandler handler3 = new TestHttpHandler();
<ide>
<del> testPath("/another/path/and/more", handler1, handler2, handler3);
<add> Map<String, HttpHandler> map = new HashMap<>();
<add> map.put("/path", handler1);
<add> map.put("/another/path", handler2);
<add> map.put("/yet/another/path", handler3);
<ide>
<del> assertInvoked(handler2);
<add> testPath("/another/path/and/more", map);
<add>
<add> assertInvoked(handler2, "/another/path");
<ide> assertNotInvoked(handler1, handler3);
<ide> }
<ide>
<ide> @Test
<ide> public void matchWithContextPathEqualToPath() throws Exception {
<del> TestHttpHandler handler1 = new TestHttpHandler("/path");
<del> TestHttpHandler handler2 = new TestHttpHandler("/another/path");
<del> TestHttpHandler handler3 = new TestHttpHandler("/yet/another/path");
<add> TestHttpHandler handler1 = new TestHttpHandler();
<add> TestHttpHandler handler2 = new TestHttpHandler();
<add> TestHttpHandler handler3 = new TestHttpHandler();
<add>
<add> Map<String, HttpHandler> map = new HashMap<>();
<add> map.put("/path", handler1);
<add> map.put("/another/path", handler2);
<add> map.put("/yet/another/path", handler3);
<ide>
<del> testPath("/path", handler1, handler2, handler3);
<add> testPath("/path", map);
<ide>
<del> assertInvoked(handler1);
<add> assertInvoked(handler1, "/path");
<ide> assertNotInvoked(handler2, handler3);
<ide> }
<ide>
<ide> @Test
<ide> public void matchWithNativeContextPath() throws Exception {
<ide> MockServerHttpRequest request = new MockServerHttpRequest(HttpMethod.GET, "/yet/another/path");
<del> request.setContextPath("/yet");
<add> request.setContextPath("/yet"); // contextPath in underlying request
<ide>
<del> TestHttpHandler handler = new TestHttpHandler("/another/path");
<del> new TestHttpHandlerAdapter(handler).handle(request);
<add> TestHttpHandler handler = new TestHttpHandler();
<add> Map<String, HttpHandler> map = Collections.singletonMap("/another/path", handler);
<add>
<add> new TestHttpHandlerAdapter(map).handle(request);
<ide>
<ide> assertTrue(handler.wasInvoked());
<ide> assertEquals("/yet/another/path", handler.getRequest().getContextPath());
<ide> }
<ide>
<ide> @Test
<ide> public void notFound() throws Exception {
<del> TestHttpHandler handler1 = new TestHttpHandler("/path");
<del> TestHttpHandler handler2 = new TestHttpHandler("/another/path");
<add> TestHttpHandler handler1 = new TestHttpHandler();
<add> TestHttpHandler handler2 = new TestHttpHandler();
<add>
<add> Map<String, HttpHandler> map = new HashMap<>();
<add> map.put("/path", handler1);
<add> map.put("/another/path", handler2);
<ide>
<del> ServerHttpResponse response = testPath("/yet/another/path", handler1, handler2);
<add> ServerHttpResponse response = testPath("/yet/another/path", map);
<ide>
<ide> assertNotInvoked(handler1, handler2);
<ide> assertEquals(HttpStatus.NOT_FOUND, response.getStatusCode());
<ide> }
<ide>
<ide>
<del> private ServerHttpResponse testPath(String path, TestHttpHandler... handlers) {
<del> TestHttpHandlerAdapter adapter = new TestHttpHandlerAdapter(handlers);
<add> private ServerHttpResponse testPath(String path, Map<String, HttpHandler> handlerMap) {
<add> TestHttpHandlerAdapter adapter = new TestHttpHandlerAdapter(handlerMap);
<ide> return adapter.handle(path);
<ide> }
<ide>
<del> private void assertInvoked(TestHttpHandler handler) {
<add> private void assertInvoked(TestHttpHandler handler, String contextPath) {
<ide> assertTrue(handler.wasInvoked());
<del> assertEquals(handler.getContextPath(), handler.getRequest().getContextPath());
<add> assertEquals(contextPath, handler.getRequest().getContextPath());
<ide> }
<ide>
<ide> private void assertNotInvoked(TestHttpHandler... handlers) {
<ide> private void assertNotInvoked(TestHttpHandler... handlers) {
<ide> private static class TestHttpHandlerAdapter extends HttpHandlerAdapterSupport {
<ide>
<ide>
<del> public TestHttpHandlerAdapter(TestHttpHandler... handlers) {
<del> super(initHandlerMap(handlers));
<del> }
<del>
<del>
<del> private static Map<String, HttpHandler> initHandlerMap(TestHttpHandler... testHandlers) {
<del> Map<String, HttpHandler> result = new LinkedHashMap<>();
<del> Arrays.stream(testHandlers).forEachOrdered(h -> result.put(h.getContextPath(), h));
<del> return result;
<add> public TestHttpHandlerAdapter(Map<String, HttpHandler> handlerMap) {
<add> super(handlerMap);
<ide> }
<ide>
<ide> public ServerHttpResponse handle(String path) {
<ide> public ServerHttpResponse handle(ServerHttpRequest request) {
<ide> @SuppressWarnings("WeakerAccess")
<ide> private static class TestHttpHandler implements HttpHandler {
<ide>
<del> private final String contextPath;
<del>
<ide> private ServerHttpRequest request;
<ide>
<ide>
<del> public TestHttpHandler(String contextPath) {
<del> this.contextPath = contextPath;
<del> }
<del>
<del>
<del> public String getContextPath() {
<del> return this.contextPath;
<del> }
<del>
<ide> public boolean wasInvoked() {
<ide> return this.request != null;
<ide> } | 4 |
Text | Text | update changelog for 2.10.0 | 010e11ce7a55201f4defab08b961ab05efdaf0f0 | <ide><path>CHANGELOG.md
<ide> Changelog
<ide> =========
<ide>
<add>### 2.10.0
<add>
<add>Ported code to es6 modules.
<add>
<ide> ### 2.9.0 [See full changelog](https://gist.github.com/ichernev/0c9a9b49951111a27ce7)
<ide>
<ide> languages: | 1 |
Python | Python | remove retry for now | 8d16638285687fd0ef41d40340ab1c5bcffd507a | <ide><path>airflow/providers/amazon/aws/operators/ecs.py
<ide> def execute(self, context):
<ide>
<ide> return None
<ide>
<del> @AwsBaseHook.retry(should_retry)
<ide> def _start_task(self):
<ide> run_opts = {
<ide> 'cluster': self.cluster, | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.