content_type stringclasses 8 values | main_lang stringclasses 7 values | message stringlengths 1 50 | sha stringlengths 40 40 | patch stringlengths 52 962k | file_count int64 1 300 |
|---|---|---|---|---|---|
Ruby | Ruby | remove unreachable code | f1df7f208fdb5afc1bf4f25320db1bef4efc0a99 | <ide><path>Library/Homebrew/cmd/info.rb
<ide> def info_formula f
<ide>
<ide> c = Caveats.new(f)
<ide> ohai 'Caveats', c.caveats unless c.empty?
<del>
<del> rescue FormulaUnavailableError
<del> # check for DIY installation
<del> d = HOMEBREW_PREFIX+name
<del> if d.directory?
<del> ohai "DIY Installation"
<del> d.children.each{ |keg| puts "#{keg} (#{keg.abv})" }
<del> else
<del> raise "No such formula or keg"
<del> end
<ide> end
<ide>
<ide> private | 1 |
Javascript | Javascript | replace lookbehind in transformeditorlink | 96e8dbc58f674629ece17675cfa1f04e6fce81d0 | <ide><path>client/src/templates/Challenges/utils/index.js
<ide> export function isGoodXHRStatus(status) {
<ide> export function transformEditorLink(url) {
<ide> return url
<ide> .replace(
<del> /(?<=\/\/)(?<projectname>[^.]+)\.(?<username>[^.]+)\.repl\.co\/?/,
<del> 'replit.com/@$<username>/$<projectname>'
<add> /(\/\/)(?<projectname>[^.]+)\.(?<username>[^.]+)\.repl\.co\/?/,
<add> '//replit.com/@$<username>/$<projectname>'
<ide> )
<ide> .replace(
<del> /(?<=\/\/)(?<projectname>[^.]+)\.glitch\.me\/?/,
<del> 'glitch.com/edit/#!/$<projectname>'
<add> /(\/\/)(?<projectname>[^.]+)\.glitch\.me\/?/,
<add> '//glitch.com/edit/#!/$<projectname>'
<ide> );
<ide> } | 1 |
Javascript | Javascript | change var to const in ./doc/html | 0808989d938b53035fb858b0e21e2984e991e7a0 | <ide><path>tools/doc/html.js
<ide> module.exports = toHTML;
<ide> const STABILITY_TEXT_REG_EXP = /(.*:)\s*(\d)([\s\S]*)/;
<ide>
<ide> // customized heading without id attribute
<del>var renderer = new marked.Renderer();
<add>const renderer = new marked.Renderer();
<ide> renderer.heading = function(text, level) {
<ide> return '<h' + level + '>' + text + '</h' + level + '>\n';
<ide> };
<ide> marked.setOptions({
<ide> });
<ide>
<ide> // TODO(chrisdickinson): never stop vomitting / fix this.
<del>var gtocPath = path.resolve(path.join(
<add>const gtocPath = path.resolve(path.join(
<ide> __dirname,
<ide> '..',
<ide> '..',
<ide> var gtocData = null;
<ide> * opts: input, filename, template, nodeVersion.
<ide> */
<ide> function toHTML(opts, cb) {
<del> var template = opts.template;
<del> var nodeVersion = opts.nodeVersion || process.version;
<add> const template = opts.template;
<add> const nodeVersion = opts.nodeVersion || process.version;
<ide>
<ide> if (gtocData) {
<ide> return onGtocLoaded();
<ide> function toHTML(opts, cb) {
<ide> }
<ide>
<ide> function onGtocLoaded() {
<del> var lexed = marked.lexer(opts.input);
<add> const lexed = marked.lexer(opts.input);
<ide> fs.readFile(template, 'utf8', function(er, template) {
<ide> if (er) return cb(er);
<ide> render({
<ide> function render(opts, cb) {
<ide> var lexed = opts.lexed;
<ide> var filename = opts.filename;
<ide> var template = opts.template;
<del> var nodeVersion = opts.nodeVersion || process.version;
<add> const nodeVersion = opts.nodeVersion || process.version;
<ide>
<ide> // get the section
<del> var section = getSection(lexed);
<add> const section = getSection(lexed);
<ide>
<ide> filename = path.basename(filename, '.md');
<ide>
<ide> function render(opts, cb) {
<ide> buildToc(lexed, filename, function(er, toc) {
<ide> if (er) return cb(er);
<ide>
<del> var id = toID(path.basename(filename));
<add> const id = toID(path.basename(filename));
<ide>
<ide> template = template.replace(/__ID__/g, id);
<ide> template = template.replace(/__FILENAME__/g, filename);
<ide> function parseText(lexed) {
<ide> // lists that come right after a heading are what we're after.
<ide> function parseLists(input) {
<ide> var state = null;
<del> var savedState = [];
<add> const savedState = [];
<ide> var depth = 0;
<del> var output = [];
<add> const output = [];
<ide> let headingIndex = -1;
<ide> let heading = null;
<ide>
<ide> function parseYAML(text) {
<ide> }
<ide>
<ide> // Syscalls which appear in the docs, but which only exist in BSD / OSX
<del>var BSD_ONLY_SYSCALLS = new Set(['lchmod']);
<add>const BSD_ONLY_SYSCALLS = new Set(['lchmod']);
<ide>
<ide> // Handle references to man pages, eg "open(2)" or "lchmod(2)"
<ide> // Returns modified text, with such refs replace with HTML links, for example
<ide> function linkManPages(text) {
<ide> / ([a-z.]+)\((\d)([a-z]?)\)/gm,
<ide> (match, name, number, optionalCharacter) => {
<ide> // name consists of lowercase letters, number is a single digit
<del> var displayAs = `${name}(${number}${optionalCharacter})`;
<add> const displayAs = `${name}(${number}${optionalCharacter})`;
<ide> if (BSD_ONLY_SYSCALLS.has(name)) {
<ide> return ` <a href="https://www.freebsd.org/cgi/man.cgi?query=${name}` +
<ide> `&sektion=${number}">${displayAs}</a>`;
<ide> function linkManPages(text) {
<ide> }
<ide>
<ide> function linkJsTypeDocs(text) {
<del> var parts = text.split('`');
<add> const parts = text.split('`');
<ide> var i;
<ide> var typeMatches;
<ide>
<ide> function buildToc(lexed, filename, cb) {
<ide> cb(null, toc);
<ide> }
<ide>
<del>var idCounters = {};
<add>const idCounters = {};
<ide> function getId(text) {
<ide> text = text.toLowerCase();
<ide> text = text.replace(/[^a-z0-9]+/g, '_'); | 1 |
Go | Go | remove some unused global variables | 58ad9177d7454893b4b5fca59e4b6b5b9e622308 | <ide><path>integration-cli/docker_cli_restart_test.go
<ide> func (s *DockerSuite) TestRestartAutoRemoveContainer(c *check.C) {
<ide>
<ide> out, _ = dockerCmd(c, "ps")
<ide> c.Assert(out, checker.Contains, id[:12], check.Commentf("container should be restarted instead of removed: %v", out))
<add>
<add> // Kill the container to make sure it will be removed
<add> dockerCmd(c, "kill", id)
<ide> }
<ide><path>integration-cli/docker_cli_run_test.go
<ide> func (s *DockerSuite) TestRunLookupGoogleDNS(c *check.C) {
<ide> // nslookup isn't present in nanoserver. Hence just use PowerShell...
<ide> dockerCmd(c, "run", WindowsBaseImage, "powershell", "Resolve-DNSName", "google.com")
<ide> } else {
<del> dockerCmd(c, "run", DefaultImage, "nslookup", "google.com")
<add> dockerCmd(c, "run", "busybox", "nslookup", "google.com")
<ide> }
<ide>
<ide> }
<ide><path>integration-cli/docker_test_vars.go
<ide> var (
<ide> // path to containerd's ctr binary
<ide> ctrBinary = "docker-containerd-ctr"
<ide>
<del> // the private registry image to use for tests involving the registry
<del> registryImageName = "registry"
<del>
<ide> // the private registry to use for tests
<ide> privateRegistryURL = "127.0.0.1:5000"
<ide>
<del> // TODO Windows CI. These are incorrect and need fixing into
<del> // platform specific pieces.
<del> runtimePath = "/var/run/docker"
<del>
<ide> workingDirectory string
<ide>
<ide> // isLocalDaemon is true if the daemon under test is on the same
<ide> var (
<ide> // not support volumes, but TP4 did.
<ide> windowsDaemonKV int
<ide>
<del> // daemonDefaultImage is the name of the default image to use when running
<del> // tests. This is platform dependent.
<del> daemonDefaultImage string
<del>
<ide> // For a local daemon on Linux, these values will be used for testing
<ide> // user namespace support as the standard graph path(s) will be
<ide> // appended with the root remapped uid.gid prefix
<ide> var (
<ide> daemonPid int
<ide> )
<ide>
<del>const (
<del> // DefaultImage is the name of the base image for the majority of tests that
<del> // are run across suites
<del> DefaultImage = "busybox"
<del>)
<del>
<ide> func init() {
<ide> reexec.Init()
<ide> if dockerBin := os.Getenv("DOCKER_BINARY"); dockerBin != "" {
<ide> func init() {
<ide> fmt.Printf("ERROR: couldn't resolve full path to the Docker binary (%v)\n", err)
<ide> os.Exit(1)
<ide> }
<del> if registryImage := os.Getenv("REGISTRY_IMAGE"); registryImage != "" {
<del> registryImageName = registryImage
<del> }
<ide> if registry := os.Getenv("REGISTRY_URL"); registry != "" {
<ide> privateRegistryURL = registry
<ide> }
<ide><path>integration-cli/docker_utils.go
<ide> func getAllVolumes() ([]*types.Volume, error) {
<ide> var protectedImages = map[string]struct{}{}
<ide>
<ide> func deleteAllImages(c *check.C) {
<del> cmd := exec.Command(dockerBinary, "images")
<add> cmd := exec.Command(dockerBinary, "images", "--digests")
<ide> cmd.Env = appendBaseEnv(true)
<ide> out, err := cmd.CombinedOutput()
<ide> c.Assert(err, checker.IsNil)
<ide> lines := strings.Split(string(out), "\n")[1:]
<del> var imgs []string
<add> imgMap := map[string]struct{}{}
<ide> for _, l := range lines {
<ide> if l == "" {
<ide> continue
<ide> func deleteAllImages(c *check.C) {
<ide> imgTag := fields[0] + ":" + fields[1]
<ide> if _, ok := protectedImages[imgTag]; !ok {
<ide> if fields[0] == "<none>" || fields[1] == "<none>" {
<del> imgs = append(imgs, fields[2])
<del> continue
<add> if fields[2] != "<none>" {
<add> imgMap[fields[0]+"@"+fields[2]] = struct{}{}
<add> } else {
<add> imgMap[fields[3]] = struct{}{}
<add> }
<add> // continue
<add> } else {
<add> imgMap[imgTag] = struct{}{}
<ide> }
<del> imgs = append(imgs, imgTag)
<ide> }
<ide> }
<del> if len(imgs) != 0 {
<add> if len(imgMap) != 0 {
<add> imgs := make([]string, 0, len(imgMap))
<add> for k := range imgMap {
<add> imgs = append(imgs, k)
<add> }
<ide> dockerCmd(c, append([]string{"rmi", "-f"}, imgs...)...)
<ide> }
<ide> } | 4 |
Go | Go | fix typo creats into creates in comments | 0d459f5ed3138f6273c4f10d4796197faaf1ad2d | <ide><path>api/client/container/attach.go
<ide> type attachOptions struct {
<ide> container string
<ide> }
<ide>
<del>// NewAttachCommand creats a new cobra.Command for `docker attach`
<add>// NewAttachCommand creates a new cobra.Command for `docker attach`
<ide> func NewAttachCommand(dockerCli *client.DockerCli) *cobra.Command {
<ide> var opts attachOptions
<ide>
<ide><path>api/client/container/commit.go
<ide> type commitOptions struct {
<ide> config string
<ide> }
<ide>
<del>// NewCommitCommand creats a new cobra.Command for `docker commit`
<add>// NewCommitCommand creates a new cobra.Command for `docker commit`
<ide> func NewCommitCommand(dockerCli *client.DockerCli) *cobra.Command {
<ide> var opts commitOptions
<ide>
<ide><path>api/client/container/create.go
<ide> type createOptions struct {
<ide> name string
<ide> }
<ide>
<del>// NewCreateCommand creats a new cobra.Command for `docker create`
<add>// NewCreateCommand creates a new cobra.Command for `docker create`
<ide> func NewCreateCommand(dockerCli *client.DockerCli) *cobra.Command {
<ide> var opts createOptions
<ide> var copts *runconfigopts.ContainerOptions
<ide><path>api/client/container/kill.go
<ide> type killOptions struct {
<ide> containers []string
<ide> }
<ide>
<del>// NewKillCommand creats a new cobra.Command for `docker kill`
<add>// NewKillCommand creates a new cobra.Command for `docker kill`
<ide> func NewKillCommand(dockerCli *client.DockerCli) *cobra.Command {
<ide> var opts killOptions
<ide>
<ide><path>api/client/container/logs.go
<ide> type logsOptions struct {
<ide> container string
<ide> }
<ide>
<del>// NewLogsCommand creats a new cobra.Command for `docker logs`
<add>// NewLogsCommand creates a new cobra.Command for `docker logs`
<ide> func NewLogsCommand(dockerCli *client.DockerCli) *cobra.Command {
<ide> var opts logsOptions
<ide>
<ide><path>api/client/container/pause.go
<ide> type pauseOptions struct {
<ide> containers []string
<ide> }
<ide>
<del>// NewPauseCommand creats a new cobra.Command for `docker pause`
<add>// NewPauseCommand creates a new cobra.Command for `docker pause`
<ide> func NewPauseCommand(dockerCli *client.DockerCli) *cobra.Command {
<ide> var opts pauseOptions
<ide>
<ide><path>api/client/container/port.go
<ide> type portOptions struct {
<ide> port string
<ide> }
<ide>
<del>// NewPortCommand creats a new cobra.Command for `docker port`
<add>// NewPortCommand creates a new cobra.Command for `docker port`
<ide> func NewPortCommand(dockerCli *client.DockerCli) *cobra.Command {
<ide> var opts portOptions
<ide>
<ide><path>api/client/container/rename.go
<ide> type renameOptions struct {
<ide> newName string
<ide> }
<ide>
<del>// NewRenameCommand creats a new cobra.Command for `docker rename`
<add>// NewRenameCommand creates a new cobra.Command for `docker rename`
<ide> func NewRenameCommand(dockerCli *client.DockerCli) *cobra.Command {
<ide> var opts renameOptions
<ide>
<ide><path>api/client/container/start.go
<ide> type startOptions struct {
<ide> containers []string
<ide> }
<ide>
<del>// NewStartCommand creats a new cobra.Command for `docker start`
<add>// NewStartCommand creates a new cobra.Command for `docker start`
<ide> func NewStartCommand(dockerCli *client.DockerCli) *cobra.Command {
<ide> var opts startOptions
<ide>
<ide><path>api/client/container/stats.go
<ide> type statsOptions struct {
<ide> containers []string
<ide> }
<ide>
<del>// NewStatsCommand creats a new cobra.Command for `docker stats`
<add>// NewStatsCommand creates a new cobra.Command for `docker stats`
<ide> func NewStatsCommand(dockerCli *client.DockerCli) *cobra.Command {
<ide> var opts statsOptions
<ide>
<ide><path>api/client/container/stop.go
<ide> type stopOptions struct {
<ide> containers []string
<ide> }
<ide>
<del>// NewStopCommand creats a new cobra.Command for `docker stop`
<add>// NewStopCommand creates a new cobra.Command for `docker stop`
<ide> func NewStopCommand(dockerCli *client.DockerCli) *cobra.Command {
<ide> var opts stopOptions
<ide>
<ide><path>api/client/container/unpause.go
<ide> type unpauseOptions struct {
<ide> containers []string
<ide> }
<ide>
<del>// NewUnpauseCommand creats a new cobra.Command for `docker unpause`
<add>// NewUnpauseCommand creates a new cobra.Command for `docker unpause`
<ide> func NewUnpauseCommand(dockerCli *client.DockerCli) *cobra.Command {
<ide> var opts unpauseOptions
<ide>
<ide><path>api/client/container/update.go
<ide> type updateOptions struct {
<ide> containers []string
<ide> }
<ide>
<del>// NewUpdateCommand creats a new cobra.Command for `docker update`
<add>// NewUpdateCommand creates a new cobra.Command for `docker update`
<ide> func NewUpdateCommand(dockerCli *client.DockerCli) *cobra.Command {
<ide> var opts updateOptions
<ide>
<ide><path>api/client/system/events.go
<ide> type eventsOptions struct {
<ide> filter []string
<ide> }
<ide>
<del>// NewEventsCommand creats a new cobra.Command for `docker events`
<add>// NewEventsCommand creates a new cobra.Command for `docker events`
<ide> func NewEventsCommand(dockerCli *client.DockerCli) *cobra.Command {
<ide> var opts eventsOptions
<ide>
<ide><path>api/client/system/version.go
<ide> type versionOptions struct {
<ide> format string
<ide> }
<ide>
<del>// NewVersionCommand creats a new cobra.Command for `docker version`
<add>// NewVersionCommand creates a new cobra.Command for `docker version`
<ide> func NewVersionCommand(dockerCli *client.DockerCli) *cobra.Command {
<ide> var opts versionOptions
<ide> | 15 |
Mixed | Go | add documentation and update restart rules | 860c13b788944410a98a6ad5b5cfb74de0a8405b | <ide><path>daemon/monitor.go
<ide> import (
<ide> "github.com/docker/docker/utils"
<ide> )
<ide>
<add>const defaultTimeIncrement = 100
<add>
<ide> // containerMonitor monitors the execution of a container's main process.
<ide> // If a restart policy is specified for the cotnainer the monitor will ensure that the
<ide> // process is restarted based on the rules of the policy. When the container is finally stopped
<ide> import (
<ide> type containerMonitor struct {
<ide> mux sync.Mutex
<ide>
<del> container *Container
<add> // container is the container being monitored
<add> container *Container
<add>
<add> // restartPolicy is the being applied to the container monitor
<ide> restartPolicy runconfig.RestartPolicy
<del> failureCount int
<del> shouldStop bool
<add>
<add> // failureCount is the number of times the container has failed to
<add> // start in a row
<add> failureCount int
<add>
<add> // shouldStop signals the monitor that the next time the container exits it is
<add> // either because docker or the user asked for the container to be stopped
<add> shouldStop bool
<add>
<add> // timeIncrement is the amount of time to wait between restarts
<add> // this is in milliseconds
<add> timeIncrement int
<ide> }
<ide>
<ide> func newContainerMonitor(container *Container, policy runconfig.RestartPolicy) *containerMonitor {
<ide> return &containerMonitor{
<ide> container: container,
<ide> restartPolicy: policy,
<add> timeIncrement: defaultTimeIncrement,
<ide> }
<ide> }
<ide>
<ide> func (m *containerMonitor) Close() error {
<ide>
<ide> // reset resets the container's IO and ensures that the command is able to be executed again
<ide> // by copying the data into a new struct
<del>func (m *containerMonitor) reset() {
<add>func (m *containerMonitor) reset(successful bool) {
<ide> container := m.container
<ide>
<ide> if container.Config.OpenStdin {
<ide> func (m *containerMonitor) reset() {
<ide> Dir: c.Dir,
<ide> SysProcAttr: c.SysProcAttr,
<ide> }
<add>
<add> // the container exited successfully so we need to reset the failure counter
<add> // and the timeIncrement back to the default values
<add> if successful {
<add> m.failureCount = 0
<add> m.timeIncrement = defaultTimeIncrement
<add> } else {
<add> // otherwise we need to increment the amount of time we wait before restarting
<add> // the process. We will build up by multiplying the increment by 2
<add>
<add> m.failureCount++
<add> m.timeIncrement *= 2
<add> }
<ide> }
<ide>
<ide> // Start starts the containers process and monitors it according to the restart policy
<ide> func (m *containerMonitor) Start() error {
<ide> var (
<del> err error
<del> exitCode int
<add> err error
<add> exitStatus int
<ide> )
<add>
<add> // ensure that when the monitor finally exits we release the networking and unmount the rootfs
<ide> defer m.Close()
<ide>
<ide> // reset the restart count
<ide> m.container.RestartCount = -1
<ide>
<ide> for !m.shouldStop {
<ide> m.container.RestartCount++
<add>
<ide> if err := m.container.startLoggingToDisk(); err != nil {
<del> m.reset()
<add> m.reset(false)
<ide>
<ide> return err
<ide> }
<ide>
<ide> pipes := execdriver.NewPipes(m.container.stdin, m.container.stdout, m.container.stderr, m.container.Config.OpenStdin)
<ide>
<del> if exitCode, err = m.container.daemon.Run(m.container, pipes, m.callback); err != nil {
<del> m.failureCount++
<del>
<del> if m.failureCount == m.restartPolicy.MaximumRetryCount {
<del> m.ExitOnNext()
<del> }
<del>
<add> if exitStatus, err = m.container.daemon.Run(m.container, pipes, m.callback); err != nil {
<ide> utils.Errorf("Error running container: %s", err)
<ide> }
<ide>
<ide> // We still wait to set the state as stopped and ensure that the locks were released
<del> m.container.State.SetStopped(exitCode)
<add> m.container.State.SetStopped(exitStatus)
<ide>
<del> m.reset()
<add> m.reset(err == nil && exitStatus == 0)
<ide>
<del> if m.shouldRestart(exitCode) {
<del> time.Sleep(1 * time.Second)
<add> if m.shouldRestart(exitStatus) {
<add> time.Sleep(time.Duration(m.timeIncrement) * time.Millisecond)
<ide>
<ide> continue
<ide> }
<ide> func (m *containerMonitor) Start() error {
<ide> return err
<ide> }
<ide>
<del>func (m *containerMonitor) shouldRestart(exitCode int) bool {
<add>// shouldRestart checks the restart policy and applies the rules to determine if
<add>// the container's process should be restarted
<add>func (m *containerMonitor) shouldRestart(exitStatus int) bool {
<ide> m.mux.Lock()
<add> defer m.mux.Unlock()
<add>
<add> // do not restart if the user or docker has requested that this container be stopped
<add> if m.shouldStop {
<add> return false
<add> }
<ide>
<del> shouldRestart := (m.restartPolicy.Name == "always" ||
<del> (m.restartPolicy.Name == "on-failure" && exitCode != 0)) &&
<del> !m.shouldStop
<add> switch m.restartPolicy.Name {
<add> case "always":
<add> return true
<add> case "on-failure":
<add> // the default value of 0 for MaximumRetryCount means that we will not enforce a maximum count
<add> if max := m.restartPolicy.MaximumRetryCount; max != 0 && m.failureCount >= max {
<add> utils.Debugf("stopping restart of container %s because maximum failure could of %d has been reached", max)
<add> return false
<add> }
<ide>
<del> m.mux.Unlock()
<add> return exitStatus != 0
<add> }
<ide>
<del> return shouldRestart
<add> return false
<ide> }
<ide>
<ide> // callback ensures that the container's state is properly updated after we
<ide><path>docs/sources/reference/commandline/cli.md
<ide> removed before the image is removed.
<ide> format: ip:hostPort:containerPort | ip::containerPort | hostPort:containerPort
<ide> (use 'docker port' to see the actual mapping)
<ide> --privileged=false Give extended privileges to this container
<add> --restart="" Restart policy to apply when a container exits (no, on-failure, always)
<ide> --rm=false Automatically remove the container when it exits (incompatible with -d)
<ide> --sig-proxy=true Proxy received signals to the process (even in non-TTY mode). SIGCHLD, SIGSTOP, and SIGKILL are not proxied.
<ide> -t, --tty=false Allocate a pseudo-TTY
<ide> application change:
<ide> `--rm` option means that when the container exits, the container's layer is
<ide> removed.
<ide>
<add>#### Restart Policies
<add>
<add>Using the `--restart` flag on docker run you can specify a restart policy for
<add>how a container should or should not be restarted on exit.
<add>
<add>** no ** - Do not restart the container when it exits.
<add>
<add>** on-failure ** - Restart the container only if it exits with a non zero exit status.
<add>
<add>** always ** - Always restart the container reguardless of the exit status.
<add>
<add>You can also specify the maximum amount of times docker will try to restart the
<add>container when using the ** on-failure ** policy. The default is that docker will try forever to restart the container.
<add>
<add> $ sudo docker run --restart=always redis
<add>
<add>This will run the redis container with a restart policy of ** always ** so that if
<add>the container exits, docker will restart it.
<add>
<add> $ sudo docker run --restart=on-failure:10 redis
<add>
<add>This will run the redis container with a restart policy of ** on-failure ** and a
<add>maximum restart count of 10. If the redis container exits with a non-zero exit
<add>status more than 10 times in a row docker will abort trying to restart the container.
<add>
<ide> ## save
<ide>
<ide> Usage: docker save IMAGE
<ide><path>runconfig/parse.go
<ide> import (
<ide> )
<ide>
<ide> var (
<del> ErrInvalidWorkingDirectory = fmt.Errorf("The working directory is invalid. It needs to be an absolute path.")
<del> ErrConflictAttachDetach = fmt.Errorf("Conflicting options: -a and -d")
<del> ErrConflictDetachAutoRemove = fmt.Errorf("Conflicting options: --rm and -d")
<del> ErrConflictNetworkHostname = fmt.Errorf("Conflicting options: -h and the network mode (--net)")
<del> ErrConflictHostNetworkAndLinks = fmt.Errorf("Conflicting options: --net=host can't be used with links. This would result in undefined behavior.")
<add> ErrInvalidWorkingDirectory = fmt.Errorf("The working directory is invalid. It needs to be an absolute path.")
<add> ErrConflictAttachDetach = fmt.Errorf("Conflicting options: -a and -d")
<add> ErrConflictDetachAutoRemove = fmt.Errorf("Conflicting options: --rm and -d")
<add> ErrConflictNetworkHostname = fmt.Errorf("Conflicting options: -h and the network mode (--net)")
<add> ErrConflictHostNetworkAndLinks = fmt.Errorf("Conflicting options: --net=host can't be used with links. This would result in undefined behavior.")
<add> ErrConflictRestartPolicyAndAutoRemove = fmt.Errorf("Conflicting options: --restart and --rm")
<ide> )
<ide>
<ide> //FIXME Only used in tests
<ide> func parseRun(cmd *flag.FlagSet, args []string, sysInfo *sysinfo.SysInfo) (*Conf
<ide> flCpuShares = cmd.Int64([]string{"c", "-cpu-shares"}, 0, "CPU shares (relative weight)")
<ide> flCpuset = cmd.String([]string{"-cpuset"}, "", "CPUs in which to allow execution (0-3, 0,1)")
<ide> flNetMode = cmd.String([]string{"-net"}, "bridge", "Set the Network mode for the container\n'bridge': creates a new network stack for the container on the docker bridge\n'none': no networking for this container\n'container:<name|id>': reuses another container network stack\n'host': use the host network stack inside the container. Note: the host mode gives the container full access to local system services such as D-bus and is therefore considered insecure.")
<del> flRestartPolicy = cmd.String([]string{"-restart"}, "", "Restart policy when the dies")
<add> flRestartPolicy = cmd.String([]string{"-restart"}, "", "Restart policy to apply when a container exits (no, on-failure, always)")
<ide> // For documentation purpose
<ide> _ = cmd.Bool([]string{"#sig-proxy", "-sig-proxy"}, true, "Proxy received signals to the process (even in non-TTY mode). SIGCHLD, SIGSTOP, and SIGKILL are not proxied.")
<ide> _ = cmd.String([]string{"#name", "-name"}, "", "Assign a name to the container")
<ide> func parseRun(cmd *flag.FlagSet, args []string, sysInfo *sysinfo.SysInfo) (*Conf
<ide> }
<ide> // parse the '-e' and '--env' after, to allow override
<ide> envVariables = append(envVariables, flEnv.GetAll()...)
<del> // boo, there's no debug output for docker run
<del> //log.Debugf("Environment variables for the container: %#v", envVariables)
<ide>
<ide> netMode, err := parseNetMode(*flNetMode)
<ide> if err != nil {
<ide> func parseRun(cmd *flag.FlagSet, args []string, sysInfo *sysinfo.SysInfo) (*Conf
<ide> return nil, nil, cmd, err
<ide> }
<ide>
<add> if *flAutoRemove && (restartPolicy.Name == "always" || restartPolicy.Name == "on-failure") {
<add> return nil, nil, cmd, ErrConflictRestartPolicyAndAutoRemove
<add> }
<add>
<ide> config := &Config{
<ide> Hostname: hostname,
<ide> Domainname: domainname,
<ide> func parseRestartPolicy(policy string) (RestartPolicy, error) {
<ide> )
<ide>
<ide> switch name {
<del> case "no", "on-failure", "always":
<add> case "always":
<add> p.Name = name
<add>
<add> if len(parts) == 2 {
<add> return p, fmt.Errorf("maximum restart count not valid with restart policy of \"always\"")
<add> }
<add> case "no":
<add> // do nothing
<add> case "on-failure":
<ide> p.Name = name
<ide>
<ide> if len(parts) == 2 { | 3 |
PHP | PHP | remove unused local vars | 16be9d499094b1effad9ab61a80c28fa06438587 | <ide><path>lib/Cake/Console/Command/Task/TestTask.php
<ide> protected function _processModel($subject) {
<ide> }
<ide> if ($type == 'hasAndBelongsToMany') {
<ide> if (!empty($subject->hasAndBelongsToMany[$alias]['with'])) {
<del> list($plugin, $joinModel) = pluginSplit($subject->hasAndBelongsToMany[$alias]['with']);
<add> list(, $joinModel) = pluginSplit($subject->hasAndBelongsToMany[$alias]['with']);
<ide> } else {
<ide> $joinModel = Inflector::classify($subject->hasAndBelongsToMany[$alias]['joinTable']);
<ide> }
<ide> protected function _processController($subject) {
<ide> $models = $subject->uses;
<ide> }
<ide> foreach ($models as $model) {
<del> list($plugin, $model) = pluginSplit($model);
<add> list(, $model) = pluginSplit($model);
<ide> $this->_processModel($subject->{$model});
<ide> }
<ide> }
<ide><path>lib/Cake/Model/Datasource/DboSource.php
<ide> public function conditionKeysToString($conditions, $quoteValues = true, $model =
<ide> if (is_numeric($key) && empty($value)) {
<ide> continue;
<ide> } elseif (is_numeric($key) && is_string($value)) {
<del> $out[] = $not . $this->_quoteFields($value);
<add> $out[] = $this->_quoteFields($value);
<ide> } elseif ((is_numeric($key) && is_array($value)) || in_array(strtolower(trim($key)), $bool)) {
<ide> if (in_array(strtolower(trim($key)), $bool)) {
<ide> $join = ' ' . strtoupper($key) . ' ';
<ide><path>lib/Cake/Model/Model.php
<ide> public function save($data = null, $validate = true, $fieldList = array()) {
<ide> $fields = array();
<ide>
<ide> if (!is_array($validate)) {
<del> $options = array_merge($defaults, compact('validate', 'fieldList', 'callbacks'));
<add> $options = array_merge($defaults, compact('validate', 'fieldList'));
<ide> } else {
<ide> $options = array_merge($defaults, $validate);
<ide> }
<ide><path>lib/Cake/Test/Case/Cache/CacheTest.php
<ide> public function testInvalidConfig() {
<ide> 'serialize' => true,
<ide> 'random' => 'wii'
<ide> ));
<del> $read = Cache::read('Test', 'invalid');
<add> Cache::read('Test', 'invalid');
<ide> }
<ide>
<ide> /**
<ide> public function testSet() {
<ide>
<ide> Cache::delete('test_cache');
<ide>
<del> $global = Cache::settings();
<add> Cache::settings();
<ide>
<ide> Cache::set($_cacheSet);
<ide> }
<ide><path>lib/Cake/Test/Case/Cache/Engine/FileEngineTest.php
<ide> public function testSerialize() {
<ide>
<ide> $newread = Cache::read('serialize_test', 'file_test');
<ide>
<del> $delete = Cache::delete('serialize_test', 'file_test');
<add> Cache::delete('serialize_test', 'file_test');
<ide>
<ide> $this->assertSame($read, serialize($data));
<ide>
<ide><path>lib/Cake/Test/Case/Console/Command/AclShellTest.php
<ide> public function testViewWithArgument() {
<ide> public function testParsingModelAndForeignKey() {
<ide> $result = $this->Task->parseIdentifier('Model.foreignKey');
<ide> $expected = array('model' => 'Model', 'foreign_key' => 'foreignKey');
<add> $this->assertEquals($expected, $result);
<ide>
<ide> $result = $this->Task->parseIdentifier('mySuperUser');
<ide> $this->assertEquals('mySuperUser', $result);
<ide><path>lib/Cake/Test/Case/Console/Command/SchemaShellTest.php
<ide> public function testGenerateNoOverwrite() {
<ide> $this->Shell->Schema->path = TMP;
<ide> $this->Shell->Schema->expects($this->never())->method('read');
<ide>
<del> $result = $this->Shell->generate();
<add> $this->Shell->generate();
<ide> unlink(TMP . 'schema.php');
<ide> }
<ide>
<ide><path>lib/Cake/Test/Case/Console/Command/Task/DbConfigTaskTest.php
<ide> public function testExecuteIntoInteractive() {
<ide> )
<ide> ));
<ide>
<del> $result = $this->Task->execute();
<add> $this->Task->execute();
<ide> }
<ide> }
<ide><path>lib/Cake/Test/Case/Console/Command/Task/ExtractTaskTest.php
<ide> public function setUp() {
<ide> array($out, $out, $in)
<ide> );
<ide> $this->path = TMP . 'tests' . DS . 'extract_task_test';
<del> $Folder = new Folder($this->path . DS . 'locale', true);
<add> new Folder($this->path . DS . 'locale', true);
<ide> }
<ide>
<ide> /**
<ide><path>lib/Cake/Test/Case/Console/Command/Task/FixtureTaskTest.php
<ide> public function testGeneratePluginFixtureFile() {
<ide> $this->Task->expects($this->at(0))->method('createFile')
<ide> ->with($filename, $this->stringContains('class Article'));
<ide>
<del> $result = $this->Task->generateFixtureFile('Article', array());
<add> $this->Task->generateFixtureFile('Article', array());
<ide> CakePlugin::unload();
<ide> }
<ide>
<ide><path>lib/Cake/Test/Case/Console/Command/Task/ModelTaskTest.php
<ide> public function testGetNameWithOutOfBoundsOption() {
<ide> $this->Task->expects($this->any())->method('in')->will($this->onConsecutiveCalls(99, 1));
<ide> $this->Task->expects($this->once())->method('err');
<ide>
<del> $result = $this->Task->getName('test');
<add> $this->Task->getName('test');
<ide> }
<ide>
<ide> /**
<ide><path>lib/Cake/Test/Case/Console/Command/Task/TestTaskTest.php
<ide> public function testRegistryClearWhenBuildingTestObjects() {
<ide> ));
<ide> $keys = ClassRegistry::keys();
<ide> $this->assertTrue(in_array('test_task_comment', $keys));
<del> $object = $this->Task->buildTestSubject('Model', 'TestTaskComment');
<add> $this->Task->buildTestSubject('Model', 'TestTaskComment');
<ide>
<ide> $keys = ClassRegistry::keys();
<ide> $this->assertFalse(in_array('random', $keys));
<ide><path>lib/Cake/Test/Case/Console/ConsoleOptionParserTest.php
<ide> public function testOptionThatDoesNotExist() {
<ide> $parser = new ConsoleOptionParser('test', false);
<ide> $parser->addOption('no-commit', array('boolean' => true));
<ide>
<del> $result = $parser->parse(array('--fail', 'other'));
<add> $parser->parse(array('--fail', 'other'));
<ide> }
<ide>
<ide> /**
<ide> public function testShortOptionThatDoesNotExist() {
<ide> $parser = new ConsoleOptionParser('test', false);
<ide> $parser->addOption('no-commit', array('boolean' => true));
<ide>
<del> $result = $parser->parse(array('-f'));
<add> $parser->parse(array('-f'));
<ide> }
<ide>
<ide> /**
<ide><path>lib/Cake/Test/Case/Console/ShellTest.php
<ide> public function testCreateFileNonInteractive() {
<ide> $path = TMP . 'shell_test';
<ide> $file = $path . DS . 'file1.php';
<ide>
<del> $Folder = new Folder($path, true);
<add> new Folder($path, true);
<ide>
<ide> $this->Shell->interactive = false;
<ide>
<ide> public function testCreateFileInteractive() {
<ide>
<ide> $path = TMP . 'shell_test';
<ide> $file = $path . DS . 'file1.php';
<del> $Folder = new Folder($path, true);
<add> new Folder($path, true);
<ide>
<ide> $this->Shell->interactive = true;
<ide>
<ide> public function testHasMethod() {
<ide> * @return void
<ide> */
<ide> public function testRunCommandMain() {
<del> $methods = get_class_methods('Shell');
<ide> $Mock = $this->getMock('Shell', array('main', 'startup'), array(), '', false);
<ide>
<ide> $Mock->expects($this->once())->method('main')->will($this->returnValue(true));
<ide> public function testRunCommandMain() {
<ide> * @return void
<ide> */
<ide> public function testRunCommandWithMethod() {
<del> $methods = get_class_methods('Shell');
<ide> $Mock = $this->getMock('Shell', array('hit_me', 'startup'), array(), '', false);
<ide>
<ide> $Mock->expects($this->once())->method('hit_me')->will($this->returnValue(true));
<ide> public function testRunCommandBaseclassMethod() {
<ide> $Mock->expects($this->never())->method('hr');
<ide> $Mock->expects($this->once())->method('out');
<ide>
<del> $result = $Mock->runCommand('hr', array());
<add> $Mock->runCommand('hr', array());
<ide> }
<ide>
<ide> /**
<ide> public function testRunCommandBaseclassMethod() {
<ide> * @return void
<ide> */
<ide> public function testRunCommandMissingMethod() {
<del> $methods = get_class_methods('Shell');
<ide> $Mock = $this->getMock('Shell', array('startup', 'getOptionParser', 'out'), array(), '', false);
<ide> $Parser = $this->getMock('ConsoleOptionParser', array(), array(), '', false);
<ide>
<ide> public function testRunCommandHittingTask() {
<ide>
<ide> $Shell->RunCommand = $task;
<ide>
<del> $result = $Shell->runCommand('run_command', array('run_command', 'one', 'value'));
<add> $Shell->runCommand('run_command', array('run_command', 'one', 'value'));
<ide> }
<ide>
<ide> /**
<ide><path>lib/Cake/Test/Case/Console/TaskCollectionTest.php
<ide> public function testLoadWithEnableFalse() {
<ide> * @return void
<ide> */
<ide> public function testLoadMissingTask() {
<del> $result = $this->Tasks->load('ThisTaskShouldAlwaysBeMissing');
<add> $this->Tasks->load('ThisTaskShouldAlwaysBeMissing');
<ide> }
<ide>
<ide> /**
<ide><path>lib/Cake/Test/Case/Controller/Component/Acl/DbAclTest.php
<ide> protected function _debug($printTreesToo = false) {
<ide> $values = array_map(array(&$this, '_pad'), $values);
<ide> $permissions[$key] = implode (' ', $values);
<ide> }
<del> $permisssions = array_map(array(&$this, '_pad'), $permissions);
<add> $permissions = array_map(array(&$this, '_pad'), $permissions);
<ide> array_unshift($permissions, 'Current Permissions :');
<ide> if ($printTreesToo) {
<ide> debug(array('aros' => $this->Acl->Aro->generateTreeList(), 'acos' => $this->Acl->Aco->generateTreeList()));
<ide><path>lib/Cake/Test/Case/Controller/Component/Acl/PhpAclTest.php
<ide> public function testAddRole() {
<ide> }
<ide>
<ide> public function testAroResolve() {
<del> $map = $this->Acl->Aro->map;
<ide> $this->Acl->Aro->map = array(
<ide> 'User' => 'FooModel/nickname',
<ide> 'Role' => 'FooModel/role',
<ide><path>lib/Cake/Test/Case/Controller/Component/AclComponentTest.php
<ide> public function tearDown() {
<ide> public function testConstrutorException() {
<ide> Configure::write('Acl.classname', 'AclClassNameThatDoesNotExist');
<ide> $Collection = new ComponentCollection();
<del> $acl = new AclComponent($Collection);
<add> new AclComponent($Collection);
<ide> }
<ide>
<ide> /**
<ide><path>lib/Cake/Test/Case/Controller/Component/RequestHandlerComponentTest.php
<ide> public function testBeforeRedirectCallingHeader() {
<ide>
<ide> ob_start();
<ide> $RequestHandler->beforeRedirect($controller, 'request_handler_test/param_method/first/second', 403);
<del> $result = ob_get_clean();
<add> ob_get_clean();
<ide> }
<ide>
<ide> /**
<ide><path>lib/Cake/Test/Case/Controller/Component/SecurityComponentTest.php
<ide> public function testValidatePostCheckbox() {
<ide> $this->Controller->Security->startup($this->Controller);
<ide> $key = $this->Controller->request->params['_Token']['key'];
<ide>
<del> $this->Controller->request->data = $data = array(
<add> $this->Controller->request->data = array(
<ide> 'Model' => array('username' => '', 'password' => '', 'valid' => '0'),
<ide> '_Token' => compact('key', 'fields', 'unlocked')
<ide> );
<ide> public function testCsrfSettingMultipleNonces() {
<ide>
<ide> $token = $this->Security->Session->read('_Token');
<ide> $this->assertEquals(2, count($token['csrfTokens']), 'Missing the csrf token.');
<del> foreach ($token['csrfTokens'] as $key => $expires) {
<add> foreach ($token['csrfTokens'] as $expires) {
<ide> $diff = $csrfExpires - $expires;
<ide> $this->assertTrue($diff === 0 || $diff === 1, 'Token expiry does not match');
<ide> }
<ide><path>lib/Cake/Test/Case/Controller/ScaffoldTest.php
<ide> public function testScaffoldChangingViewProperty() {
<ide> $this->Controller->theme = 'TestTheme';
<ide> $this->Controller->viewClass = 'Theme';
<ide> $this->Controller->constructClasses();
<del> $Scaffold = new TestScaffoldMock($this->Controller, $this->Controller->request);
<add> new TestScaffoldMock($this->Controller, $this->Controller->request);
<ide>
<ide> $this->assertEquals('Scaffold', $this->Controller->viewClass);
<ide> }
<ide><path>lib/Cake/Test/Case/Core/ConfigureTest.php
<ide> public function testCheckEmpty() {
<ide> */
<ide> public function testLoadExceptionOnNonExistantFile() {
<ide> Configure::config('test', new PhpReader());
<del> $result = Configure::load('non_existing_configuration_file', 'test');
<add> Configure::load('non_existing_configuration_file', 'test');
<ide> }
<ide>
<ide> /**
<ide><path>lib/Cake/Test/Case/Core/ObjectTest.php
<ide> public function return_here() {
<ide> * @return void
<ide> */
<ide> public function paginate_request_action() {
<del> $data = $this->paginate();
<add> $this->paginate();
<ide> return true;
<ide> }
<ide>
<ide><path>lib/Cake/Test/Case/Error/ExceptionRendererTest.php
<ide> public function testExceptionResponseHeader() {
<ide> $ExceptionRenderer->controller->response->expects($this->at(1))->method('_sendHeader')->with('Allow', 'POST, DELETE');
<ide> ob_start();
<ide> $ExceptionRenderer->render();
<del> $result = ob_get_clean();
<add> ob_get_clean();
<ide> }
<ide>
<ide> /**
<ide><path>lib/Cake/Test/Case/Log/CakeLogTest.php
<ide> public function testCustomLevelWrites() {
<ide> $this->_deleteLogs();
<ide> $this->_resetLogConfig();
<ide>
<del> $levels = CakeLog::levels(array('spam', 'eggs'));
<add> CakeLog::levels(array('spam', 'eggs'));
<ide>
<ide> $testMessage = 'error message';
<ide> CakeLog::write('error', $testMessage);
<ide><path>lib/Cake/Test/Case/Model/Behavior/ContainableBehaviorTest.php
<ide> public function testContainments() {
<ide> * @return void
<ide> */
<ide> public function testInvalidContainments() {
<del> $r = $this->_containments($this->Article, array('Comment', 'InvalidBinding'));
<add> $this->_containments($this->Article, array('Comment', 'InvalidBinding'));
<ide> }
<ide>
<ide> /**
<ide> public function testInvalidContainments() {
<ide> */
<ide> public function testInvalidContainmentsNoNotices() {
<ide> $this->Article->Behaviors->attach('Containable', array('notices' => false));
<del> $r = $this->_containments($this->Article, array('Comment', 'InvalidBinding'));
<add> $this->_containments($this->Article, array('Comment', 'InvalidBinding'));
<ide> }
<ide>
<ide> /**
<ide> public function testBeforeFind() {
<ide> * @return void
<ide> */
<ide> public function testBeforeFindWithNonExistingBinding() {
<del> $r = $this->Article->find('all', array('contain' => array('Comment' => 'NonExistingBinding')));
<add> $this->Article->find('all', array('contain' => array('Comment' => 'NonExistingBinding')));
<ide> }
<ide>
<ide> /**
<ide> public function testOriginalAssociations() {
<ide>
<ide> $firstResult = $this->Article->Comment->find('all', $options);
<ide>
<del> $dummyResult = $this->Article->Comment->find('all', array(
<add> $this->Article->Comment->find('all', array(
<ide> 'conditions' => array(
<ide> 'User.user' => 'mariano'
<ide> ),
<ide><path>lib/Cake/Test/Case/Model/BehaviorCollectionTest.php
<ide> public function testInvalidBehaviorCausingCakeError() {
<ide> */
<ide> public function testBehaviorToggling() {
<ide> $Apple = new Apple();
<del> $expected = $Apple->find('all');
<ide> $this->assertSame($Apple->Behaviors->enabled(), array());
<ide>
<ide> $Apple->Behaviors->init('Apple', array('Test' => array('key' => 'value')));
<ide> public function testBehaviorHasManyFindCallbacks() {
<ide> $Apple->Child->Behaviors->attach('Test', array('before' => 'test'));
<ide> $this->assertSame($expected, $Apple->find('all'));
<ide>
<del> $expected2 = array(
<del> array(
<del> 'Apple' => array('id' => 1),
<del> 'Child' => array(
<del> array('id' => 2, 'name' => 'Bright Red Apple', 'mytime' => '22:57:17'))),
<del> array(
<del> 'Apple' => array('id' => 2),
<del> 'Child' => array(
<del> array('id' => 1, 'name' => 'Red Apple 1', 'mytime' => '22:57:17'),
<del> array('id' => 3, 'name' => 'green blue', 'mytime' => '22:57:17'),
<del> array('id' => 4, 'name' => 'Test Name', 'mytime' => '22:57:17'))),
<del> array(
<del> 'Apple' => array('id' => 3),
<del> 'Child' => array())
<del> );
<del>
<ide> $Apple->Child->Behaviors->attach('Test', array('before' => 'modify'));
<ide> $result = $Apple->find('all', array('fields' => array('Apple.id'), 'conditions' => array('Apple.id <' => '4')));
<ide>
<ide> public function testBehaviorAttachAndDetach() {
<ide> * @return void
<ide> */
<ide> public function testHasMethodBasic() {
<del> $Sample = new Sample();
<add> new Sample();
<ide> $Collection = new BehaviorCollection();
<ide> $Collection->init('Sample', array('Test', 'Test2'));
<ide>
<ide> public function testHasMethodBasic() {
<ide> * @return void
<ide> */
<ide> public function testHasMethodMappedMethods() {
<del> $Sample = new Sample();
<add> new Sample();
<ide> $Collection = new BehaviorCollection();
<ide> $Collection->init('Sample', array('Test', 'Test2'));
<ide>
<ide> public function testHasMethodMappedMethods() {
<ide> * @return void
<ide> */
<ide> public function testHasMethodAsCallback() {
<del> $Sample = new Sample();
<add> new Sample();
<ide> $Collection = new BehaviorCollection();
<ide> $Collection->init('Sample', array('Test', 'Test2'));
<ide>
<ide><path>lib/Cake/Test/Case/Model/CakeSchemaTest.php
<ide> public function testSchemaReadWithAppModel() {
<ide> ConnectionManager::drop('default');
<ide> ConnectionManager::create('default', $connections['test']);
<ide> try {
<del> $read = $this->Schema->read(array(
<add> $this->Schema->read(array(
<ide> 'connection' => 'default',
<ide> 'name' => 'TestApp',
<ide> 'models' => array('AppModel')
<ide> public function testSchemaReadWithTablePrefix() {
<ide> $config = ConnectionManager::getDataSource('test')->config;
<ide> $this->skipIf(!empty($config['prefix']), 'This test can not be executed with datasource prefix set.');
<ide>
<del> $model = new SchemaPrefixAuthUser();
<del>
<ide> $Schema = new CakeSchema();
<ide> $read = $Schema->read(array(
<ide> 'connection' => 'test',
<ide><path>lib/Cake/Test/Case/Model/ConnectionManagerTest.php
<ide> public function testGetDataSource() {
<ide> $name = 'test_get_datasource';
<ide> $config = array('datasource' => 'Test2Source');
<ide>
<del> $connection = ConnectionManager::create($name, $config);
<add> ConnectionManager::create($name, $config);
<ide> $connections = ConnectionManager::enumConnectionObjects();
<ide> $this->assertTrue((bool)(count(array_keys($connections) >= 1)));
<ide>
<ide> public function testSourceList() {
<ide> * @return void
<ide> */
<ide> public function testGetSourceName() {
<del> $connections = ConnectionManager::enumConnectionObjects();
<ide> $source = ConnectionManager::getDataSource('test');
<ide> $result = ConnectionManager::getSourceName($source);
<ide>
<ide> public function testLoadDataSource() {
<ide> */
<ide> public function testLoadDataSourceException() {
<ide> $connection = array('classname' => 'NonExistentDataSource', 'filename' => 'non_existent');
<del> $loaded = ConnectionManager::loadDataSource($connection);
<add> ConnectionManager::loadDataSource($connection);
<ide> }
<ide>
<ide> /**
<ide><path>lib/Cake/Test/Case/Model/Datasource/Database/MysqlTest.php
<ide> public function testGenerateAssociationQuerySelfJoin() {
<ide> */
<ide> protected function _buildRelatedModels(Model $model) {
<ide> foreach ($model->associations() as $type) {
<del> foreach ($model->{$type} as $assoc => $assocData) {
<add> foreach ($model->{$type} as $assocData) {
<ide> if (is_string($assocData)) {
<ide> $className = $assocData;
<ide> } elseif (isset($assocData['className'])) {
<ide> public function testSchema() {
<ide> * @return void
<ide> */
<ide> public function testDropSchemaNoSchema() {
<del> $result = $this->Dbo->dropSchema(null);
<add> $this->Dbo->dropSchema(null);
<ide> }
<ide>
<ide> /**
<ide> public function testRealQueries() {
<ide> * @return void
<ide> */
<ide> public function testExceptionOnBrokenConnection() {
<del> $dbo = new Mysql(array(
<add> new Mysql(array(
<ide> 'driver' => 'mysql',
<ide> 'host' => 'imaginary_host',
<ide> 'login' => 'mark',
<ide><path>lib/Cake/Test/Case/Model/Datasource/Database/PostgresTest.php
<ide> public function testCakeSchema() {
<ide> CONSTRAINT test_data_types_pkey PRIMARY KEY (id)
<ide> )');
<ide>
<del> $model = new Model(array('name' => 'DatatypeTest', 'ds' => 'test'));
<ide> $schema = new CakeSchema(array('connection' => 'test'));
<ide> $result = $schema->read(array(
<ide> 'connection' => 'test',
<ide><path>lib/Cake/Test/Case/Model/Datasource/Database/SqliteTest.php
<ide> public function testCacheKeyName() {
<ide> $dbName = 'db' . rand() . '$(*%&).db';
<ide> $this->assertFalse(file_exists(TMP . $dbName));
<ide>
<del> $config = $this->Dbo->config;
<ide> $db = new Sqlite(array_merge($this->Dbo->config, array('database' => TMP . $dbName)));
<ide> $this->assertTrue(file_exists(TMP . $dbName));
<ide>
<ide> public function testDatatypes() {
<ide> 'id' => array(
<ide> 'type' => 'integer',
<ide> 'null' => false,
<del> 'default' => 0,
<del> 'key' => 'primary'
<add> 'default' => '',
<add> 'length' => 11,
<add> 'key' => 'primary',
<ide> ),
<ide> 'float_field' => array(
<ide> 'type' => 'float',
<del> 'length' => '5,2',
<ide> 'null' => false,
<del> 'default' => null
<add> 'default' => '',
<add> 'length' => '5,2',
<ide> ),
<ide> 'huge_int' => array(
<del> 'type' => 'bigint',
<del> 'length' => '20',
<add> 'type' => 'biginteger',
<ide> 'null' => true,
<del> 'default' => null
<add> 'default' => null,
<add> 'length' => 20,
<ide> ),
<ide> 'bool' => array(
<ide> 'type' => 'boolean',
<ide> 'null' => false,
<del> 'default' => false
<add> 'default' => '0',
<add> 'length' => null
<ide> ),
<ide> );
<add> $this->assertSame($expected, $result);
<ide> }
<ide>
<ide> /**
<ide><path>lib/Cake/Test/Case/Model/Datasource/DboSourceTest.php
<ide> public function testMagicMethodQuerying() {
<ide> * @return void
<ide> */
<ide> public function testDirectCallThrowsException() {
<del> $result = $this->db->query('directCall', array(), $this->Model);
<add> $this->db->query('directCall', array(), $this->Model);
<ide> }
<ide>
<ide> /**
<ide> protected function _runTransactions($db) {
<ide> * @return void
<ide> */
<ide> public function testBuildStatementDefaults() {
<del> $conn = $this->getMock('MockPDO');
<add> $conn = $this->getMock('MockPDO', array('quote'));
<add> $conn->expects($this->at(0))
<add> ->method('quote')
<add> ->will($this->returnValue('foo bar'));
<ide> $db = new DboTestSource;
<ide> $db->setConnection($conn);
<ide> $subQuery = $db->buildStatement(
<ide> public function testBuildStatementDefaults() {
<ide> ),
<ide> $this->Model
<ide> );
<add> $expected = 'SELECT DISTINCT(AssetsTag.asset_id) FROM assets_tags AS AssetsTag WHERE Tag.name = foo bar GROUP BY AssetsTag.asset_id ';
<add> $this->assertEquals($expected, $subQuery);
<ide> }
<ide>
<ide> /**
<ide><path>lib/Cake/Test/Case/Model/Datasource/Session/DatabaseSessionTest.php
<ide> public function tearDown() {
<ide> */
<ide> public function testConstructionSettings() {
<ide> ClassRegistry::flush();
<del> $storage = new DatabaseSession();
<add> new DatabaseSession();
<ide>
<ide> $session = ClassRegistry::getObject('session');
<ide> $this->assertInstanceOf('SessionTestModel', $session);
<ide><path>lib/Cake/Test/Case/Model/ModelIntegrationTest.php
<ide> public function testHABTMKeepExistingWithThreeDbs() {
<ide> $larrysArmor = Hash::extract($larry, 'Armor.{n}.ArmorsPlayer');
<ide> $this->assertEquals(2 , count($larrysArmor));
<ide>
<del> $larrysArmorsPlayersIds = Hash::extract($larry, 'Armor.{n}.ArmorsPlayer.id');
<del>
<ide> $Player->ArmorsPlayer->id = 3;
<ide> $Player->ArmorsPlayer->saveField('broken', true); // larry's cloak broke
<ide>
<ide><path>lib/Cake/Test/Case/Model/ModelReadTest.php
<ide> public function testParameterMismatch() {
<ide> $query .= '.published = ? AND ' . $this->db->fullTableName('articles') . '.user_id = ?';
<ide> $params = array('Y');
<ide>
<del> $result = $Article->query($query, $params);
<add> $Article->query($query, $params);
<ide> }
<ide>
<ide> /**
<ide> public function testVeryStrangeUseCase() {
<ide> $this->db->fullTableName('articles') . '.published', 'Y'
<ide> );
<ide>
<del> $result = $Article->query($query, $param);
<add> $Article->query($query, $param);
<ide> }
<ide>
<ide> /**
<ide> public function testSelfAssociationAfterFind() {
<ide>
<ide> $duplicateModel = new NodeAfterFind();
<ide> $duplicateModel->recursive = 3;
<del> $duplicateModelData = $duplicateModel->find('all');
<ide>
<ide> $noAfterFindModel = new NodeNoAfterFind();
<ide> $noAfterFindModel->recursive = 3;
<ide><path>lib/Cake/Test/Case/Model/ModelValidationTest.php
<ide> public function testValidatorOverride() {
<ide> * @return void
<ide> */
<ide> public function testValidatorTypehintException() {
<del> $Validator = new ModelValidator('asdasds');
<add> new ModelValidator('asdasds');
<ide> }
<ide>
<ide> /**
<ide><path>lib/Cake/Test/Case/Model/ModelWriteTest.php
<ide> public function testCounterCacheMultipleCaches() {
<ide> ), false);
<ide>
<ide> // Count Increase
<del> $user = $User->find('first', array(
<del> 'conditions' => array('id' => 66),
<del> 'recursive' => -1
<del> ));
<ide> $data = array('Post' => array(
<ide> 'id' => 22,
<ide> 'title' => 'New Post',
<ide> public function testCreationWithMultipleData() {
<ide> public function testCreationWithMultipleDataSameModel() {
<ide> $this->loadFixtures('Article');
<ide> $Article = new Article();
<del> $SecondaryArticle = new Article();
<ide>
<ide> $result = $Article->field('title', array('id' => 1));
<ide> $this->assertEquals('First Article', $result);
<ide> public function testCreationWithMultipleDataSameModel() {
<ide> public function testCreationWithMultipleDataSameModelManualInstances() {
<ide> $this->loadFixtures('PrimaryModel');
<ide> $Primary = new PrimaryModel();
<del> $Secondary = new PrimaryModel();
<ide>
<ide> $result = $Primary->field('primary_name', array('id' => 1));
<ide> $this->assertEquals('Primary Name Existing', $result);
<ide> public function testSaveAllManyRowsTransactionNoRollback() {
<ide> public function testSaveAllAssociatedTransactionNoRollback() {
<ide> $testDb = ConnectionManager::getDataSource('test');
<ide>
<del> $mock = $this->getMock(
<add> $this->getMock(
<ide> 'DboSource',
<ide> array('connect', 'rollback', 'describe', 'create', 'update', 'begin'),
<ide> array(),
<ide> public function testSaveManyTransactionNoRollback() {
<ide> public function testSaveAssociatedTransactionNoRollback() {
<ide> $testDb = ConnectionManager::getDataSource('test');
<ide>
<del> $mock = $this->getMock(
<add> $this->getMock(
<ide> 'DboSource',
<ide> array('connect', 'rollback', 'describe', 'create', 'begin'),
<ide> array(),
<ide><path>lib/Cake/Test/Case/Model/Validator/CakeValidationSetTest.php
<ide> public function testValidate() {
<ide> public function testGetRule() {
<ide> $rules = array('notEmpty' => array('rule' => 'notEmpty', 'message' => 'Can not be empty'));
<ide> $Field = new CakeValidationSet('title', $rules);
<del> $data = array(
<del> 'title' => '',
<del> 'body' => 'a body'
<del> );
<del>
<ide> $result = $Field->getRule('notEmpty');
<ide> $this->assertInstanceOf('CakeValidationRule', $result);
<ide> $this->assertEquals('notEmpty', $result->rule);
<ide><path>lib/Cake/Test/Case/Network/Email/CakeEmailTest.php
<ide> public function testTransport() {
<ide> public function testExtendTransport() {
<ide> $this->setExpectedException('SocketException');
<ide> $this->CakeEmail->transport('Extend');
<del> $result = $this->CakeEmail->transportClass();
<add> $this->CakeEmail->transportClass();
<ide> }
<ide>
<ide> /**
<ide> public function testSendWithNoContentDispositionAttachments() {
<ide> * @return void
<ide> */
<ide> public function testSendWithLog() {
<del> $path = CAKE . 'Test' . DS . 'test_app' . DS . 'tmp' . DS;
<ide> CakeLog::config('email', array(
<ide> 'engine' => 'FileLog',
<ide> 'path' => TMP
<ide> public function testSendMultipleMIME() {
<ide> $this->CakeEmail->config(array());
<ide> $this->CakeEmail->viewVars(array('value' => 12345));
<ide> $this->CakeEmail->emailFormat('both');
<del> $result = $this->CakeEmail->send();
<add> $this->CakeEmail->send();
<ide>
<ide> $message = $this->CakeEmail->message();
<ide> $boundary = $this->CakeEmail->getBoundary();
<ide> public function testMessage() {
<ide> $this->CakeEmail->config(array('empty'));
<ide> $this->CakeEmail->template('default', 'default');
<ide> $this->CakeEmail->emailFormat('both');
<del> $result = $this->CakeEmail->send();
<add> $this->CakeEmail->send();
<ide>
<ide> $expected = '<p>This email was sent using the <a href="http://cakephp.org">CakePHP Framework</a></p>';
<ide> $this->assertContains($expected, $this->CakeEmail->message(CakeEmail::MESSAGE_HTML));
<ide><path>lib/Cake/Test/Case/Network/Http/HttpResponseTest.php
<ide> public function testDecodeChunkedBody() {
<ide> */
<ide> public function testDecodeChunkedBodyError() {
<ide> $encoded = "19\r\nThis is a chunked message\r\nE\r\n\nThat is cool\n\r\n";
<del> $r = $this->HttpResponse->decodeChunkedBody($encoded);
<add> $this->HttpResponse->decodeChunkedBody($encoded);
<ide> }
<ide>
<ide> /**
<ide><path>lib/Cake/Test/Case/Network/Http/HttpSocketTest.php
<ide> public function testRequest() {
<ide> $expectation['request']['raw'] = $expectation['request']['line'] . $expectation['request']['header'] . "\r\n" . $raw;
<ide>
<ide> $r = array('config' => $this->Socket->config, 'request' => $this->Socket->request);
<del> $v = $this->assertEquals($r, $expectation, 'Failed test #' . $i . ' ');
<add> $this->assertEquals($r, $expectation, 'Failed test #' . $i . ' ');
<ide> $expectation['request']['raw'] = $raw;
<ide> }
<ide>
<ide> public function testGetWithSchemeAndPort() {
<ide> ),
<ide> 'method' => 'GET'
<ide> );
<del> $response = $this->Socket->request($request);
<add> $this->Socket->request($request);
<ide> $this->assertContains('Host: cakephp.org:8080', $this->Socket->request['header']);
<ide> }
<ide>
<ide> public function testRequestWithStringQuery() {
<ide> ),
<ide> 'method' => 'GET'
<ide> );
<del> $response = $this->Socket->request($request);
<add> $this->Socket->request($request);
<ide> $this->assertContains("GET /index.php?somestring HTTP/1.1", $this->Socket->request['line']);
<ide> }
<ide>
<ide> public function testRequestWithStringQuery() {
<ide> public function testRequestNotAllowedUri() {
<ide> $this->Socket->reset();
<ide> $request = array('uri' => '*', 'method' => 'GET');
<del> $response = $this->Socket->request($request);
<add> $this->Socket->request($request);
<ide> }
<ide>
<ide> /**
<ide> public function testRequestWithRedirectAsInt() {
<ide> $this->Socket->expects($this->at(1))->method('read')->will($this->returnValue($serverResponse1));
<ide> $this->Socket->expects($this->at(4))->method('read')->will($this->returnValue($serverResponse2));
<ide>
<del> $response = $this->Socket->request($request);
<add> $this->Socket->request($request);
<ide> $this->assertEquals(1, $this->Socket->request['redirect']);
<ide> }
<ide>
<ide> public function testBuildRequestLine() {
<ide> * @return void
<ide> */
<ide> public function testBadBuildRequestLine() {
<del> $r = $this->Socket->buildRequestLine('Foo');
<add> $this->Socket->buildRequestLine('Foo');
<ide> }
<ide>
<ide> /**
<ide> public function testBadBuildRequestLine() {
<ide> * @return void
<ide> */
<ide> public function testBadBuildRequestLine2() {
<del> $r = $this->Socket->buildRequestLine("GET * HTTP/1.1\r\n");
<add> $this->Socket->buildRequestLine("GET * HTTP/1.1\r\n");
<ide> }
<ide>
<ide> /**
<ide> public function testVerifyPeer() {
<ide> $this->skipIf(!extension_loaded('openssl'), 'OpenSSL is not enabled cannot test SSL.');
<ide> $socket = new HttpSocket();
<ide> try {
<del> $result = $socket->get('https://typography.com');
<add> $socket->get('https://typography.com');
<ide> $this->markTestSkipped('Found valid certificate, was expecting invalid certificate.');
<ide> } catch (SocketException $e) {
<ide> $message = $e->getMessage();
<ide><path>lib/Cake/Test/Case/Routing/DispatcherTest.php
<ide> public function testParseParamsReturnsPostedData() {
<ide> $request = new CakeRequest("/");
<ide> $event = new CakeEvent('DispatcherTest', $Dispatcher, array('request' => $request));
<ide> $Dispatcher->parseParams($event);
<del> $test = $Dispatcher->parseParams($event);
<add> $Dispatcher->parseParams($event);
<ide> $this->assertEquals("My Posted Content", $request['data']['testdata']);
<ide> }
<ide>
<ide><path>lib/Cake/Test/Case/Routing/RouterTest.php
<ide> public function testConnectDefaultRoutes() {
<ide> * @return void
<ide> */
<ide> public function testUsingCustomRouteClass() {
<del> $mock = $this->getMock('CakeRoute', array(), array(), 'MockConnectedRoute', false);
<add> $this->getMock('CakeRoute', array(), array(), 'MockConnectedRoute', false);
<ide> $routes = Router::connect(
<ide> '/:slug',
<ide> array('controller' => 'posts', 'action' => 'view'),
<ide><path>lib/Cake/Test/Case/TestSuite/ControllerTestCaseTest.php
<ide> public function testTestAction() {
<ide> * @return void
<ide> */
<ide> public function testTestActionWithPlugin() {
<del> $Controller = $this->Case->generate('TestPlugin.Tests');
<add> $this->Case->generate('TestPlugin.Tests');
<ide> $this->Case->testAction('/test_plugin/tests/index');
<ide> $this->assertEquals('It is a variable', $this->Case->controller->viewVars['test_value']);
<ide> }
<ide> public function testSkipRoutes() {
<ide> include CAKE . 'Test' . DS . 'test_app' . DS . 'Config' . DS . 'routes.php';
<ide>
<ide> $this->Case->loadRoutes = false;
<del> $result = $this->Case->testAction('/tests_apps/missing_action.json', array('return' => 'view'));
<add> $this->Case->testAction('/tests_apps/missing_action.json', array('return' => 'view'));
<ide> }
<ide>
<ide> /**
<ide> public function testNoControllerReuse() {
<ide> * @return void
<ide> */
<ide> public function testTestActionWithMultipleRedirect() {
<del> $Controller = $this->Case->generate('TestsApps');
<add> $this->Case->generate('TestsApps');
<ide>
<ide> $options = array('method' => 'get');
<ide> $this->Case->testAction('/tests_apps/redirect_to', $options);
<ide><path>lib/Cake/Test/Case/Utility/CakeNumberTest.php
<ide> public function testFromReadableSize($params, $expected) {
<ide> * @return void
<ide> */
<ide> public function testFromReadableSizeException() {
<del> $result = $this->Number->fromReadableSize('bogus', false);
<add> $this->Number->fromReadableSize('bogus', false);
<ide> }
<ide>
<ide> /**
<ide><path>lib/Cake/Test/Case/Utility/ClassRegistryTest.php
<ide> public function testAddModel() {
<ide> * @return void
<ide> */
<ide> public function testClassRegistryFlush() {
<del> $Tag = ClassRegistry::init('RegisterArticleTag');
<add> ClassRegistry::init('RegisterArticleTag');
<ide>
<ide> $ArticleTag = ClassRegistry::getObject('RegisterArticleTag');
<ide> $this->assertTrue(is_a($ArticleTag, 'RegisterArticleTag'));
<ide><path>lib/Cake/Test/Case/Utility/DebuggerTest.php
<ide> public function tearDown() {
<ide> public function testDocRef() {
<ide> ini_set('docref_root', '');
<ide> $this->assertEquals(ini_get('docref_root'), '');
<del> $debugger = new Debugger();
<add> new Debugger();
<ide> $this->assertEquals(ini_get('docref_root'), 'http://php.net/');
<ide> }
<ide>
<ide><path>lib/Cake/Test/Case/Utility/FileTest.php
<ide> public function testPermission() {
<ide> $this->skipIf(DIRECTORY_SEPARATOR === '\\', 'File permissions tests not supported on Windows.');
<ide>
<ide> $dir = TMP . 'tests' . DS . 'permissions' . DS;
<del> $Folder = new Folder($dir);
<del>
<ide> $old = umask();
<ide>
<ide> umask(0002);
<ide><path>lib/Cake/Test/Case/Utility/ObjectCollectionTest.php
<ide> class GenericObjectCollection extends ObjectCollection {
<ide> * @return array List of loaded objects
<ide> */
<ide> public function load($object, $settings = array()) {
<del> list($plugin, $name) = pluginSplit($object);
<add> list(, $name) = pluginSplit($object);
<ide> if (isset($this->_loaded[$name])) {
<ide> return $this->_loaded[$name];
<ide> }
<ide> public function testTriggerModParamsInvalidIndex() {
<ide> $this->Objects->TriggerMockSecond->expects($this->never())
<ide> ->method('callback');
<ide>
<del> $result = $this->Objects->trigger(
<add> $this->Objects->trigger(
<ide> 'callback',
<ide> array(array('value')),
<ide> array('modParams' => 2)
<ide><path>lib/Cake/Test/Case/Utility/SecurityTest.php
<ide> public function testValidateAuthKey() {
<ide> * @return void
<ide> */
<ide> public function testHashInvalidSalt() {
<del> $result = Security::hash('someKey', 'blowfish', true);
<add> Security::hash('someKey', 'blowfish', true);
<ide> }
<ide>
<ide> /**
<ide> public function testHashInvalidSalt() {
<ide> * @return void
<ide> */
<ide> public function testHashAnotherInvalidSalt() {
<del> $result = Security::hash('someKey', 'blowfish', '$1$lksdjoijfaoijs');
<add> Security::hash('someKey', 'blowfish', '$1$lksdjoijfaoijs');
<ide> }
<ide>
<ide> /**
<ide> public function testHashAnotherInvalidSalt() {
<ide> * @return void
<ide> */
<ide> public function testHashYetAnotherInvalidSalt() {
<del> $result = Security::hash('someKey', 'blowfish', '$2a$10$123');
<add> Security::hash('someKey', 'blowfish', '$2a$10$123');
<ide> }
<ide>
<ide> /**
<ide> public function testCipher() {
<ide> public function testCipherEmptyKey() {
<ide> $txt = 'some_text';
<ide> $key = '';
<del> $result = Security::cipher($txt, $key);
<add> Security::cipher($txt, $key);
<ide> }
<ide>
<ide> /**
<ide> public function testRijndael() {
<ide> public function testRijndaelInvalidOperation() {
<ide> $txt = 'The quick brown fox jumped over the lazy dog.';
<ide> $key = 'DYhG93b0qyJfIxfs2guVoUubWwvniR2G0FgaC9mi';
<del> $result = Security::rijndael($txt, $key, 'foo');
<add> Security::rijndael($txt, $key, 'foo');
<ide> }
<ide>
<ide> /**
<ide> public function testRijndaelInvalidOperation() {
<ide> public function testRijndaelInvalidKey() {
<ide> $txt = 'The quick brown fox jumped over the lazy dog.';
<ide> $key = 'too small';
<del> $result = Security::rijndael($txt, $key, 'encrypt');
<add> Security::rijndael($txt, $key, 'encrypt');
<ide> }
<ide>
<ide> }
<ide><path>lib/Cake/Test/Case/Utility/XmlTest.php
<ide> public function testWithModel() {
<ide> </records>
<ide> </data>
<ide> XML;
<del> $result = $obj->asXML();
<add> $obj->asXML();
<ide> $this->assertXmlStringEqualsXmlString($expected, $obj->asXML());
<ide> }
<ide>
<ide><path>lib/Cake/Test/Case/View/Helper/CacheHelperTest.php
<ide> public function testCacheNonLatinCharactersInRoute() {
<ide> $this->Controller->action = 'view';
<ide>
<ide> $View = new View($this->Controller);
<del> $result = $View->render('index');
<add> $View->render('index');
<ide>
<ide> $filename = CACHE . 'views' . DS . 'posts_view_風街ろまん.php';
<ide> $this->assertTrue(file_exists($filename));
<ide> public function testCacheCallbacks() {
<ide> $this->Controller->cache_parsing();
<ide>
<ide> $View = new View($this->Controller);
<del> $result = $View->render('index');
<add> $View->render('index');
<ide>
<ide> $filename = CACHE . 'views' . DS . 'cachetest_cache_parsing.php';
<ide> $this->assertTrue(file_exists($filename));
<ide><path>lib/Cake/Test/Case/View/Helper/FormHelperTest.php
<ide> public function testFormSecuredFileInput() {
<ide> $this->Form->request['_Token'] = array('key' => 'testKey');
<ide> $this->assertEquals(array(), $this->Form->fields);
<ide>
<del> $result = $this->Form->file('Attachment.file');
<add> $this->Form->file('Attachment.file');
<ide> $expected = array(
<ide> 'Attachment.file.name', 'Attachment.file.type', 'Attachment.file.tmp_name',
<ide> 'Attachment.file.error', 'Attachment.file.size'
<ide> public function testSelectMultipleSecureWithNoOptions() {
<ide> $this->Form->request['_Token'] = array('key' => 'testkey');
<ide> $this->assertEquals(array(), $this->Form->fields);
<ide>
<del> $result = $this->Form->select(
<add> $this->Form->select(
<ide> 'Model.select',
<ide> array(),
<ide> array('multiple' => true)
<ide><path>lib/Cake/Test/Case/View/Helper/HtmlHelperTest.php
<ide> public function testImageTagWithTheme() {
<ide> App::uses('File', 'Utility');
<ide>
<ide> $testfile = WWW_ROOT . 'theme' . DS . 'test_theme' . DS . 'img' . DS . '__cake_test_image.gif';
<del> $File = new File($testfile, true);
<add> new File($testfile, true);
<ide>
<ide> App::build(array(
<ide> 'View' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'View' . DS)
<ide> public function testScriptInTheme() {
<ide> App::uses('File', 'Utility');
<ide>
<ide> $testfile = WWW_ROOT . 'theme' . DS . 'test_theme' . DS . 'js' . DS . '__test_js.js';
<del> $File = new File($testfile, true);
<add> new File($testfile, true);
<ide>
<ide> App::build(array(
<ide> 'View' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'View' . DS)
<ide> public function testLoadConfig() {
<ide> * @expectedException ConfigureException
<ide> */
<ide> public function testLoadConfigWrongFile() {
<del> $result = $this->Html->loadConfig('wrong_file');
<add> $this->Html->loadConfig('wrong_file');
<ide> }
<ide>
<ide> /**
<ide> public function testLoadConfigWrongFile() {
<ide> */
<ide> public function testLoadConfigWrongReader() {
<ide> $path = CAKE . 'Test' . DS . 'test_app' . DS . 'Config' . DS;
<del> $result = $this->Html->loadConfig(array('htmlhelper_tags', 'wrong_reader'), $path);
<add> $this->Html->loadConfig(array('htmlhelper_tags', 'wrong_reader'), $path);
<ide> }
<ide>
<ide> /**
<ide><path>lib/Cake/Test/Case/View/Helper/JsHelperTest.php
<ide> public function testWriteBufferNotInline() {
<ide> ->method('append')
<ide> ->with('script', $this->matchesRegularExpression('#<script type="text\/javascript">window.app \= \{"foo"\:1\}\;<\/script>#'));
<ide>
<del> $result = $this->Js->writeBuffer(array('onDomReady' => false, 'inline' => false, 'safe' => false));
<add> $this->Js->writeBuffer(array('onDomReady' => false, 'inline' => false, 'safe' => false));
<ide> }
<ide>
<ide> /**
<ide> public function testWriteBufferAndXhr() {
<ide>
<ide> $this->Js->buffer('alert("test");');
<ide> $this->Js->TestJsEngine->expects($this->never())->method('domReady');
<del> $result = $this->Js->writeBuffer();
<add> $this->Js->writeBuffer();
<ide>
<ide> unset($_SERVER['HTTP_X_REQUESTED_WITH']);
<ide> if ($requestWith !== null) {
<ide><path>lib/Cake/Test/Case/View/Helper/PaginatorHelperTest.php
<ide> public function testNextLinkUsingDotNotation() {
<ide> */
<ide> public function testAjaxLinkGenerationNumbers() {
<ide> $this->Paginator->Js->expectCallCount('link', 2);
<del> $result = $this->Paginator->numbers(array(
<add> $this->Paginator->numbers(array(
<ide> 'modulus' => '2',
<ide> 'url' => array('controller' => 'projects', 'action' => 'sort'),
<ide> 'update' => 'list'
<ide> public function testMockAjaxProviderClassInjection() {
<ide> );
<ide> $Paginator->PaginatorMockJs = $mock;
<ide> $Paginator->PaginatorMockJs->expects($this->once())->method('link');
<del> $result = $Paginator->link('Page 2', array('page' => 2), array('update' => '#content'));
<add> $Paginator->link('Page 2', array('page' => 2), array('update' => '#content'));
<ide>
<del> $Paginator = new PaginatorHelper($this->View, array('ajax' => 'Form'));
<add> new PaginatorHelper($this->View, array('ajax' => 'Form'));
<ide> }
<ide>
<ide> /**
<ide><path>lib/Cake/Test/Case/View/HelperCollectionTest.php
<ide> public function testLazyLoad() {
<ide> * @return void
<ide> */
<ide> public function testLazyLoadException() {
<del> $result = $this->Helpers->NotAHelper;
<add> $this->Helpers->NotAHelper;
<ide> }
<ide>
<ide> /**
<ide> public function testLoadWithEnabledFalse() {
<ide> * @return void
<ide> */
<ide> public function testLoadMissingHelper() {
<del> $result = $this->Helpers->load('ThisHelperShouldAlwaysBeMissing');
<add> $this->Helpers->load('ThisHelperShouldAlwaysBeMissing');
<ide> }
<ide>
<ide> /**
<ide><path>lib/Cake/Test/Case/View/ScaffoldViewTest.php
<ide> public function testAdminIndexScaffold() {
<ide> $this->Controller->constructClasses();
<ide>
<ide> ob_start();
<del> $Scaffold = new Scaffold($this->Controller, $this->Controller->request);
<add> new Scaffold($this->Controller, $this->Controller->request);
<ide> $this->Controller->response->send();
<ide> $result = ob_get_clean();
<ide>
<ide> public function testAdminEditScaffold() {
<ide> $this->Controller->constructClasses();
<ide>
<ide> ob_start();
<del> $Scaffold = new Scaffold($this->Controller, $this->Controller->request);
<add> new Scaffold($this->Controller, $this->Controller->request);
<ide> $this->Controller->response->send();
<ide> $result = ob_get_clean();
<ide>
<ide> public function testMultiplePrefixScaffold() {
<ide> $this->Controller->constructClasses();
<ide>
<ide> ob_start();
<del> $Scaffold = new Scaffold($this->Controller, $this->Controller->request);
<add> new Scaffold($this->Controller, $this->Controller->request);
<ide> $this->Controller->response->send();
<ide> $result = ob_get_clean();
<ide>
<ide><path>lib/Cake/Test/Case/View/ThemeViewTest.php
<ide> public function testMissingView() {
<ide>
<ide> $View = new TestTheme2View($this->Controller);
<ide> ob_start();
<del> $result = $View->getViewFileName('does_not_exist');
<add> $View->getViewFileName('does_not_exist');
<ide> $expected = ob_get_clean();
<ide> $this->assertRegExp("/PagesController::/", $expected);
<ide> $this->assertRegExp("/views(\/|\\\)themed(\/|\\\)my_theme(\/|\\\)pages(\/|\\\)does_not_exist.ctp/", $expected);
<ide> public function testMissingLayout() {
<ide>
<ide> $View = new TestTheme2View($this->Controller);
<ide> ob_start();
<del> $result = $View->getLayoutFileName();
<add> $View->getLayoutFileName();
<ide> $expected = ob_get_clean();
<ide> $this->assertRegExp("/Missing Layout/", $expected);
<ide> $this->assertRegExp("/views(\/|\\\)themed(\/|\\\)my_theme(\/|\\\)layouts(\/|\\\)whatever.ctp/", $expected);
<ide><path>lib/Cake/Test/Case/View/ViewTest.php
<ide> public function testElement() {
<ide> * @return void
<ide> */
<ide> public function testElementInexistent() {
<del> $result = $this->View->element('non_existent_element');
<add> $this->View->element('non_existent_element');
<ide> }
<ide>
<ide> /**
<ide> public function testElementInexistent() {
<ide> * @return void
<ide> */
<ide> public function testElementInexistent2() {
<del> $result = $this->View->element('TestPlugin.plugin_element', array(), array('plugin' => 'test_plugin'));
<add> $this->View->element('TestPlugin.plugin_element', array(), array('plugin' => 'test_plugin'));
<ide> }
<ide>
<ide> /**
<ide> public function testElementInexistent2() {
<ide> * @return void
<ide> */
<ide> public function testElementInexistent3() {
<del> $result = $this->View->element('test_plugin.plugin_element');
<add> $this->View->element('test_plugin.plugin_element');
<ide> }
<ide>
<ide> /**
<ide> public function testElementParamsDontOverwriteHelpers() {
<ide> public function testElementCacheHelperNoCache() {
<ide> $Controller = new ViewPostsController();
<ide> $View = new TestView($Controller);
<del> $helpers = $View->loadHelpers();
<add> $View->loadHelpers();
<ide> $result = $View->element('test_element', array('ram' => 'val', 'test' => array('foo', 'bar')));
<ide> $this->assertEquals('this is the test element', $result);
<ide> }
<ide><path>lib/Cake/TestSuite/CakeTestSuite.php
<ide> class CakeTestSuite extends PHPUnit_Framework_TestSuite {
<ide> */
<ide> public function addTestDirectory($directory = '.') {
<ide> $Folder = new Folder($directory);
<del> list($dirs, $files) = $Folder->read(true, true, true);
<add> list(, $files) = $Folder->read(true, true, true);
<ide>
<ide> foreach ($files as $file) {
<ide> if (substr($file, -4) === '.php') {
<ide><path>lib/Cake/TestSuite/CakeTestSuiteCommand.php
<ide> public function handleFixture($class) {
<ide> public function handleReporter($reporter) {
<ide> $object = null;
<ide>
<del> $type = strtolower($reporter);
<ide> $reporter = ucwords($reporter);
<ide> $coreClass = 'Cake' . $reporter . 'Reporter';
<ide> App::uses($coreClass, 'TestSuite/Reporter');
<ide><path>lib/Cake/TestSuite/CakeTestSuiteDispatcher.php
<ide> protected function _runTestCase() {
<ide> try {
<ide> self::time();
<ide> $command = new CakeTestSuiteCommand('CakeTestLoader', $commandArgs);
<del> $result = $command->run($options);
<add> $command->run($options);
<ide> } catch (MissingConnectionException $exception) {
<ide> ob_end_clean();
<ide> $baseDir = $this->_baseDir;
<ide><path>lib/Cake/TestSuite/Fixture/CakeFixtureManager.php
<ide> protected function _initDb() {
<ide> * @throws UnexpectedValueException when a referenced fixture does not exist.
<ide> */
<ide> protected function _loadFixtures($fixtures) {
<del> foreach ($fixtures as $index => $fixture) {
<add> foreach ($fixtures as $fixture) {
<ide> $fixtureFile = null;
<ide> $fixtureIndex = $fixture;
<ide> if (isset($this->_loaded[$fixture])) {
<ide><path>lib/Cake/TestSuite/Fixture/CakeTestFixture.php
<ide> public function create($db) {
<ide>
<ide> if (empty($this->fields['tableParameters']['engine'])) {
<ide> $canUseMemory = true;
<del> foreach ($this->fields as $field => $args) {
<add> foreach ($this->fields as $args) {
<ide>
<ide> if (is_string($args)) {
<ide> $type = $args;
<ide><path>lib/Cake/TestSuite/Reporter/CakeHtmlReporter.php
<ide> public function testCaseList() {
<ide> $buffer .= "<strong>EMPTY</strong>";
<ide> }
<ide>
<del> foreach ($testCases as $testCaseFile => $testCase) {
<add> foreach ($testCases as $testCase) {
<ide> $title = explode(DS, str_replace('.test.php', '', $testCase));
<ide> $title[count($title) - 1] = Inflector::camelize($title[count($title) - 1]);
<ide> $title = implode(' / ', $title);
<ide><path>lib/Cake/TestSuite/Reporter/CakeTextReporter.php
<ide> public function testCaseList() {
<ide> echo $buffer;
<ide> }
<ide>
<del> foreach ($testCases as $testCaseFile => $testCase) {
<add> foreach ($testCases as $testCase) {
<ide> $buffer .= $_SERVER['SERVER_NAME'] . $this->baseUrl() . "?case=" . $testCase . "&output=text\n";
<ide> }
<ide>
<ide><path>lib/Cake/Utility/ClassRegistry.php
<ide> public static function init($class, $strict = false) {
<ide> }
<ide>
<ide> if (!isset($instance)) {
<del> trigger_error(__d('cake_dev', '(ClassRegistry::init() could not create instance of %1$s class %2$s ', $class, $type), E_USER_WARNING);
<add> trigger_error(__d('cake_dev', '(ClassRegistry::init() could not create instance of %s', $class), E_USER_WARNING);
<ide> return false;
<ide> }
<ide> }
<ide><path>lib/Cake/Utility/String.php
<ide> public static function insert($str, $data, $options = array()) {
<ide>
<ide> asort($data);
<ide>
<del> $hashKeys = array();
<del> foreach ($data as $key => $value) {
<del> $hashKeys[] = crc32($key);
<del> }
<del>
<del> $tempData = array_combine(array_keys($data), array_values($hashKeys));
<add> $dataKeys = array_keys($data);
<add> $hashKeys = array_map('crc32', $dataKeys);
<add> $tempData = array_combine($dataKeys, $hashKeys);
<ide> krsort($tempData);
<add>
<ide> foreach ($tempData as $key => $hashVal) {
<ide> $key = sprintf($format, preg_quote($key, '/'));
<ide> $str = preg_replace($key, $hashVal, $str); | 70 |
Python | Python | extend config with task specific configs. | ffa17fe322ecf57a10be80d4c328828ebd7c81f0 | <ide><path>src/transformers/configuration_utils.py
<ide> def __init__(self, **kwargs):
<ide> self.top_k = kwargs.pop("top_k", 50)
<ide> self.top_p = kwargs.pop("top_p", 1.0)
<ide> self.repetition_penalty = kwargs.pop("repetition_penalty", 1.0)
<del> self.bos_token_id = kwargs.pop("bos_token_id", None)
<del> self.pad_token_id = kwargs.pop("pad_token_id", None)
<del> self.eos_token_id = kwargs.pop("eos_token_id", None)
<ide> self.length_penalty = kwargs.pop("length_penalty", 1.0)
<ide> self.no_repeat_ngram_size = kwargs.pop("no_repeat_ngram_size", 0)
<ide> self.num_return_sequences = kwargs.pop("num_return_sequences", 1)
<ide> def __init__(self, **kwargs):
<ide> self.label2id = kwargs.pop("label2id", dict(zip(self.id2label.values(), self.id2label.keys())))
<ide> self.label2id = dict((key, int(value)) for key, value in self.label2id.items())
<ide>
<add> # Tokenizer arguments TODO: eventually tokenizer and models should share the same config
<add> self.prefix = kwargs.pop("prefix", None)
<add> self.bos_token_id = kwargs.pop("bos_token_id", None)
<add> self.pad_token_id = kwargs.pop("pad_token_id", None)
<add> self.eos_token_id = kwargs.pop("eos_token_id", None)
<add> self.decoder_start_token_id = kwargs.pop("decoder_start_token_id", None)
<add>
<add> # task specific arguments
<add> self.task_specific_params = kwargs.pop("task_specific_params", None)
<add>
<ide> # Additional attributes without default values
<ide> for key, value in kwargs.items():
<ide> try:
<ide><path>src/transformers/modeling_tf_utils.py
<ide> def generate(
<ide> num_return_sequences = (
<ide> num_return_sequences if num_return_sequences is not None else self.config.num_return_sequences
<ide> )
<del> decoder_start_token_id = decoder_start_token_id if decoder_start_token_id is not None else bos_token_id
<add> decoder_start_token_id = (
<add> decoder_start_token_id if decoder_start_token_id is not None else self.config.decoder_start_token_id
<add> )
<ide>
<ide> if input_ids is not None:
<ide> batch_size = shape_list(input_ids)[0] # overriden by the input batch_size
<ide> def generate(
<ide> assert (eos_token_id is None) or (
<ide> isinstance(eos_token_id, int) and (eos_token_id >= 0)
<ide> ), "`eos_token_id` should be a positive integer."
<del> assert (
<del> decoder_start_token_id is not None or self.config.is_encoder_decoder is False
<del> ), "`decoder_start_token_id` has to be defined if model is encoder-decoder model"
<ide> assert length_penalty > 0, "`length_penalty` should be strictely positive."
<ide> assert (
<ide> isinstance(num_return_sequences, int) and num_return_sequences > 0
<ide> def generate(
<ide> ) # shape: (batch_size * num_return_sequences * num_beams, cur_len)
<ide>
<ide> if self.config.is_encoder_decoder:
<add> if decoder_start_token_id is None:
<add> decoder_start_token_id = bos_token_id
<ide>
<del> assert bos_token_id is not None, "Encoder Decoder Models need to have a bos_token_id"
<add> assert (
<add> decoder_start_token_id is not None
<add> ), "decoder_start_token_id or bos_token_id has to be defined for encoder-decoder generation"
<ide> assert hasattr(self, "get_encoder"), "{} should have a 'get_encoder' function defined".format(self)
<ide> assert callable(self.get_encoder), "{} should be a method".format(self.get_encoder)
<ide>
<ide><path>src/transformers/modeling_utils.py
<ide> def generate(
<ide> num_return_sequences = (
<ide> num_return_sequences if num_return_sequences is not None else self.config.num_return_sequences
<ide> )
<del> decoder_start_token_id = decoder_start_token_id if decoder_start_token_id is not None else bos_token_id
<add> decoder_start_token_id = (
<add> decoder_start_token_id if decoder_start_token_id is not None else self.config.decoder_start_token_id
<add> )
<ide>
<ide> if input_ids is not None:
<ide> batch_size = input_ids.shape[0] # overriden by the input batch_size
<ide> def generate(
<ide> assert pad_token_id is None or (
<ide> isinstance(pad_token_id, int) and (pad_token_id >= 0)
<ide> ), "`pad_token_id` should be a positive integer."
<del> assert (
<del> decoder_start_token_id is not None or self.config.is_encoder_decoder is False
<del> ), "`decoder_start_token_id` has to be defined if model is encoder-decoder model"
<ide> assert (eos_token_id is None) or (
<ide> isinstance(eos_token_id, int) and (eos_token_id >= 0)
<ide> ), "`eos_token_id` should be a positive integer."
<ide> def generate(
<ide> ) # shape: (batch_size * num_return_sequences * num_beams, cur_len)
<ide>
<ide> if self.config.is_encoder_decoder:
<del> assert bos_token_id is not None, "Encoder Decoder Models need to have a bos_token_id"
<add> if decoder_start_token_id is None:
<add> decoder_start_token_id = bos_token_id
<add>
<add> assert (
<add> decoder_start_token_id is not None
<add> ), "decoder_start_token_id or bos_token_id has to be defined for encoder-decoder generation"
<ide> assert hasattr(self, "get_encoder"), "{} should have a 'get_encoder' function defined".format(self)
<ide> assert callable(self.get_encoder), "{} should be a method".format(self.get_encoder)
<ide> | 3 |
Javascript | Javascript | show webpack errors in all pages. | c97aca50e509fac66ef380f6435c556d25290d27 | <ide><path>lib/error.js
<ide> import React from 'react'
<ide> import PropTypes from 'prop-types'
<del>import exact from 'prop-types-exact'
<ide> import HTTPStatus from 'http-status'
<ide> import Head from './head'
<ide>
<ide> export default class Error extends React.Component {
<ide> return { statusCode }
<ide> }
<ide>
<del> static propTypes = exact({
<add> static propTypes = {
<ide> statusCode: PropTypes.number
<del> })
<add> }
<ide>
<ide> render () {
<ide> const { statusCode } = this.props
<ide><path>lib/router/router.js
<ide> export default class Router {
<ide> cancelled = true
<ide> }
<ide>
<del> const Component = await this.fetchRoute(route)
<add> try {
<add> const Component = await this.fetchRoute(route)
<ide>
<del> if (cancelled) {
<del> const error = new Error(`Abort fetching component for route: "${route}"`)
<del> error.cancelled = true
<del> throw error
<del> }
<add> if (cancelled) {
<add> const error = new Error(`Abort fetching component for route: "${route}"`)
<add> error.cancelled = true
<add> throw error
<add> }
<ide>
<del> if (cancel === this.componentLoadCancel) {
<del> this.componentLoadCancel = null
<del> }
<add> if (cancel === this.componentLoadCancel) {
<add> this.componentLoadCancel = null
<add> }
<ide>
<del> return Component
<add> return Component
<add> } catch (err) {
<add> // There's an error in loading the route.
<add> // Usually this happens when there's a failure in the webpack build
<add> // So in that case, we need to load the page with full SSR
<add> // That'll clean the invalid exising client side information.
<add> // (Like cached routes)
<add> window.location.href = as
<add> throw err
<add> }
<ide> }
<ide>
<ide> async getInitialProps (Component, ctx) {
<ide><path>server/index.js
<ide> import {
<ide> renderScriptError
<ide> } from './render'
<ide> import Router from './router'
<del>import { resolveFromList } from './resolve'
<ide> import { getAvailableChunks } from './utils'
<ide> import getConfig from './config'
<ide> // We need to go up one more level since we are in the `dist` directory
<ide> export default class Server {
<ide> return await renderScriptError(req, res, page, error, {}, this.renderOpts)
<ide> }
<ide>
<del> const compilationErr = await this.getCompilationError(page, req, res)
<add> const compilationErr = await this.getCompilationError()
<ide> if (compilationErr) {
<ide> const customFields = { statusCode: 500 }
<ide> return await renderScriptError(req, res, page, compilationErr, customFields, this.renderOpts)
<ide> export default class Server {
<ide>
<ide> async renderToHTML (req, res, pathname, query) {
<ide> if (this.dev) {
<del> const compilationErr = await this.getCompilationError(pathname)
<add> const compilationErr = await this.getCompilationError()
<ide> if (compilationErr) {
<ide> res.statusCode = 500
<ide> return this.renderErrorToHTML(compilationErr, req, res, pathname, query)
<ide> export default class Server {
<ide>
<ide> async renderErrorToHTML (err, req, res, pathname, query) {
<ide> if (this.dev) {
<del> const compilationErr = await this.getCompilationError('/_error')
<add> const compilationErr = await this.getCompilationError()
<ide> if (compilationErr) {
<ide> res.statusCode = 500
<ide> return renderErrorToHTML(compilationErr, req, res, pathname, query, this.renderOpts)
<ide> export default class Server {
<ide> return true
<ide> }
<ide>
<del> async getCompilationError (page, req, res) {
<add> async getCompilationError () {
<ide> if (!this.hotReloader) return
<ide>
<ide> const errors = await this.hotReloader.getCompilationErrors()
<ide> if (!errors.size) return
<ide>
<del> const id = join(this.dir, this.dist, 'bundles', 'pages', page)
<del> const p = resolveFromList(id, errors.keys())
<del> if (p) return errors.get(p)[0]
<add> // Return the very first error we found.
<add> return Array.from(errors.values())[0][0]
<ide> }
<ide>
<ide> handleBuildHash (filename, hash, res) { | 3 |
Python | Python | fix a minor typo in the docstring | fdf220c4212f0743afabd7ff0bafcd3f0edc5ef9 | <ide><path>keras/preprocessing/timeseries.py
<ide> def timeseries_dataset_from_array(
<ide> sampling_rate: Period between successive individual timesteps
<ide> within sequences. For rate `r`, timesteps
<ide> `data[i], data[i + r], ... data[i + sequence_length]`
<del> are used for create a sample sequence.
<add> are used for creating a sample sequence.
<ide> batch_size: Number of timeseries samples in each batch
<ide> (except maybe the last one). If `None`, the data will not be batched
<ide> (the dataset will yield individual samples). | 1 |
Python | Python | fix syntax error under python 3.2 | 6010b5360f9cb228c19e1d1f85e1b63a11ec6d35 | <ide><path>django/utils/functional.py
<ide> def memoize(func, cache, num_args):
<ide>
<ide> Only the first num_args are considered when creating the key.
<ide> """
<del> warnings.warn(u"memoize wrapper is deprecated and will be removed in "
<del> u"Django 1.9. Use django.utils.lru_cache instead.",
<del> PendingDeprecationWarning, 2)
<add> warnings.warn("memoize wrapper is deprecated and will be removed in "
<add> "Django 1.9. Use django.utils.lru_cache instead.",
<add> PendingDeprecationWarning, stacklevel=2)
<ide>
<ide> @wraps(func)
<ide> def wrapper(*args): | 1 |
Javascript | Javascript | ignore null, undefined, and nan is dimension() | 68ad48d8e82b874f0cbe8975cd88cac042ae3b88 | <ide><path>src/js/component.js
<ide> vjs.Component.prototype.dimensions = function(width, height){
<ide> * @private
<ide> */
<ide> vjs.Component.prototype.dimension = function(widthOrHeight, num, skipListeners){
<del> if (num !== undefined) {
<add> if (num !== undefined && num !== null && !vjs.isNaN(num)) {
<ide>
<ide> // Check if using css width/height (% or px) and adjust
<ide> if ((''+num).indexOf('%') !== -1 || (''+num).indexOf('px') !== -1) {
<ide><path>src/js/lib.js
<ide> vjs.obj.isArray = Array.isArray || function(arr) {
<ide> return Object.prototype.toString.call(arr) === '[object Array]';
<ide> };
<ide>
<add>/**
<add> * Check to see whether the input is NaN or not.
<add> * NaN is the only JavaScript construct that isn't equal to itself
<add> * @param {Number} num Number to check
<add> * @return {Boolean} True if NaN, false otherwise
<add> * @private
<add> */
<add>vjs.isNaN = function(num) {
<add> return num !== num;
<add>};
<add>
<ide> /**
<ide> * Bind (a.k.a proxy or Context). A simple method for changing the context of a function
<ide> It also stores a unique id on the function so it can be easily removed from events
<ide><path>test/unit/component.js
<ide> test('should show and hide an element', function(){
<ide> ok(comp.el().style.display === 'block');
<ide> });
<ide>
<add>test('dimension() should ignore undefined, null, and NaN values', function() {
<add> var comp, width, height, newWidth, newHeight;
<add> width = 300;
<add> height = 150;
<add>
<add> comp = new vjs.Component(getFakePlayer(), {}),
<add> // set component dimension
<add>
<add> comp.dimensions(width, height);
<add>
<add> newWidth = comp.dimension('width', null);
<add>
<add> equal(newWidth, width, 'we did not set the width with null');
<add>
<add> newHeight = comp.dimension('height', NaN);
<add>
<add> equal(newHeight, height, 'we did not set the height with NaN');
<add>
<add> newWidth = comp.dimension('width', undefined);
<add>
<add> equal(newWidth, width, 'we did not set the width with undefined');
<add>});
<add>
<ide> test('should change the width and height of a component', function(){
<ide> var container = document.createElement('div');
<ide> var comp = new vjs.Component(getFakePlayer(), {}); | 3 |
Text | Text | update information about language | be2893e32336cfe3253ed1cbd760563386d9ab9e | <ide><path>docs/how-to-work-on-coding-challenges.md
<ide> function myFunc() {
<ide>
<ide> Before you [create a pull request](how-to-open-a-pull-request.md) for your changes, you need to validate that the changes you have made do not inadvertently cause problems with the challenge.
<ide>
<del>> [!WARNING]
<del>> In the `.env` file, set the environment variable `TEST_CHALLENGES_FOR_LANGS` to the language of the challenge(s) you need to test. The currently accepted values are `english` and `chinese` for the language that you are working on
<del>>
<del>> This is set to test for `english` by default.
<del>
<ide> 1. To test all challenges run the below command from the root directory
<ide>
<ide> ```
<ide> You are also able to test one challenge individually by performing the following
<ide>
<ide> Once you have verified that each challenge you've worked on passes the tests, [please create a pull request](https://github.com/freeCodeCamp/freeCodeCamp/blob/master/docs/how-to-open-a-pull-request.md).
<ide>
<add>> [!TIP]
<add>> You can set the environment variable `TEST_CHALLENGES_FOR_LANGS` in the `.env` to the language of the challenge(s) you need to test.
<add>>
<add>> The currently accepted values are `english` and `chinese`, with `english` being set by default.
<add>
<add>
<ide> ### Useful Links
<ide>
<ide> Creating and Editing Challenges: | 1 |
Javascript | Javascript | add regression tests for vm bugs | 1ef38e9fed540efd19102589ed02ac6d6c306cd6 | <ide><path>test/known_issues/test-vm-global-non-writable-properties.js
<add>'use strict';
<add>// https://github.com/nodejs/node/issues/10223
<add>
<add>require('../common');
<add>const assert = require('assert');
<add>const vm = require('vm');
<add>
<add>const ctx = vm.createContext();
<add>vm.runInContext('Object.defineProperty(this, "x", { value: 42 })', ctx);
<add>assert.strictEqual(ctx.x, undefined); // Not copied out by cloneProperty().
<add>assert.strictEqual(vm.runInContext('x', ctx), 42);
<add>vm.runInContext('x = 0', ctx); // Does not throw but x...
<add>assert.strictEqual(vm.runInContext('x', ctx), 42); // ...should be unaltered.
<add>assert.throws(() => vm.runInContext('"use strict"; x = 0', ctx),
<add> /Cannot assign to read only property 'x'/);
<add>assert.strictEqual(vm.runInContext('x', ctx), 42);
<ide><path>test/parallel/test-vm-global-assignment.js
<add>'use strict';
<add>// Regression test for https://github.com/nodejs/node/issues/10806
<add>
<add>require('../common');
<add>const assert = require('assert');
<add>const vm = require('vm');
<add>const ctx = vm.createContext({ open() { } });
<add>const window = vm.runInContext('this', ctx);
<add>const other = 123;
<add>
<add>assert.notStrictEqual(window.open, other);
<add>window.open = other;
<add>assert.strictEqual(window.open, other);
<add>window.open = other;
<add>assert.strictEqual(window.open, other); | 2 |
Python | Python | remove filter dilation from separableconv2d | 16e8b93d3852958aa7d28bb127de34681136c5b0 | <ide><path>keras/layers/convolutional.py
<ide> class SeparableConv2D(Conv2D):
<ide> It defaults to the `image_data_format` value found in your
<ide> Keras config file at `~/.keras/keras.json`.
<ide> If you never set it, then it will be "channels_last".
<del> dilation_rate: an integer or tuple/list of 2 integers, specifying
<del> the dilation rate to use for dilated convolution.
<del> Can be a single integer to specify the same value for
<del> all spatial dimensions.
<del> Currently, specifying any `dilation_rate` value != 1 is
<del> incompatible with specifying any stride value != 1.
<ide> depth_multiplier: The number of depthwise convolution output channels
<ide> for each input channel.
<ide> The total number of depthwise convolution output
<ide> def __init__(self, filters,
<ide> strides=(1, 1),
<ide> padding='valid',
<ide> data_format=None,
<del> dilation_rate=(1, 1),
<ide> depth_multiplier=1,
<ide> activation=None,
<ide> use_bias=True,
<ide> def __init__(self, filters,
<ide> strides=strides,
<ide> padding=padding,
<ide> data_format=data_format,
<del> dilation_rate=dilation_rate,
<ide> activation=activation,
<ide> use_bias=use_bias,
<ide> bias_regularizer=bias_regularizer,
<ide> def call(self, inputs):
<ide> self.pointwise_kernel,
<ide> data_format=self.data_format,
<ide> strides=self.strides,
<del> padding=self.padding,
<del> dilation_rate=self.dilation_rate)
<add> padding=self.padding)
<ide>
<ide> if self.bias:
<ide> outputs = K.bias_add(
<ide> def compute_output_shape(self, input_shape):
<ide>
<ide> rows = conv_utils.conv_output_length(rows, self.kernel_size[0],
<ide> self.padding,
<del> self.strides[0],
<del> dilation=self.dilation_rate[0])
<add> self.strides[0])
<ide> cols = conv_utils.conv_output_length(cols, self.kernel_size[1],
<ide> self.padding,
<del> self.strides[1],
<del> dilation=self.dilation_rate[1])
<add> self.strides[1])
<ide> if self.data_format == 'channels_first':
<ide> return (input_shape[0], self.filters, rows, cols)
<ide> elif self.data_format == 'channels_last':
<ide><path>tests/keras/layers/convolutional_test.py
<ide> def test_separable_conv_2d():
<ide> 'strides': strides,
<ide> 'depth_multiplier': multiplier},
<ide> input_shape=(num_samples, num_row, num_col, stack_size))
<del> # Test dilation
<del> layer_test(convolutional.SeparableConv2D,
<del> kwargs={'filters': filters,
<del> 'kernel_size': (3, 3),
<del> 'strides': strides,
<del> 'depth_multiplier': multiplier,
<del> 'data_format': 'channels_first',
<del> 'dilation_rate': 2},
<del> input_shape=(num_samples, stack_size, num_row, num_col))
<ide>
<ide>
<ide> @keras_test | 2 |
Ruby | Ruby | convert cleaner test to spec | 8bea5de173a279cd094b1551760b67f4ba21aa7b | <ide><path>Library/Homebrew/test/cleaner_spec.rb
<add>require "cleaner"
<add>require "formula"
<add>
<add>describe Cleaner do
<add> include FileUtils
<add>
<add> subject { described_class.new(f) }
<add> let(:f) { formula("cleaner_test") { url "foo-1.0" } }
<add>
<add> before(:each) do
<add> f.prefix.mkpath
<add> end
<add>
<add> describe "#clean" do
<add> it "cleans files" do
<add> f.bin.mkpath
<add> f.lib.mkpath
<add> cp "#{TEST_FIXTURE_DIR}/mach/a.out", f.bin
<add> cp Dir["#{TEST_FIXTURE_DIR}/mach/*.dylib"], f.lib
<add>
<add> subject.clean
<add>
<add> expect((f.bin/"a.out").stat.mode).to eq(0100555)
<add> expect((f.lib/"fat.dylib").stat.mode).to eq(0100444)
<add> expect((f.lib/"x86_64.dylib").stat.mode).to eq(0100444)
<add> expect((f.lib/"i386.dylib").stat.mode).to eq(0100444)
<add> end
<add>
<add> it "prunes the prefix if it is empty" do
<add> subject.clean
<add> expect(f.prefix).not_to be_a_directory
<add> end
<add>
<add> it "prunes empty directories" do
<add> subdir = f.bin/"subdir"
<add> subdir.mkpath
<add>
<add> subject.clean
<add>
<add> expect(f.bin).not_to be_a_directory
<add> expect(subdir).not_to be_a_directory
<add> end
<add>
<add> it "removes a symlink when its target was pruned before" do
<add> dir = f.prefix/"b"
<add> symlink = f.prefix/"a"
<add>
<add> dir.mkpath
<add> ln_s dir.basename, symlink
<add>
<add> subject.clean
<add>
<add> expect(dir).not_to exist
<add> expect(symlink).not_to be_a_symlink
<add> expect(symlink).not_to exist
<add> end
<add>
<add> it "removes symlinks pointing to an empty directory" do
<add> dir = f.prefix/"b"
<add> symlink = f.prefix/"c"
<add>
<add> dir.mkpath
<add> ln_s dir.basename, symlink
<add>
<add> subject.clean
<add>
<add> expect(dir).not_to exist
<add> expect(symlink).not_to be_a_symlink
<add> expect(symlink).not_to exist
<add> end
<add>
<add> it "removes broken symlinks" do
<add> symlink = f.prefix/"symlink"
<add> ln_s "target", symlink
<add>
<add> subject.clean
<add>
<add> expect(symlink).not_to be_a_symlink
<add> end
<add>
<add> it "removes '.la' files" do
<add> file = f.lib/"foo.la"
<add>
<add> f.lib.mkpath
<add> touch file
<add>
<add> subject.clean
<add>
<add> expect(file).not_to exist
<add> end
<add>
<add> it "removes 'perllocal' files" do
<add> file = f.lib/"perl5/darwin-thread-multi-2level/perllocal.pod"
<add>
<add> (f.lib/"perl5/darwin-thread-multi-2level").mkpath
<add> touch file
<add>
<add> subject.clean
<add>
<add> expect(file).not_to exist
<add> end
<add>
<add> it "removes '.packlist' files" do
<add> file = f.lib/"perl5/darwin-thread-multi-2level/auto/test/.packlist"
<add>
<add> (f.lib/"perl5/darwin-thread-multi-2level/auto/test").mkpath
<add> touch file
<add>
<add> subject.clean
<add>
<add> expect(file).not_to exist
<add> end
<add>
<add> it "removes 'charset.alias' files" do
<add> file = f.lib/"charset.alias"
<add>
<add> f.lib.mkpath
<add> touch file
<add>
<add> subject.clean
<add>
<add> expect(file).not_to exist
<add> end
<add> end
<add>
<add> describe "::skip_clean" do
<add> it "adds paths that should be skipped" do
<add> f.class.skip_clean "bin"
<add> f.bin.mkpath
<add>
<add> subject.clean
<add>
<add> expect(f.bin).to be_a_directory
<add> end
<add>
<add> it "also skips empty sub-directories under the added paths" do
<add> f.class.skip_clean "bin"
<add> subdir = f.bin/"subdir"
<add> subdir.mkpath
<add>
<add> subject.clean
<add>
<add> expect(f.bin).to be_a_directory
<add> expect(subdir).to be_a_directory
<add> end
<add>
<add> it "allows skipping broken symlinks" do
<add> f.class.skip_clean "symlink"
<add> symlink = f.prefix/"symlink"
<add> ln_s "target", symlink
<add>
<add> subject.clean
<add>
<add> expect(symlink).to be_a_symlink
<add> end
<add>
<add> it "allows skipping symlinks pointing to an empty directory" do
<add> f.class.skip_clean "c"
<add> dir = f.prefix/"b"
<add> symlink = f.prefix/"c"
<add>
<add> dir.mkpath
<add> ln_s dir.basename, symlink
<add>
<add> subject.clean
<add>
<add> expect(dir).not_to exist
<add> expect(symlink).to be_a_symlink
<add> expect(symlink).not_to exist
<add> end
<add>
<add> it "allows skipping symlinks whose target was pruned before" do
<add> f.class.skip_clean "a"
<add> dir = f.prefix/"b"
<add> symlink = f.prefix/"a"
<add>
<add> dir.mkpath
<add> ln_s dir.basename, symlink
<add>
<add> subject.clean
<add>
<add> expect(dir).not_to exist
<add> expect(symlink).to be_a_symlink
<add> expect(symlink).not_to exist
<add> end
<add>
<add> it "allows skipping '.la' files" do
<add> file = f.lib/"foo.la"
<add>
<add> f.class.skip_clean :la
<add> f.lib.mkpath
<add> touch file
<add>
<add> subject.clean
<add>
<add> expect(file).to exist
<add> end
<add>
<add> it "allows skipping sub-directories" do
<add> dir = f.lib/"subdir"
<add> f.class.skip_clean "lib/subdir"
<add>
<add> dir.mkpath
<add>
<add> subject.clean
<add>
<add> expect(dir).to be_a_directory
<add> end
<add>
<add> it "allows skipping paths relative to prefix" do
<add> dir1 = f.bin/"a"
<add> dir2 = f.lib/"bin/a"
<add>
<add> f.class.skip_clean "bin/a"
<add> dir1.mkpath
<add> dir2.mkpath
<add>
<add> subject.clean
<add>
<add> expect(dir1).to exist
<add> expect(dir2).not_to exist
<add> end
<add> end
<add>end
<ide><path>Library/Homebrew/test/cleaner_test.rb
<del>require "testing_env"
<del>require "cleaner"
<del>require "formula"
<del>
<del>class CleanerTests < Homebrew::TestCase
<del> include FileUtils
<del>
<del> def setup
<del> super
<del> @f = formula("cleaner_test") { url "foo-1.0" }
<del> @f.prefix.mkpath
<del> end
<del>
<del> def test_clean_file
<del> @f.bin.mkpath
<del> @f.lib.mkpath
<del> cp "#{TEST_FIXTURE_DIR}/mach/a.out", @f.bin
<del> cp Dir["#{TEST_FIXTURE_DIR}/mach/*.dylib"], @f.lib
<del>
<del> Cleaner.new(@f).clean
<del>
<del> assert_equal 0100555, (@f.bin/"a.out").stat.mode
<del> assert_equal 0100444, (@f.lib/"fat.dylib").stat.mode
<del> assert_equal 0100444, (@f.lib/"x86_64.dylib").stat.mode
<del> assert_equal 0100444, (@f.lib/"i386.dylib").stat.mode
<del> end
<del>
<del> def test_prunes_prefix_if_empty
<del> Cleaner.new(@f).clean
<del> refute_predicate @f.prefix, :directory?
<del> end
<del>
<del> def test_prunes_empty_directories
<del> subdir = @f.bin/"subdir"
<del> subdir.mkpath
<del>
<del> Cleaner.new(@f).clean
<del>
<del> refute_predicate @f.bin, :directory?
<del> refute_predicate subdir, :directory?
<del> end
<del>
<del> def test_skip_clean_empty_directory
<del> @f.class.skip_clean "bin"
<del> @f.bin.mkpath
<del>
<del> Cleaner.new(@f).clean
<del>
<del> assert_predicate @f.bin, :directory?
<del> end
<del>
<del> def test_skip_clean_directory_with_empty_subdir
<del> @f.class.skip_clean "bin"
<del> subdir = @f.bin/"subdir"
<del> subdir.mkpath
<del>
<del> Cleaner.new(@f).clean
<del>
<del> assert_predicate @f.bin, :directory?
<del> assert_predicate subdir, :directory?
<del> end
<del>
<del> def test_removes_symlink_when_target_was_pruned_first
<del> dir = @f.prefix/"b"
<del> symlink = @f.prefix/"a"
<del>
<del> dir.mkpath
<del> ln_s dir.basename, symlink
<del>
<del> Cleaner.new(@f).clean
<del>
<del> refute_predicate dir, :exist?
<del> refute_predicate symlink, :symlink?
<del> refute_predicate symlink, :exist?
<del> end
<del>
<del> def test_removes_symlink_pointing_to_empty_directory
<del> dir = @f.prefix/"b"
<del> symlink = @f.prefix/"c"
<del>
<del> dir.mkpath
<del> ln_s dir.basename, symlink
<del>
<del> Cleaner.new(@f).clean
<del>
<del> refute_predicate dir, :exist?
<del> refute_predicate symlink, :symlink?
<del> refute_predicate symlink, :exist?
<del> end
<del>
<del> def test_removes_broken_symlinks
<del> symlink = @f.prefix/"symlink"
<del> ln_s "target", symlink
<del>
<del> Cleaner.new(@f).clean
<del>
<del> refute_predicate symlink, :symlink?
<del> end
<del>
<del> def test_skip_clean_broken_symlink
<del> @f.class.skip_clean "symlink"
<del> symlink = @f.prefix/"symlink"
<del> ln_s "target", symlink
<del>
<del> Cleaner.new(@f).clean
<del>
<del> assert_predicate symlink, :symlink?
<del> end
<del>
<del> def test_skip_clean_symlink_pointing_to_empty_directory
<del> @f.class.skip_clean "c"
<del> dir = @f.prefix/"b"
<del> symlink = @f.prefix/"c"
<del>
<del> dir.mkpath
<del> ln_s dir.basename, symlink
<del>
<del> Cleaner.new(@f).clean
<del>
<del> refute_predicate dir, :exist?
<del> assert_predicate symlink, :symlink?
<del> refute_predicate symlink, :exist?
<del> end
<del>
<del> def test_skip_clean_symlink_when_target_pruned
<del> @f.class.skip_clean "a"
<del> dir = @f.prefix/"b"
<del> symlink = @f.prefix/"a"
<del>
<del> dir.mkpath
<del> ln_s dir.basename, symlink
<del>
<del> Cleaner.new(@f).clean
<del>
<del> refute_predicate dir, :exist?
<del> assert_predicate symlink, :symlink?
<del> refute_predicate symlink, :exist?
<del> end
<del>
<del> def test_removes_la_files
<del> file = @f.lib/"foo.la"
<del>
<del> @f.lib.mkpath
<del> touch file
<del>
<del> Cleaner.new(@f).clean
<del>
<del> refute_predicate file, :exist?
<del> end
<del>
<del> def test_removes_perllocal_files
<del> file = @f.lib/"perl5/darwin-thread-multi-2level/perllocal.pod"
<del>
<del> (@f.lib/"perl5/darwin-thread-multi-2level").mkpath
<del> touch file
<del>
<del> Cleaner.new(@f).clean
<del>
<del> refute_predicate file, :exist?
<del> end
<del>
<del> def test_removes_packlist_files
<del> file = @f.lib/"perl5/darwin-thread-multi-2level/auto/test/.packlist"
<del>
<del> (@f.lib/"perl5/darwin-thread-multi-2level/auto/test").mkpath
<del> touch file
<del>
<del> Cleaner.new(@f).clean
<del>
<del> refute_predicate file, :exist?
<del> end
<del>
<del> def test_skip_clean_la
<del> file = @f.lib/"foo.la"
<del>
<del> @f.class.skip_clean :la
<del> @f.lib.mkpath
<del> touch file
<del>
<del> Cleaner.new(@f).clean
<del>
<del> assert_predicate file, :exist?
<del> end
<del>
<del> def test_remove_charset_alias
<del> file = @f.lib/"charset.alias"
<del>
<del> @f.lib.mkpath
<del> touch file
<del>
<del> Cleaner.new(@f).clean
<del>
<del> refute_predicate file, :exist?
<del> end
<del>
<del> def test_skip_clean_subdir
<del> dir = @f.lib/"subdir"
<del> @f.class.skip_clean "lib/subdir"
<del>
<del> dir.mkpath
<del>
<del> Cleaner.new(@f).clean
<del>
<del> assert_predicate dir, :directory?
<del> end
<del>
<del> def test_skip_clean_paths_are_anchored_to_prefix
<del> dir1 = @f.bin/"a"
<del> dir2 = @f.lib/"bin/a"
<del>
<del> @f.class.skip_clean "bin/a"
<del> dir1.mkpath
<del> dir2.mkpath
<del>
<del> Cleaner.new(@f).clean
<del>
<del> assert_predicate dir1, :exist?
<del> refute_predicate dir2, :exist?
<del> end
<del>end | 2 |
Python | Python | provide option to run generators on main thread | ce80cd1c85eee49de8e647124b5a87b6ea55ffe6 | <ide><path>keras/engine/training.py
<ide> def fit_generator(self,
<ide> If unspecified, `max_queue_size` will default to 10.
<ide> workers: Integer. Maximum number of processes to spin up
<ide> when using process based threading.
<del> If unspecified, `workers` will default to 1.
<add> If unspecified, `workers` will default to 1. If 0, will
<add> execute the generator on the main thread.
<ide> use_multiprocessing: Boolean. If True, use process based threading.
<ide> If unspecified, `workers` will default to False.
<ide> Note that because
<ide> def generate_arrays_from_file(path):
<ide> enqueuer = None
<ide>
<ide> try:
<del> if is_sequence:
<del> enqueuer = OrderedEnqueuer(generator,
<del> use_multiprocessing=use_multiprocessing,
<del> shuffle=shuffle)
<add> if workers > 0:
<add> if is_sequence:
<add> enqueuer = OrderedEnqueuer(generator,
<add> use_multiprocessing=use_multiprocessing,
<add> shuffle=shuffle)
<add> else:
<add> enqueuer = GeneratorEnqueuer(generator,
<add> use_multiprocessing=use_multiprocessing,
<add> wait_time=wait_time)
<add> enqueuer.start(workers=workers, max_queue_size=max_queue_size)
<add> output_generator = enqueuer.get()
<ide> else:
<del> enqueuer = GeneratorEnqueuer(generator,
<del> use_multiprocessing=use_multiprocessing,
<del> wait_time=wait_time)
<del> enqueuer.start(workers=workers, max_queue_size=max_queue_size)
<del> output_generator = enqueuer.get()
<add> output_generator = generator
<ide>
<ide> callback_model.stop_training = False
<ide> while epoch < epochs:
<ide> def evaluate_generator(self, generator, steps=None,
<ide> Optional for `Sequence`: if unspecified, will use
<ide> the `len(generator)` as a number of steps.
<ide> max_queue_size: maximum size for the generator queue
<del> workers: maximum number of processes to spin up
<del> when using process based threading
<add> workers: Integer. Maximum number of processes to spin up
<add> when using process based threading.
<add> If unspecified, `workers` will default to 1. If 0, will
<add> execute the generator on the main thread.
<ide> use_multiprocessing: if True, use process based threading.
<ide> Note that because
<ide> this implementation relies on multiprocessing,
<ide> def evaluate_generator(self, generator, steps=None,
<ide> enqueuer = None
<ide>
<ide> try:
<del> if is_sequence:
<del> enqueuer = OrderedEnqueuer(generator,
<del> use_multiprocessing=use_multiprocessing)
<add> if workers > 0:
<add> if is_sequence:
<add> enqueuer = OrderedEnqueuer(generator,
<add> use_multiprocessing=use_multiprocessing)
<add> else:
<add> enqueuer = GeneratorEnqueuer(generator,
<add> use_multiprocessing=use_multiprocessing,
<add> wait_time=wait_time)
<add> enqueuer.start(workers=workers, max_queue_size=max_queue_size)
<add> output_generator = enqueuer.get()
<ide> else:
<del> enqueuer = GeneratorEnqueuer(generator,
<del> use_multiprocessing=use_multiprocessing,
<del> wait_time=wait_time)
<del> enqueuer.start(workers=workers, max_queue_size=max_queue_size)
<del> output_generator = enqueuer.get()
<add> output_generator = generator
<ide>
<ide> while steps_done < steps:
<ide> generator_output = next(output_generator)
<ide> def predict_generator(self, generator, steps=None,
<ide> Optional for `Sequence`: if unspecified, will use
<ide> the `len(generator)` as a number of steps.
<ide> max_queue_size: Maximum size for the generator queue.
<del> workers: Maximum number of processes to spin up
<del> when using process based threading
<add> workers: Integer. Maximum number of processes to spin up
<add> when using process based threading.
<add> If unspecified, `workers` will default to 1. If 0, will
<add> execute the generator on the main thread.
<ide> use_multiprocessing: If `True`, use process based threading.
<ide> Note that because
<ide> this implementation relies on multiprocessing,
<ide> def predict_generator(self, generator, steps=None,
<ide> enqueuer = None
<ide>
<ide> try:
<del> if is_sequence:
<del> enqueuer = OrderedEnqueuer(generator,
<del> use_multiprocessing=use_multiprocessing)
<add> if workers > 0:
<add> if is_sequence:
<add> enqueuer = OrderedEnqueuer(generator,
<add> use_multiprocessing=use_multiprocessing)
<add> else:
<add> enqueuer = GeneratorEnqueuer(generator,
<add> use_multiprocessing=use_multiprocessing,
<add> wait_time=wait_time)
<add> enqueuer.start(workers=workers, max_queue_size=max_queue_size)
<add> output_generator = enqueuer.get()
<ide> else:
<del> enqueuer = GeneratorEnqueuer(generator,
<del> use_multiprocessing=use_multiprocessing,
<del> wait_time=wait_time)
<del> enqueuer.start(workers=workers, max_queue_size=max_queue_size)
<del> output_generator = enqueuer.get()
<add> output_generator = generator
<ide>
<ide> if verbose == 1:
<ide> progbar = Progbar(target=steps)
<ide><path>tests/test_multiprocessing.py
<ide> def custom_generator(use_weights=False):
<ide> validation_data=custom_generator(True),
<ide> validation_steps=1)
<ide>
<add> model.fit_generator(custom_generator(True),
<add> steps_per_epoch=5,
<add> validation_data=custom_generator(True),
<add> validation_steps=1,
<add> workers=0)
<add>
<ide> # Test invalid use cases
<ide> def invalid_generator():
<ide> while True:
<ide> def custom_generator():
<ide> steps=5,
<ide> max_queue_size=10,
<ide> use_multiprocessing=False)
<add> model.predict_generator(custom_generator(),
<add> steps=5,
<add> max_queue_size=10,
<add> workers=0)
<ide>
<ide>
<ide> @keras_test
<ide> def custom_generator():
<ide> steps=5,
<ide> max_queue_size=10,
<ide> use_multiprocessing=False)
<add> model.evaluate_generator(custom_generator(),
<add> steps=5,
<add> max_queue_size=10,
<add> use_multiprocessing=False,
<add> workers=0)
<ide>
<ide>
<ide> @keras_test | 2 |
Text | Text | add reason for using nodejs | fc8f1b5a39bd48c0dd6c9a138981200db8421b21 | <ide><path>guide/english/nodejs/index.md
<ide> When the timer completes it's execution taking 5 seconds, it calls the function
<ide> 1. Great for beginners. JavaScript is a beginner friendly language.
<ide> 2. Great supportive community and massive amount of modules (Express, Grunt, etc).
<ide> 3. Wide range of hosting options.
<add>4. Existing Front-End developers get to transfer existing JavaScript knowledge for an easier transition into Server-Side development
<ide>
<ide> #### More information:
<ide> - [Official NodeJS site](https://nodejs.org) | 1 |
Javascript | Javascript | remove deprecated functionality | 6a1cc57e9380fedb9b3b9eadd37ac06cfb5267c2 | <ide><path>packages/ember-metal/lib/accessors.js
<ide> var meta = Ember.meta;
<ide> var get, set;
<ide>
<ide> /** @private */
<del>get = function get(obj, keyName) {
<add>var basicGet = function get(obj, keyName) {
<ide> var ret = obj[keyName];
<ide> if (ret !== undefined) { return ret; }
<ide>
<ide> get = function get(obj, keyName) {
<ide> };
<ide>
<ide> /** @private */
<del>set = function set(obj, keyName, value) {
<add>var basicSet = function set(obj, keyName, value) {
<ide> var isObject = 'object' === typeof obj;
<ide> var hasProp = isObject && !(keyName in obj);
<ide>
<ide> set = function set(obj, keyName, value) {
<ide> } else {
<ide> obj[keyName] = value;
<ide> }
<del> return value;
<ide> };
<ide>
<del>if (!USE_ACCESSORS) {
<del>
<del> var o_get = get, o_set = set;
<del>
<del> /** @private */
<del> get = function(obj, keyName) {
<del> if (keyName === undefined && 'string' === typeof obj) {
<del> keyName = obj;
<del> obj = Ember;
<del> }
<del>
<del> Ember.assert("You need to provide an object and key to `get`.", !!obj && keyName);
<add>/** @private */
<add>get = function(obj, keyName) {
<add> Ember.assert("You need to provide an object and key to `get`.", !!obj && keyName);
<ide>
<del> if (!obj) return undefined;
<del> var desc = meta(obj, false).descs[keyName];
<del> if (desc) return desc.get(obj, keyName);
<del> else return o_get(obj, keyName);
<del> };
<add> var desc = meta(obj, false).descs[keyName];
<add> if (desc) { return desc.get(obj, keyName); }
<add> else { return basicGet(obj, keyName); }
<add>};
<ide>
<del> /** @private */
<del> set = function(obj, keyName, value) {
<del> Ember.assert("You need to provide an object and key to `set`.", !!obj && keyName !== undefined);
<del> var desc = meta(obj, false).descs[keyName];
<del> if (desc) desc.set(obj, keyName, value);
<del> else o_set(obj, keyName, value);
<del> return value;
<del> };
<add>/** @private */
<add>set = function(obj, keyName, value) {
<add> Ember.assert("You need to provide an object and key to `set`.", !!obj && keyName !== undefined);
<ide>
<del>}
<add> var desc = meta(obj, false).descs[keyName];
<add> if (desc) { desc.set(obj, keyName, value); }
<add> else { basicSet(obj, keyName, value); }
<add> return value;
<add>};
<ide>
<ide> /**
<ide> @function
<ide> Ember.set = set;
<ide> // PATHS
<ide> //
<ide>
<del>/** @private */
<del>function cleanupStars(path) {
<del> if (path.indexOf('*') === -1 || path === '*') return path;
<del>
<del> Ember.deprecate('Star paths are now treated the same as normal paths', !/(^|[^\.])\*/.test(path));
<del>
<del> return path.replace(/(^|.)\*/, function(match, char){
<del> return (char === '.') ? match : (char + '.');
<del> });
<del>}
<del>
<ide> /** @private */
<ide> function normalizePath(path) {
<ide> Ember.assert('must pass non-empty string to normalizePath()', path && path!=='');
<del> path = cleanupStars(path);
<ide>
<ide> if (path==='*') return path; //special case...
<ide> var first = path.charAt(0);
<ide> function normalizePath(path) {
<ide> // assumes normalized input; no *, normalized path, always a target...
<ide> /** @private */
<ide> function getPath(target, path) {
<del> var len = path.length, idx, next, key;
<add> if (path === undefined) {
<add> path = target;
<add> target = Ember;
<add> }
<ide>
<del> path = cleanupStars(path);
<add> var len = path.length, idx, next, key;
<ide>
<ide> idx = 0;
<ide> while(target && idx<len) {
<ide> function normalizeTuple(target, path) {
<ide> if (!target || isGlobal) target = window;
<ide> if (hasThis) path = path.slice(5);
<ide>
<del> path = cleanupStars(path);
<del>
<ide> if (target === window) {
<ide> key = firstKey(path);
<ide> target = get(target, key);
<ide> Ember.getPath = function(root, path) {
<ide> root = null;
<ide> }
<ide>
<del> path = cleanupStars(path);
<del>
<ide> // If there is no root and path is a key name, return that
<ide> // property from the global object.
<ide> // E.g. getPath('Ember') -> Ember
<ide><path>packages/ember-metal/tests/accessors/getPath_test.js
<ide> test('[null, Foo.bar] -> Foo.bar', function() {
<ide> deepEqual(Ember.getPath('Foo.bar'), Foo.bar);
<ide> });
<ide>
<del>// ..........................................................
<del>// DEPRECATED
<del>//
<del>
<del>module('Ember.getPath - deprecated', {
<del> setup: function() {
<del> Ember.TESTING_DEPRECATION = true;
<del> moduleOpts.setup();
<del> },
<del> teardown: function() {
<del> Ember.TESTING_DEPRECATION = false;
<del> moduleOpts.teardown();
<del> }
<del>});
<del>
<del>test('[obj, foo*bar] -> obj.foo.bar', function() {
<del> deepEqual(Ember.getPath(obj, 'foo*bar'), obj.foo.bar);
<del>});
<del>
<del>test('[obj, foo*bar.*] -> obj.foo.bar', function() {
<del> deepEqual(Ember.getPath(obj, 'foo*bar.*'), obj.foo.bar);
<del>});
<del>
<del>test('[obj, foo.bar*baz.biff] -> obj.foo.bar.baz.biff', function() {
<del> deepEqual(Ember.getPath(obj, 'foo.bar*baz.biff'), obj.foo.bar.baz.biff);
<del>});
<del>
<del>test('[obj, *foo.bar] -> obj.foo.bar', function() {
<del> deepEqual(Ember.getPath(obj, '*foo.bar'), obj.foo.bar);
<del>});
<del>
<del>test('[obj, this.foo*bar] -> obj.foo.bar', function() {
<del> deepEqual(Ember.getPath(obj, 'this.foo*bar'), obj.foo.bar);
<del>});
<del>
<del>test('[obj, this.foo.bar*baz.biff] -> obj.foo.bar.baz.biff', function() {
<del> deepEqual(Ember.getPath(obj, 'this.foo.bar*baz.biff'), obj.foo.bar.baz.biff);
<del>});
<del>
<del>test('[obj, foo.bar*baz.biff] -> obj.foo.bar.baz.biff', function() {
<del> deepEqual(Ember.getPath(obj, 'foo.bar*baz.biff'), obj.foo.bar.baz.biff);
<del>});
<del>
<del>test('[null, Foo*bar] -> Foo.bar', function() {
<del> deepEqual(Ember.getPath('Foo*bar'), Foo.bar);
<del>});
<del>
<del>test('[null, Foo.bar*baz.biff] -> Foo.bar.baz.biff', function() {
<del> deepEqual(Ember.getPath('Foo.bar*baz.biff'), Foo.bar.baz.biff);
<del>});
<del>
<del>test('[null, Foo.bar.baz*biff] -> Foo.bar.baz.biff', function() {
<del> deepEqual(Ember.getPath('Foo.bar.baz*biff'), Foo.bar.baz.biff);
<del>});
<ide><path>packages/ember-metal/tests/accessors/normalizePath_test.js
<ide> test('.foo.bar -> this.foo.bar', function() {
<ide> equal(Ember.normalizePath('.foo.bar'), 'this.foo.bar');
<ide> });
<ide>
<del>test('*foo.bar -> this.foo.bar', function() {
<del> Ember.TESTING_DEPRECATION = true;
<del> try {
<del> equal(Ember.normalizePath('*foo.bar'), 'this.foo.bar');
<del> } finally {
<del> Ember.TESTING_DEPRECATION = false;
<del> }
<del>});
<del>
<ide><path>packages/ember-metal/tests/accessors/normalizeTuple_test.js
<ide> test('[null, Foo] -> EXCEPTION', function() {
<ide> test('[null, Foo.bar] -> [Foo, bar]', function() {
<ide> deepEqual(Ember.normalizeTuple(null, 'Foo.bar'), [Foo, 'bar']);
<ide> });
<del>
<del>// ..........................................................
<del>// DEPRECATED
<del>//
<del>//
<del>module('Ember.normalizeTuple - deprecated', {
<del> setup: function() {
<del> Ember.TESTING_DEPRECATION = true;
<del> moduleOpts.setup();
<del> },
<del> teardown: function() {
<del> Ember.TESTING_DEPRECATION = false;
<del> moduleOpts.teardown();
<del> }
<del>});
<del>
<del>test('[obj, foo*bar] -> [obj, foo.bar]', function() {
<del> deepEqual(Ember.normalizeTuple(obj, 'foo*bar'), [obj, 'foo.bar']);
<del>});
<del>
<del>test('[obj, foo*bar.*] -> [obj, foo.bar.*]', function() {
<del> deepEqual(Ember.normalizeTuple(obj, 'foo*bar.*'), [obj, 'foo.bar.*']);
<del>});
<del>
<del>test('[obj, foo.bar*baz.biff] -> [obj, foo.bar.baz.biff]', function() {
<del> deepEqual(Ember.normalizeTuple(obj, 'foo.bar*baz.biff'), [obj, 'foo.bar.baz.biff']);
<del>});
<del>
<del>test('[obj, *foo.bar] -> [obj, foo.bar]', function() {
<del> deepEqual(Ember.normalizeTuple(obj, '*foo.bar'), [obj, 'foo.bar']);
<del>});
<del>
<del>test('[obj, this.foo*bar] -> [obj, foo.bar]', function() {
<del> deepEqual(Ember.normalizeTuple(obj, 'this.foo*bar'), [obj, 'foo.bar']);
<del>});
<del>
<del>test('[obj, this.foo.bar*baz.biff] -> [obj, foo.bar.baz.biff]', function() {
<del> deepEqual(Ember.normalizeTuple(obj, 'this.foo.bar*baz.biff'), [obj, 'foo.bar.baz.biff']);
<del>});
<del>
<del>test('[obj, this.foo.bar*baz.biff] -> [obj, foo.bar.baz.biff]', function() {
<del> deepEqual(Ember.normalizeTuple(obj, 'foo.bar*baz.biff'), [obj, 'foo.bar.baz.biff']);
<del>});
<del>
<del>test('[null, Foo*bar] -> [Foo, bar]', function() {
<del> deepEqual(Ember.normalizeTuple(null, 'Foo*bar'), [Foo, 'bar']);
<del>});
<del>
<del>test('[null, Foo.bar*baz.biff] -> [Foo, bar.baz.biff]', function() {
<del> deepEqual(Ember.normalizeTuple(null, 'Foo.bar*baz.biff'), [Foo, 'bar.baz.biff']);
<del>});
<del>
<del>test('[null, Foo.bar.baz*biff] -> [Foo, bar.baz.biff]', function() {
<del> deepEqual(Ember.normalizeTuple(null, 'Foo.bar.baz*biff'), [Foo, 'bar.baz.biff']);
<del>});
<del>
<del>test('[obj, Foo*bar] -> [Foo, bar]', function() {
<del> deepEqual(Ember.normalizeTuple(obj, 'Foo*bar'), [Foo, 'bar']);
<del>});
<del>
<del>test('[obj, Foo.bar*baz.biff] -> [Foo, bar.baz.biff]', function() {
<del> deepEqual(Ember.normalizeTuple(obj, 'Foo.bar*baz.biff'), [Foo, 'bar.baz.biff']);
<del>});
<del>
<del>test('[obj, Foo.bar.baz*biff] -> [Foo, bar.baz.biff]', function() {
<del> deepEqual(Ember.normalizeTuple(obj, 'Foo.bar.baz*biff'), [Foo, 'bar.baz.biff']);
<del>});
<ide><path>packages/ember-metal/tests/accessors/setPath_test.js
<ide> module("Ember.setPath - deprecated", {
<ide> }
<ide> });
<ide>
<del>test('[obj, foo*bar] -> obj.foo.bar', function() {
<del> Ember.setPath(obj, 'foo*bar', "BAM");
<del> equal(Ember.getPath(obj, 'foo.bar'), "BAM");
<del>});
<del>
<del>test('[obj, foo*bar.*] -> EXCEPTION', function() {
<del> raises(function() {
<del> Ember.setPath(obj, 'foo.*.baz.*', "BAM");
<del> }, Error);
<del>});
<del>
<del>test('[obj, foo.bar*baz.biff] -> obj.foo.bar.baz.biff', function() {
<del> Ember.setPath(obj, 'foo.bar*baz.biff', "BAM");
<del> equal(Ember.getPath(obj, 'foo.bar.baz.biff'), "BAM");
<del>});
<del>
<del>test('[obj, *foo.bar] -> obj.foo.bar', function() {
<del> Ember.setPath(obj, '*foo.bar', "BAM");
<del> equal(Ember.getPath(obj, 'foo.bar'), "BAM");
<del>});
<del>
<del>test('[obj, this.foo*bar] -> obj.foo.bar', function() {
<del> Ember.setPath(obj, 'this.foo*bar', "BAM");
<del> equal(Ember.getPath(obj, 'foo.bar'), "BAM");
<del>});
<del>
<del>test('[obj, this.foo.bar*baz.biff] -> obj.foo.bar.baz.biff', function() {
<del> Ember.setPath(obj, 'this.foo.bar*baz.biff', "BAM");
<del> equal(Ember.getPath(obj, 'foo.bar.baz.biff'), "BAM");
<del>});
<del>
<del>test('[null, Foo*bar] -> Foo.bar', function() {
<del> Ember.setPath(null, 'Foo*bar', "BAM");
<del> equal(Ember.getPath(Foo, 'bar'), "BAM");
<del>});
<del>
<del>test('[null, Foo.bar*baz.biff] -> Foo.bar.baz.biff', function() {
<del> Ember.setPath(null, 'Foo.bar*baz.biff', "BAM");
<del> equal(Ember.getPath(Foo, 'bar.baz.biff'), "BAM");
<del>});
<del>
<del>test('[null, Foo.bar.baz*biff] -> Foo.bar.baz.biff', function() {
<del> Ember.setPath(null, 'Foo.bar.baz*biff', "BAM");
<del> equal(Ember.getPath(Foo, 'bar.baz.biff'), "BAM");
<del>});
<del>
<ide> test('[obj, Foo] -> EXCEPTION', function() {
<ide> raises(function() {
<ide> Ember.setPath(obj, 'Foo', "BAM");
<ide><path>packages/ember-runtime/tests/legacy_1x/mixins/observable/observable_test.js
<ide> test("raise if the provided object is undefined", function() {
<ide>
<ide> test("should work when object is Ember (used in Ember.getPath)", function() {
<ide> equal(Ember.getPath('Ember.RunLoop'), Ember.RunLoop, 'Ember.getPath');
<del> equal(Ember.get('RunLoop'), Ember.RunLoop, 'Ember.get(RunLoop)');
<ide> equal(Ember.get(Ember, 'RunLoop'), Ember.RunLoop, 'Ember.get(Ember, RunLoop)');
<ide> });
<ide>
<ide><path>packages/ember-runtime/tests/legacy_1x/system/object/bindings_test.js
<ide> test("Ember.Binding.bool(TestNamespace.fromObject.bar)) should create binding wi
<ide> equal(false, get(testObject, "foo"), "testObject.foo == false");
<ide> });
<ide>
<del>
<del>module("bind() method - deprecated", {
<del> setup: function() {
<del> Ember.TESTING_DEPRECATION = true;
<del> bindModuleOpts.setup();
<del> },
<del> teardown: function() {
<del> Ember.TESTING_DEPRECATION = false;
<del> bindModuleOpts.teardown();
<del> }
<del>});
<del>
<del>test("bind(TestNamespace.fromObject*extraObject.foo) should create chained binding", function() {
<del> Ember.run(function(){
<del> testObject.bind("foo", "TestNamespace.fromObject*extraObject.foo");
<del> set(fromObject, "extraObject", extraObject);
<del> });
<del>
<del> equal("extraObjectValue", get(testObject, "foo"), "testObject.foo") ;
<del>});
<del>
<del>test("bind(*extraObject.foo) should create locally chained binding", function() {
<del> Ember.run(function(){
<del> testObject.bind("foo", "*extraObject.foo");
<del> set(testObject, "extraObject", extraObject);
<del> });
<del>
<del> equal("extraObjectValue", get(testObject, "foo"), "testObject.foo") ;
<del>});
<del>
<del>
<del>// The following contains no test
<del>test("bind(*extraObject.foo) should be disconnectable", function() {
<del> var binding;
<del> Ember.run(function(){
<del> binding = testObject.bind("foo", "*extraObject.foo");
<del> });
<del>
<del> binding.disconnect(testObject);
<del>
<del> Ember.run(function(){
<del> set(testObject, 'extraObject', extraObject);
<del> });
<del>
<del> // there was actually a bug here - the binding above should have synced to
<del> // null as there was no original value
<del> equal(null, get(testObject, "foo"), "testObject.foo after disconnecting");
<del>});
<del>
<ide> var fooBindingModuleOpts = {
<ide>
<ide> setup: function() {
<ide> test('fooBinding: should disconnect bindings when destroyed', function () {
<ide>
<ide> ok(get(testObject, 'foo') !== 'bar', 'binding should not have synced');
<ide> });
<del>
<del>
<del>module("fooBinding method - deprecated", {
<del> setup: function() {
<del> Ember.TESTING_DEPRECATION = true;
<del> fooBindingModuleOpts.setup();
<del> },
<del> teardown: function() {
<del> Ember.TESTING_DEPRECATION = false;
<del> fooBindingModuleOpts.teardown();
<del> }
<del>});
<del>
<del>test("fooBinding: TestNamespace.fromObject*extraObject.foo should create chained binding", function() {
<del>
<del> Ember.run(function(){
<del> testObject = TestObject.create({
<del> fooBinding: "TestNamespace.fromObject*extraObject.foo"
<del> });
<del>
<del> set(fromObject, "extraObject", extraObject);
<del> });
<del>
<del> equal("extraObjectValue", get(testObject, "foo"), "testObject.foo") ;
<del>});
<del>
<del>test("fooBinding: *extraObject.foo should create locally chained binding", function() {
<del> Ember.run(function(){
<del> testObject = TestObject.create({
<del> fooBinding: "*extraObject.foo"
<del> });
<del> set(testObject, "extraObject", extraObject);
<del> });
<del>
<del> equal("extraObjectValue", get(testObject, "foo"), "testObject.foo") ;
<del>}); | 7 |
Text | Text | add note about higher/lower-level transition apis | 76496b3cca508105816c0497c305dc41b5633be4 | <ide><path>docs/docs/09.1-animation.md
<ide> You'll notice that when you try to remove an item `ReactCSSTransitionGroup` keep
<ide>
<ide> You can disable animating `enter` or `leave` animations if you want. For example, sometimes you may want an `enter` animation and no `leave` animation, but `ReactCSSTransitionGroup` waits for an animation to complete before removing your DOM node. You can add `transitionEnter={false}` or `transitionLeave={false}` props to `ReactCSSTransitionGroup` to disable these animations.
<ide>
<add>> Note:
<add>>
<add>> When using `ReactCSSTransitionGroup`, there's no way for your components to be notified when a transition has ended or to perform any more complex logic around animation. If you want more fine-grained control, you can use the lower-level `ReactTransitionGroup` API which provides the hooks you need to do custom transitions.
<add>
<ide> ## Low-level API: `ReactTransitionGroup`
<ide>
<ide> `ReactTransitionGroup` is the basis for animations. When children are declaratively added or removed from it (as in the example above) special lifecycle hooks are called on them. | 1 |
Text | Text | clarify key binding a bit | a650635c9708767772648572ea7ec1be361313a7 | <ide><path>docs/getting-started.md
<ide> operate on the whole buffer.
<ide>
<ide> ### Split Panes
<ide>
<del>You can split any editor pane horizontally or vertically by using `ctrl-w v,
<del>ctrl-|`. Once you have a split pane, you can move focus between them with
<del>`ctrl-tab`. To close a pane, close all tabs inside it.
<add>You can split any editor pane horizontally or vertically by using `ctrl-shift-|` or
<add>`ctrl-w v`. Once you have a split pane, you can move focus between them with
<add>`ctrl-tab` or `ctrl-w w`. To close a pane, close all tabs inside it.
<ide>
<ide> ### Folding
<ide> | 1 |
Javascript | Javascript | evaluate delegate selectors at add time | 7fd36ea145a11d5896de6d064b546b1c57a83f34 | <ide><path>src/event.js
<ide> jQuery.event = {
<ide> selector = handleObjIn.selector;
<ide> }
<ide>
<add> // If the selector is invalid, throw any exceptions at attach time
<add> if ( selector ) {
<add> jQuery.find( selector, elem );
<add> }
<add>
<ide> // Make sure that the handler has a unique ID, used to find/remove it later
<ide> if ( !handler.guid ) {
<ide> handler.guid = jQuery.guid++;
<ide><path>test/unit/event.js
<ide> QUnit.test( "Delegated events in SVG (#10791; #13180)", function( assert ) {
<ide> jQuery( "#qunit-fixture" ).off( "click" );
<ide> } );
<ide>
<add>QUnit.test( "Delegated events with malformed selectors (#3071)", function( assert ) {
<add> assert.expect( 2 );
<add>
<add> assert.throws( function () {
<add> jQuery( "#qunit-fixture" ).on( "click", "div:not", function () { } );
<add> }, null, "malformed selector throws on attach" );
<add>
<add> jQuery( "#qunit-fixture" ).click();
<add> assert.ok( true, "malformed selector does not throw on event" );
<add>
<add> jQuery( "#qunit-fixture" ).off( "click" );
<add>} );
<add>
<ide> QUnit.test( "Delegated events in forms (#10844; #11145; #8165; #11382, #11764)", function( assert ) {
<ide> assert.expect( 5 );
<ide> | 2 |
Javascript | Javascript | create prepare-hermes-for-build.js script | 6c2e34be0b734cd59a6f114746b229291439ffb8 | <ide><path>scripts/hermes/prepare-hermes-for-build.js
<add>/**
<add> * Copyright (c) Meta Platforms, Inc. and affiliates.
<add> *
<add> * This source code is licensed under the MIT license found in the
<add> * LICENSE file in the root directory of this source tree.
<add> *
<add> * @format
<add> */
<add>
<add>'use strict';
<add>
<add>/**
<add> * This script prepares Hermes to be built as part of the
<add> * iOS build pipeline on macOS.
<add> */
<add>const {
<add> copyBuildScripts,
<add> downloadHermesTarball,
<add> expandHermesTarball,
<add>} = require('./hermes-utils');
<add>
<add>downloadHermesTarball();
<add>expandHermesTarball();
<add>copyBuildScripts(); | 1 |
Javascript | Javascript | remove unnecessary check for globals | 5f33521be529cc7046d517e54fa93a5a220c40c7 | <ide><path>lib/repl.js
<ide> REPLServer.prototype.complete = function(line, callback) {
<ide> completionGroupsLoaded();
<ide> } else {
<ide> this.eval('.scope', this.context, 'repl', function(err, globals) {
<del> if (err || !globals || !Array.isArray(globals)) {
<add> if (err || !Array.isArray(globals)) {
<ide> addStandardGlobals(completionGroups, filter);
<ide> } else if (Array.isArray(globals[0])) {
<ide> // Add grouped globals | 1 |
Javascript | Javascript | add info about `defaults.cache` | 637d3b47d191eb9353531abfdc9f5460e0eff5ba | <ide><path>src/ng/http.js
<ide> function $HttpProvider() {
<ide> *
<ide> * Object containing default values for all {@link ng.$http $http} requests.
<ide> *
<add> * - **`defaults.cache`** - {Object} - an object built with {@link ng.$cacheFactory `$cacheFactory`}
<add> * that will provide the cache for all requests who set their `cache` property to `true`.
<add> * If you set the `default.cache = false` then only requests that specify their own custom
<add> * cache object will be cached. See {@link $http#caching $http Caching} for more information.
<add> *
<ide> * - **`defaults.xsrfCookieName`** - {string} - Name of cookie containing the XSRF token.
<ide> * Defaults value is `'XSRF-TOKEN'`.
<ide> *
<ide> function $HttpProvider() {
<ide> * - **`defaults.headers.post`**
<ide> * - **`defaults.headers.put`**
<ide> * - **`defaults.headers.patch`**
<add> *
<ide> **/
<ide> var defaults = this.defaults = {
<ide> // transform incoming response data | 1 |
Text | Text | fix 80 char. error | ca0885729df52698264dd10ba403eb8ab88d9642 | <ide><path>README.md
<ide> Want to hack on Docker? Awesome! There are instructions to get you
<ide> started [here](CONTRIBUTING.md). If you'd like to contribute to the
<ide> documentation, please take a look at this [README.md](https://github.com/docker/docker/blob/master/docs/README.md).
<ide>
<del>These instructions are probably not perfect, please let us know if anything feels wrong or incomplete.
<add>These instructions are probably not perfect, please let us know if anything
<add>feels wrong or incomplete.
<ide>
<ide> ### Legal
<ide> | 1 |
PHP | PHP | fix failing test | d3f9cc10b5156ebb98cc30bc42bb3de7a2ed2e28 | <ide><path>lib/Cake/Test/Case/Controller/Component/PaginatorComponentTest.php
<ide> class ControllerPaginateModel extends CakeTestModel {
<ide> /**
<ide> * paginate method
<ide> *
<del> * @return void
<add> * @return boolean
<ide> */
<ide> public function paginate($conditions, $fields, $order, $limit, $page, $recursive, $extra) {
<ide> $this->extra = $extra;
<add> return true;
<ide> }
<ide>
<ide> /** | 1 |
Text | Text | add changelog for in empty array | 54f3e67172247b57379ec84b489e892620b743a5 | <ide><path>activerecord/CHANGELOG.md
<add>* `where(attr => [])` now loads an empty result without making a query.
<add>
<add> *John Hawthorn*
<add>
<ide> * Fixed the performance regression for `primary_keys` introduced MySQL 8.0.
<ide>
<ide> *Hiroyuki Ishii* | 1 |
PHP | PHP | add multiple responses and response clearing | 3f2ff0136a2d977f21a375ccdeedce02d55468a5 | <ide><path>src/Http/Client.php
<ide> class Client implements ClientInterface
<ide> /**
<ide> * Mock adapter for stubbing requests in tests.
<ide> *
<del> * @var \Cake\Http\Client\Adapter\Mock
<add> * @var \Cake\Http\Client\Adapter\Mock|null
<ide> */
<ide> protected static $_mockAdapter;
<ide>
<ide> public function send(RequestInterface $request, array $options = []): Response
<ide> return $response;
<ide> }
<ide>
<add> /**
<add> * Clear all mocked responses
<add> *
<add> * @return void
<add> */
<add> public static function clearMockResponses(): void
<add> {
<add> static::$_mockAdapter = null;
<add> }
<add>
<ide> /**
<ide> * Add a mocked response.
<ide> *
<ide><path>src/Http/Client/Adapter/Mock.php
<ide>
<ide> use Cake\Http\Client\AdapterInterface;
<ide> use Cake\Http\Client\Response;
<add>use Closure;
<ide> use InvalidArgumentException;
<ide> use Psr\Http\Message\RequestInterface;
<ide>
<ide> class Mock implements AdapterInterface
<ide> */
<ide> public function addResponse(RequestInterface $request, Response $response, array $options): void
<ide> {
<del> if (isset($mock['options']['match']) && !is_callable($mock['options']['match'])) {
<del> throw new InvalidArgumentException('The `match` option must be a callable');
<add> if (isset($options['match']) && !($options['match'] instanceof Closure)) {
<add> $type = getTypeName($options['match']);
<add> throw new InvalidArgumentException("The `match` option must be a `Closure`. Got `{$type}`.");
<ide> }
<ide> $this->responses[] = [
<ide> 'request' => $request,
<ide> public function addResponse(RequestInterface $request, Response $response, array
<ide> public function send(RequestInterface $request, array $options): array
<ide> {
<ide> $found = null;
<del> foreach ($this->responses as $mock) {
<add> foreach ($this->responses as $index => $mock) {
<ide> if ($request->getMethod() !== $mock['request']->getMethod()) {
<ide> continue;
<ide> }
<ide> public function send(RequestInterface $request, array $options): array
<ide> if (isset($mock['options']['match'])) {
<ide> $match = $mock['options']['match']($request);
<ide> if (!is_bool($match)) {
<del> throw new InvalidArgumentException('Match callback return a non-boolean value.');
<add> throw new InvalidArgumentException('Match callback must return a boolean value.');
<ide> }
<ide> if (!$match) {
<ide> continue;
<ide> }
<ide> }
<del> $found = $mock['response'];
<add> $found = $index;
<ide> break;
<ide> }
<add> if ($found !== null) {
<add> // Move the current mock to the end so that when there are multiple
<add> // matches for a URL the next match is used on subsequent requests.
<add> $mock = $this->responses[$found];
<add> unset($this->responses[$found]);
<add> $this->responses[] = $mock;
<ide>
<del> return $found ? [$found] : [];
<add> return [$mock['response']];
<add> }
<add>
<add> return [];
<ide> }
<ide>
<ide> /**
<ide><path>tests/TestCase/Http/ClientTest.php
<ide> */
<ide> class ClientTest extends TestCase
<ide> {
<add> public function tearDown(): void
<add> {
<add> parent::tearDown();
<add>
<add> Client::clearMockResponses();
<add> }
<add>
<ide> /**
<ide> * Test storing config options and modifying them.
<ide> */
<ide> public function testAddMockResponseSimpleMatch(): void
<ide> }
<ide>
<ide> /**
<del> * Test adding and sending to a mocked URL.
<add> * When there are multiple matches for a URL the responses should
<add> * be used in a cycle.
<add> */
<add> public function testAddMockResponseMultipleMatches(): void
<add> {
<add> $one = new Response(['HTTP/1.0 200'], 'one');
<add> Client::addMockResponse('GET', 'http://example.com/info', $one);
<add>
<add> $two = new Response(['HTTP/1.0 200'], 'two');
<add> Client::addMockResponse('GET', 'http://example.com/info', $two);
<add>
<add> $client = new Client();
<add>
<add> $response = $client->get('http://example.com/info');
<add> $this->assertSame($one, $response);
<add>
<add> $response = $client->get('http://example.com/info');
<add> $this->assertSame($two, $response);
<add>
<add> $response = $client->get('http://example.com/info');
<add> $this->assertSame($one, $response);
<add> }
<add>
<add> /**
<add> * When there are multiple matches with custom match functions
<add> */
<add> public function testAddMockResponseMultipleMatchesCustom(): void
<add> {
<add> $one = new Response(['HTTP/1.0 200'], 'one');
<add> Client::addMockResponse('GET', 'http://example.com/info', $one, [
<add> 'match' => function ($request) {
<add> return false;
<add> },
<add> ]);
<add>
<add> $two = new Response(['HTTP/1.0 200'], 'two');
<add> Client::addMockResponse('GET', 'http://example.com/info', $two);
<add>
<add> $client = new Client();
<add>
<add> $response = $client->get('http://example.com/info');
<add> $this->assertSame($two, $response);
<add>
<add> $response = $client->get('http://example.com/info');
<add> $this->assertSame($two, $response);
<add> }
<add>
<add> /**
<add> * Mock match failures should result in the request being sent
<ide> */
<ide> public function testAddMockResponseMethodMatchFailure(): void
<ide> {
<ide> public function testAddMockResponseMethodMatchFailure(): void
<ide>
<ide> $client = new Client(['adapter' => $mock]);
<ide> $this->expectException(InvalidArgumentException::class);
<add> $this->expectExceptionMessage('No match');
<add>
<ide> $client->get('http://example.com/path');
<ide> }
<ide>
<ide> /**
<del> * Test adding and sending to a mocked URL.
<add> * Trailing /* patterns should work
<ide> */
<ide> public function testAddMockResponseGlobMatch(): void
<ide> {
<ide> public function testAddMockResponseGlobMatch(): void
<ide> $response = $client->post('http://example.com/path/?query=value');
<ide> $this->assertSame($stub, $response);
<ide> }
<add>
<add> /**
<add> * Custom match methods must be closures
<add> */
<add> public function testAddMockResponseInvalidMatch(): void
<add> {
<add> $this->expectException(InvalidArgumentException::class);
<add> $this->expectExceptionMessage('The `match` option must be a `Closure`.');
<add>
<add> $stub = new Response(['HTTP/1.0 200'], 'hello world');
<add> Client::addMockResponse('POST', 'http://example.com/path', $stub, [
<add> 'match' => 'oops',
<add> ]);
<add> }
<add>
<add> /**
<add> * Custom matchers should get a request.
<add> */
<add> public function testAddMockResponseCustomMatch(): void
<add> {
<add> $stub = new Response(['HTTP/1.0 200'], 'hello world');
<add> Client::addMockResponse('POST', 'http://example.com/path', $stub, [
<add> 'match' => function ($request) {
<add> $this->assertInstanceOf(Request::class, $request);
<add> $uri = $request->getUri();
<add> $this->assertEquals('/path', $uri->getPath());
<add> $this->assertEquals('example.com', $uri->getHost());
<add>
<add> return true;
<add> },
<add> ]);
<add>
<add> $client = new Client();
<add> $response = $client->post('http://example.com/path');
<add>
<add> $this->assertSame($stub, $response);
<add> }
<add>
<add> /**
<add> * Custom matchers can fail the match
<add> */
<add> public function testAddMockResponseCustomNoMatch(): void
<add> {
<add> $stub = new Response(['HTTP/1.0 200'], 'hello world');
<add> Client::addMockResponse('POST', 'http://example.com/path', $stub, [
<add> 'match' => function ($request) {
<add> return false;
<add> },
<add> ]);
<add>
<add> $mock = $this->getMockBuilder(Stream::class)
<add> ->onlyMethods(['send'])
<add> ->getMock();
<add> $mock->expects($this->once())
<add> ->method('send')
<add> ->will($this->throwException(new InvalidArgumentException('No match')));
<add>
<add> $client = new Client(['adapter' => $mock]);
<add> $this->expectException(InvalidArgumentException::class);
<add> $this->expectExceptionMessage('No match');
<add>
<add> $client->post('http://example.com/path');
<add> }
<add>
<add> /**
<add> * Custom matchers must return a boolean
<add> */
<add> public function testAddMockResponseCustomInvalidDecision(): void
<add> {
<add> $stub = new Response(['HTTP/1.0 200'], 'hello world');
<add> Client::addMockResponse('POST', 'http://example.com/path', $stub, [
<add> 'match' => function ($request) {
<add> return 'invalid';
<add> },
<add> ]);
<add>
<add> $client = new Client();
<add> $this->expectException(InvalidArgumentException::class);
<add> $this->expectExceptionMessage('Match callback must');
<add>
<add> $client->post('http://example.com/path');
<add> }
<ide> } | 3 |
Ruby | Ruby | treat timingsafe_bcmp as weak on 10.11 | e26750e11290f6b299fcbf8419ac051a985e0e1a | <ide><path>Library/Homebrew/extend/os/mac/extend/ENV/super.rb
<ide> def setup_build_environment(formula = nil)
<ide> # can't reliably figure this out with Xcode 8 on its own yet.
<ide> if MacOS.version == "10.11" && MacOS::Xcode.installed? && MacOS::Xcode.version >= "8.0"
<ide> %w[basename_r clock_getres clock_gettime clock_settime dirname_r
<del> getentropy mkostemp mkostemps].each do |s|
<add> getentropy mkostemp mkostemps timingsafe_bcmp].each do |s|
<ide> ENV["ac_cv_func_#{s}"] = "no"
<ide> end
<ide> | 1 |
Ruby | Ruby | remove unnecessary tap | af02b9b78f7b735345a891222532d32caf871520 | <ide><path>activestorage/test/models/attached/many_test.rb
<ide> class ActiveStorage::ManyAttachedTest < ActiveSupport::TestCase
<ide> end
<ide>
<ide> test "replacing existing, independent attachments on an existing record via assign and attach" do
<del> [ create_blob(filename: "funky.mp4"), create_blob(filename: "town.mp4") ].tap do |old_blobs|
<del> @user.vlogs.attach old_blobs
<del>
<del> @user.vlogs = []
<del> assert_not @user.vlogs.attached?
<add> @user.vlogs.attach create_blob(filename: "funky.mp4"), create_blob(filename: "town.mp4")
<ide>
<del> assert_no_enqueued_jobs only: ActiveStorage::PurgeJob do
<del> @user.vlogs.attach create_blob(filename: "whenever.mp4"), create_blob(filename: "wherever.mp4")
<del> end
<add> @user.vlogs = []
<add> assert_not @user.vlogs.attached?
<ide>
<del> assert_equal "whenever.mp4", @user.vlogs.first.filename.to_s
<del> assert_equal "wherever.mp4", @user.vlogs.second.filename.to_s
<add> assert_no_enqueued_jobs only: ActiveStorage::PurgeJob do
<add> @user.vlogs.attach create_blob(filename: "whenever.mp4"), create_blob(filename: "wherever.mp4")
<ide> end
<add>
<add> assert_equal "whenever.mp4", @user.vlogs.first.filename.to_s
<add> assert_equal "wherever.mp4", @user.vlogs.second.filename.to_s
<ide> end
<ide>
<ide> test "successfully updating an existing record to replace existing, dependent attachments" do | 1 |
Python | Python | add rokenizer test for zero length string | 363473aeed5a4ced383f6c6b14d280b15c9c5db9 | <ide><path>tests/test_tokenizer.py
<ide> def EN():
<ide> return English().tokenizer
<ide>
<add>def test_no_word(EN):
<add> tokens = EN(u'')
<add> assert len(tokens) == 0
<add>
<ide> def test_single_word(EN):
<ide> tokens = EN(u'hello')
<ide> assert tokens[0].orth_ == 'hello' | 1 |
Ruby | Ruby | remove code for ruby 1.8.x support | a1cffa6d5849b45f439be62742ccca1633dfc9bd | <ide><path>actionpack/lib/action_dispatch/journey/router/utils.rb
<ide> module UriEscape
<ide> safe_pchar = "#{URI::REGEXP::PATTERN::UNRESERVED}#{reserved_pchar}"
<ide> safe_segment = "#{safe_pchar}#{reserved_segment}"
<ide> safe_fragment = "#{safe_pchar}#{reserved_fragment}"
<del> if RUBY_VERSION >= '1.9'
<del> UNSAFE_SEGMENT = Regexp.new("[^#{safe_segment}]", false).freeze
<del> UNSAFE_FRAGMENT = Regexp.new("[^#{safe_fragment}]", false).freeze
<del> else
<del> UNSAFE_SEGMENT = Regexp.new("[^#{safe_segment}]", false, 'N').freeze
<del> UNSAFE_FRAGMENT = Regexp.new("[^#{safe_fragment}]", false, 'N').freeze
<del> end
<add> UNSAFE_SEGMENT = Regexp.new("[^#{safe_segment}]", false).freeze
<add> UNSAFE_FRAGMENT = Regexp.new("[^#{safe_fragment}]", false).freeze
<ide> end
<ide>
<ide> Parser = URI.const_defined?(:Parser) ? URI::Parser.new : URI | 1 |
Text | Text | fix shadow props | 3c9092acf39ecdb7c137a3cb0d4282694e95cbf5 | <ide><path>docs/shadow-props.md
<ide> title: Shadow Props
<ide> layout: docs
<ide> category: APIs
<ide> permalink: docs/shadow-props.html
<del>next: view-props
<add>next: view
<ide> previous: layout-props
<ide> ---
<ide> ### Props | 1 |
Text | Text | add contributor agreement | dba6adea6513b3b840e8eef2aa9632e2ffa6edbc | <ide><path>.github/contributors/fucking-signup.md
<add># spaCy contributor agreement
<add>
<add>This spaCy Contributor Agreement (**"SCA"**) is based on the
<add>[Oracle Contributor Agreement](http://www.oracle.com/technetwork/oca-405177.pdf).
<add>The SCA applies to any contribution that you make to any product or project
<add>managed by us (the **"project"**), and sets out the intellectual property rights
<add>you grant to us in the contributed materials. The term **"us"** shall mean
<add>[ExplosionAI UG (haftungsbeschränkt)](https://explosion.ai/legal). The term
<add>**"you"** shall mean the person or entity identified below.
<add>
<add>If you agree to be bound by these terms, fill in the information requested
<add>below and include the filled-in version with your first pull request, under the
<add>folder [`.github/contributors/`](/.github/contributors/). The name of the file
<add>should be your GitHub username, with the extension `.md`. For example, the user
<add>example_user would create the file `.github/contributors/example_user.md`.
<add>
<add>Read this agreement carefully before signing. These terms and conditions
<add>constitute a binding legal agreement.
<add>
<add>## Contributor Agreement
<add>
<add>1. The term "contribution" or "contributed materials" means any source code,
<add>object code, patch, tool, sample, graphic, specification, manual,
<add>documentation, or any other material posted or submitted by you to the project.
<add>
<add>2. With respect to any worldwide copyrights, or copyright applications and
<add>registrations, in your contribution:
<add>
<add> * you hereby assign to us joint ownership, and to the extent that such
<add> assignment is or becomes invalid, ineffective or unenforceable, you hereby
<add> grant to us a perpetual, irrevocable, non-exclusive, worldwide, no-charge,
<add> royalty-free, unrestricted license to exercise all rights under those
<add> copyrights. This includes, at our option, the right to sublicense these same
<add> rights to third parties through multiple levels of sublicensees or other
<add> licensing arrangements;
<add>
<add> * you agree that each of us can do all things in relation to your
<add> contribution as if each of us were the sole owners, and if one of us makes
<add> a derivative work of your contribution, the one who makes the derivative
<add> work (or has it made will be the sole owner of that derivative work;
<add>
<add> * you agree that you will not assert any moral rights in your contribution
<add> against us, our licensees or transferees;
<add>
<add> * you agree that we may register a copyright in your contribution and
<add> exercise all ownership rights associated with it; and
<add>
<add> * you agree that neither of us has any duty to consult with, obtain the
<add> consent of, pay or render an accounting to the other for any use or
<add> distribution of your contribution.
<add>
<add>3. With respect to any patents you own, or that you can license without payment
<add>to any third party, you hereby grant to us a perpetual, irrevocable,
<add>non-exclusive, worldwide, no-charge, royalty-free license to:
<add>
<add> * make, have made, use, sell, offer to sell, import, and otherwise transfer
<add> your contribution in whole or in part, alone or in combination with or
<add> included in any product, work or materials arising out of the project to
<add> which your contribution was submitted, and
<add>
<add> * at our option, to sublicense these same rights to third parties through
<add> multiple levels of sublicensees or other licensing arrangements.
<add>
<add>4. Except as set out above, you keep all right, title, and interest in your
<add>contribution. The rights that you grant to us under these terms are effective
<add>on the date you first submitted a contribution to us, even if your submission
<add>took place before the date you sign these terms.
<add>
<add>5. You covenant, represent, warrant and agree that:
<add>
<add> * Each contribution that you submit is and shall be an original work of
<add> authorship and you can legally grant the rights set out in this SCA;
<add>
<add> * to the best of your knowledge, each contribution will not violate any
<add> third party's copyrights, trademarks, patents, or other intellectual
<add> property rights; and
<add>
<add> * each contribution shall be in compliance with U.S. export control laws and
<add> other applicable export and import laws. You agree to notify us if you
<add> become aware of any circumstance which would make any of the foregoing
<add> representations inaccurate in any respect. We may publicly disclose your
<add> participation in the project, including the fact that you have signed the SCA.
<add>
<add>6. This SCA is governed by the laws of the State of California and applicable
<add>U.S. Federal law. Any choice of law rules will not apply.
<add>
<add>7. Please place an “x” on one of the applicable statement below. Please do NOT
<add>mark both statements:
<add>
<add> * [x] I am signing on behalf of myself as an individual and no other person
<add> or entity, including my employer, has or will have rights with respect to my
<add> contributions.
<add>
<add> * [ ] I am signing on behalf of my employer or a legal entity and I have the
<add> actual authority to contractually bind that entity.
<add>
<add>## Contributor Details
<add>
<add>| Field | Entry |
<add>|------------------------------- | -------------------- |
<add>| Name | Kit |
<add>| Company name (if applicable) | - |
<add>| Title or role (if applicable) | - |
<add>| Date | 2018/01/08 |
<add>| GitHub username | fucking-signup |
<add>| Website (optional) | - | | 1 |
Python | Python | improve autoencoder check | 8a2ae93ba745fc69f130a42a6a2a79464cdc468f | <ide><path>tests/manual/check_autoencoder.py
<ide> from keras.layers.core import Layer
<ide> from keras.layers import containers
<ide> from keras.utils import np_utils
<del>
<ide> import numpy as np
<ide>
<del># Try different things here: 'lstm' or 'classical' or 'denoising'
<del># or 'deep_denoising'
<del>autoencoder_type = 'deep_denoising'
<del>
<ide> nb_classes = 10
<ide> batch_size = 128
<ide> nb_epoch = 5
<ide> print("X_train: ", X_train.shape)
<ide> print("X_test: ", X_test.shape)
<ide>
<add>
<ide> ##########################
<ide> # dense model test #
<ide> ##########################
<ide> def build_deep_denoising_autoencoder(autoencoder):
<ide>
<ide>
<ide>
<del># Build our autoencoder model
<del>autoencoder = Sequential()
<del>if autoencoder_type == 'lstm':
<del> print("Training LSTM AutoEncoder")
<del> autoencoder, X_train, X_test = build_lstm_autoencoder(autoencoder, X_train, X_test)
<del>elif autoencoder_type == 'denoising':
<del> print("Training Denoising AutoEncoder")
<del> autoencoder = build_denoising_autoencoder(autoencoder)
<del>elif autoencoder_type == 'deep_denoising':
<del> print ("Training Deep Denoising AutoEncoder")
<del> autoencoder = build_deep_denoising_autoencoder(autoencoder)
<del>elif autoencoder_type == 'classical':
<del> print("Training Classical AutoEncoder")
<del> autoencoder = build_deep_classical_autoencoder(autoencoder)
<del>else:
<del> print("Error: unknown autoencoder type!")
<del> exit(-1)
<del>
<del>autoencoder.get_config(verbose=1)
<del>autoencoder.compile(loss='mean_squared_error', optimizer='adam')
<del># Do NOT use validation data with return output_reconstruction=True
<del>autoencoder.fit(X_train, X_train, batch_size=batch_size, nb_epoch=nb_epoch, show_accuracy=False, verbose=1)
<del>
<del># Do an inference pass
<del>prefilter_train = autoencoder.predict(X_train, verbose=0)
<del>prefilter_test = autoencoder.predict(X_test, verbose=0)
<del>print("prefilter_train: ", prefilter_train.shape)
<del>print("prefilter_test: ", prefilter_test.shape)
<del>
<del># Classify results from Autoencoder
<del>print("Building classical fully connected layer for classification")
<del>model = Sequential()
<del>if autoencoder_type == 'lstm':
<del> model.add(TimeDistributedDense(8, nb_classes, activation=activation))
<del> model.add(Flatten())
<del>elif autoencoder_type == 'classical':
<del> model.add(Dense(prefilter_train.shape[1], nb_classes, activation=activation))
<del>else:
<del> model.add(Dense(prefilter_train.shape[1], nb_classes, activation=activation))
<del>
<del>model.add(Activation('softmax'))
<del>
<del>model.get_config(verbose=1)
<del>model.compile(loss='categorical_crossentropy', optimizer='adam')
<del>model.fit(prefilter_train, Y_train, batch_size=batch_size, nb_epoch=nb_epoch, show_accuracy=False, verbose=0, validation_data=(prefilter_test, Y_test))
<del>
<del>score = model.evaluate(prefilter_test, Y_test, verbose=0, show_accuracy=True)
<del>print('\nscore:', score)
<del>
<del>print('Loss change:', (score[0] - classical_score[0])/classical_score[0], '%')
<del>print('Accuracy change:', (score[1] - classical_score[1])/classical_score[1], '%')
<add># Try different things here: 'lstm' or 'classical' or 'denoising'
<add># or 'deep_denoising'
<add>
<add>for autoencoder_type in ['classical', 'denoising', 'deep_denoising', 'lstm']:
<add> print(autoencoder_type)
<add> print('-'*40)
<add> # Build our autoencoder model
<add> autoencoder = Sequential()
<add> if autoencoder_type == 'lstm':
<add> print("Training LSTM AutoEncoder")
<add> autoencoder, X_train, X_test = build_lstm_autoencoder(autoencoder, X_train, X_test)
<add> elif autoencoder_type == 'denoising':
<add> print("Training Denoising AutoEncoder")
<add> autoencoder = build_denoising_autoencoder(autoencoder)
<add> elif autoencoder_type == 'deep_denoising':
<add> print ("Training Deep Denoising AutoEncoder")
<add> autoencoder = build_deep_denoising_autoencoder(autoencoder)
<add> elif autoencoder_type == 'classical':
<add> print("Training Classical AutoEncoder")
<add> autoencoder = build_deep_classical_autoencoder(autoencoder)
<add> else:
<add> print("Error: unknown autoencoder type!")
<add> exit(-1)
<add>
<add> autoencoder.get_config(verbose=1)
<add> autoencoder.compile(loss='mean_squared_error', optimizer='adam')
<add> # Do NOT use validation data with return output_reconstruction=True
<add> autoencoder.fit(X_train, X_train, batch_size=batch_size, nb_epoch=nb_epoch, show_accuracy=False, verbose=1)
<add>
<add> # Do an inference pass
<add> prefilter_train = autoencoder.predict(X_train, verbose=0)
<add> prefilter_test = autoencoder.predict(X_test, verbose=0)
<add> print("prefilter_train: ", prefilter_train.shape)
<add> print("prefilter_test: ", prefilter_test.shape)
<add>
<add> # Classify results from Autoencoder
<add> print("Building classical fully connected layer for classification")
<add> model = Sequential()
<add> if autoencoder_type == 'lstm':
<add> model.add(TimeDistributedDense(8, nb_classes, activation=activation))
<add> model.add(Flatten())
<add> elif autoencoder_type == 'classical':
<add> model.add(Dense(prefilter_train.shape[1], nb_classes, activation=activation))
<add> else:
<add> model.add(Dense(prefilter_train.shape[1], nb_classes, activation=activation))
<add>
<add> model.add(Activation('softmax'))
<add>
<add> model.get_config(verbose=1)
<add> model.compile(loss='categorical_crossentropy', optimizer='adam')
<add> model.fit(prefilter_train, Y_train, batch_size=batch_size, nb_epoch=nb_epoch, show_accuracy=False, verbose=0, validation_data=(prefilter_test, Y_test))
<add>
<add> score = model.evaluate(prefilter_test, Y_test, verbose=0, show_accuracy=True)
<add> print('\nscore:', score)
<add>
<add> print('Loss change:', (score[0] - classical_score[0])/classical_score[0], '%')
<add> print('Accuracy change:', (score[1] - classical_score[1])/classical_score[1], '%')
<ide> | 1 |
Text | Text | fix syntaxerror in guides sample code | f573df32d43c413a5098721ba6151ff190c23c6c | <ide><path>guides/source/active_record_querying.md
<ide> Post.order('id DESC').limit(20).unscope(:order, :limit) = Post.all
<ide> You can additionally unscope specific where clauses. For example:
<ide>
<ide> ```ruby
<del>Post.where(id: 10).limit(1).unscope(where: :id, :limit).order('id DESC') = Post.order('id DESC')
<add>Post.where(id: 10).limit(1).unscope(:where, :limit).order('id DESC') = Post.order('id DESC')
<ide> ```
<ide>
<ide> ### `only` | 1 |
Python | Python | call delete_dag on subdag without attributeerror | 3b91ec9b4a1168a16afa0b281bd673860485b3ac | <ide><path>airflow/api/common/experimental/delete_dag.py
<ide> def delete_dag(dag_id: str, keep_records_in_log: bool = True, session=None) -> i
<ide> count += session.query(model).filter(cond).delete(synchronize_session='fetch')
<ide> if dag.is_subdag:
<ide> parent_dag_id, task_id = dag_id.rsplit(".", 1)
<del> for model in models.DagRun, TaskFail, models.TaskInstance:
<add> for model in TaskFail, models.TaskInstance:
<ide> count += session.query(model).filter(model.dag_id == parent_dag_id,
<ide> model.task_id == task_id).delete()
<ide>
<ide><path>tests/api/common/experimental/test_delete_dag.py
<ide> def test_delete_dag_non_existent_dag(self):
<ide>
<ide>
<ide> class TestDeleteDAGSuccessfulDelete(unittest.TestCase):
<add> dag_file_path = "/usr/local/airflow/dags/test_dag_8.py"
<add> key = "test_dag_id"
<ide>
<del> def setUp(self):
<del> self.key = "test_dag_id"
<del> self.dag_file_path = "/usr/local/airflow/dags/test_dag_8.py"
<add> def setup_dag_models(self, for_sub_dag=False):
<add> if for_sub_dag:
<add> self.key = "test_dag_id.test_subdag"
<ide>
<ide> task = DummyOperator(task_id='dummy',
<ide> dag=models.DAG(dag_id=self.key,
<ide> def setUp(self):
<ide>
<ide> test_date = days_ago(1)
<ide> with create_session() as session:
<del> session.add(DM(dag_id=self.key, fileloc=self.dag_file_path))
<add> session.add(DM(dag_id=self.key, fileloc=self.dag_file_path, is_subdag=for_sub_dag))
<ide> session.add(DR(dag_id=self.key))
<ide> session.add(TI(task=task,
<ide> execution_date=test_date,
<ide> def tearDown(self):
<ide> session.query(LOG).filter(LOG.dag_id == self.key).delete()
<ide> session.query(IE).filter(IE.filename == self.dag_file_path).delete()
<ide>
<del> def test_delete_dag_successful_delete(self):
<add> def check_dag_models_exists(self):
<ide> with create_session() as session:
<ide> self.assertEqual(session.query(DM).filter(DM.dag_id == self.key).count(), 1)
<ide> self.assertEqual(session.query(DR).filter(DR.dag_id == self.key).count(), 1)
<ide> def test_delete_dag_successful_delete(self):
<ide> self.assertEqual(
<ide> session.query(IE).filter(IE.filename == self.dag_file_path).count(), 1)
<ide>
<del> delete_dag(dag_id=self.key)
<del>
<add> def check_dag_models_removed(self, expect_logs=1):
<ide> with create_session() as session:
<ide> self.assertEqual(session.query(DM).filter(DM.dag_id == self.key).count(), 0)
<ide> self.assertEqual(session.query(DR).filter(DR.dag_id == self.key).count(), 0)
<ide> self.assertEqual(session.query(TI).filter(TI.dag_id == self.key).count(), 0)
<ide> self.assertEqual(session.query(TF).filter(TF.dag_id == self.key).count(), 0)
<ide> self.assertEqual(session.query(TR).filter(TR.dag_id == self.key).count(), 0)
<del> self.assertEqual(session.query(LOG).filter(LOG.dag_id == self.key).count(), 1)
<add> self.assertEqual(session.query(LOG).filter(LOG.dag_id == self.key).count(), expect_logs)
<ide> self.assertEqual(
<ide> session.query(IE).filter(IE.filename == self.dag_file_path).count(), 0)
<ide>
<del> def test_delete_dag_successful_delete_not_keeping_records_in_log(self):
<del>
<del> with create_session() as session:
<del> self.assertEqual(session.query(DM).filter(DM.dag_id == self.key).count(), 1)
<del> self.assertEqual(session.query(DR).filter(DR.dag_id == self.key).count(), 1)
<del> self.assertEqual(session.query(TI).filter(TI.dag_id == self.key).count(), 1)
<del> self.assertEqual(session.query(TF).filter(TF.dag_id == self.key).count(), 1)
<del> self.assertEqual(session.query(TR).filter(TR.dag_id == self.key).count(), 1)
<del> self.assertEqual(session.query(LOG).filter(LOG.dag_id == self.key).count(), 1)
<del> self.assertEqual(
<del> session.query(IE).filter(IE.filename == self.dag_file_path).count(), 1)
<add> def test_delete_dag_successful_delete(self):
<add> self.setup_dag_models()
<add> self.check_dag_models_exists()
<add> delete_dag(dag_id=self.key)
<add> self.check_dag_models_removed(expect_logs=1)
<ide>
<add> def test_delete_dag_successful_delete_not_keeping_records_in_log(self):
<add> self.setup_dag_models()
<add> self.check_dag_models_exists()
<ide> delete_dag(dag_id=self.key, keep_records_in_log=False)
<add> self.check_dag_models_removed(expect_logs=0)
<ide>
<del> with create_session() as session:
<del> self.assertEqual(session.query(DM).filter(DM.dag_id == self.key).count(), 0)
<del> self.assertEqual(session.query(DR).filter(DR.dag_id == self.key).count(), 0)
<del> self.assertEqual(session.query(TI).filter(TI.dag_id == self.key).count(), 0)
<del> self.assertEqual(session.query(TF).filter(TF.dag_id == self.key).count(), 0)
<del> self.assertEqual(session.query(TR).filter(TR.dag_id == self.key).count(), 0)
<del> self.assertEqual(session.query(LOG).filter(LOG.dag_id == self.key).count(), 0)
<del> self.assertEqual(
<del> session.query(IE).filter(IE.filename == self.dag_file_path).count(), 0)
<add> def test_delete_subdag_successful_delete(self):
<add> self.setup_dag_models(for_sub_dag=True)
<add> self.check_dag_models_exists()
<add> delete_dag(dag_id=self.key, keep_records_in_log=False)
<add> self.check_dag_models_removed(expect_logs=0)
<ide>
<ide>
<ide> if __name__ == '__main__': | 2 |
Go | Go | fix regression in /etc/hosts | f3685333c0fdea58c8e6adbc93c95ebbc4a9fa47 | <ide><path>container.go
<ide> func ParseRun(args []string, capabilities *Capabilities) (*Config, *HostConfig,
<ide> }
<ide>
<ide> config := &Config{
<del> Hostname: *flHostname,
<add> Hostname: hostname,
<ide> Domainname: domainname,
<ide> PortSpecs: nil, // Deprecated
<ide> ExposedPorts: ports, | 1 |
Javascript | Javascript | throw an error when trying to use [chunkhash] | 02522f11c3a5883bf55f27a412727b98404720c9 | <ide><path>lib/ChunkRenderError.js
<add>/*
<add> MIT License http://www.opensource.org/licenses/mit-license.php
<add> Author Tobias Koppers @sokra
<add>*/
<add>function ChunkRenderError(chunk, file, error) {
<add> Error.call(this);
<add> Error.captureStackTrace(this, ChunkRenderError);
<add> this.name = "ChunkRenderError";
<add> this.error = error;
<add> this.message = error.message;
<add> this.details = error.stack;
<add> this.file = file;
<add> this.chunk = chunk;
<add>}
<add>module.exports = ChunkRenderError;
<add>
<add>ChunkRenderError.prototype = Object.create(Error.prototype);
<ide><path>lib/Compilation.js
<ide> var ChunkTemplate = require("./ChunkTemplate");
<ide> var HotUpdateChunkTemplate = require("./HotUpdateChunkTemplate");
<ide> var ModuleTemplate = require("./ModuleTemplate");
<ide> var Dependency = require("./Dependency");
<add>var ChunkRenderError = require("./ChunkRenderError");
<ide> var CachedSource = require("webpack-core/lib/CachedSource");
<ide>
<ide> function Compilation(compiler) {
<ide> Compilation.prototype.createChunkAssets = function createChunkAssets() {
<ide> var filenameTemplate = chunk.filenameTemplate ? chunk.filenameTemplate :
<ide> chunk.initial ? filename :
<ide> chunkFilename;
<del> var usedHash = !chunk.entry || (this.mainTemplate.useChunkHash && this.mainTemplate.useChunkHash(chunk)) ? chunkHash : this.fullHash;
<del> var argumentedChunk = Object.create(chunk);
<del> argumentedChunk.renderedHash = usedHash;
<del> if(this.cache && this.cache["c" + chunk.id] && this.cache["c" + chunk.id].hash === usedHash) {
<del> source = this.cache["c" + chunk.id].source;
<del> } else {
<del> if(chunk.entry) {
<del> source = this.mainTemplate.render(this.hash, chunk, this.moduleTemplate, this.dependencyTemplates);
<add> try {
<add> var useChunkHash = !chunk.entry || (this.mainTemplate.useChunkHash && this.mainTemplate.useChunkHash(chunk));
<add> var usedHash = useChunkHash ? chunkHash : this.fullHash;
<add> if(this.cache && this.cache["c" + chunk.id] && this.cache["c" + chunk.id].hash === usedHash) {
<add> source = this.cache["c" + chunk.id].source;
<ide> } else {
<del> source = this.chunkTemplate.render(chunk, this.moduleTemplate, this.dependencyTemplates);
<del> }
<del> if(this.cache) {
<del> this.cache["c" + chunk.id] = {
<del> hash: usedHash,
<del> source: source = (source instanceof CachedSource ? source : new CachedSource(source))
<del> };
<add> if(chunk.entry) {
<add> source = this.mainTemplate.render(this.hash, chunk, this.moduleTemplate, this.dependencyTemplates);
<add> } else {
<add> source = this.chunkTemplate.render(chunk, this.moduleTemplate, this.dependencyTemplates);
<add> }
<add> if(this.cache) {
<add> this.cache["c" + chunk.id] = {
<add> hash: usedHash,
<add> source: source = (source instanceof CachedSource ? source : new CachedSource(source))
<add> };
<add> }
<ide> }
<del> }
<del> this.assets[
<del> file = this.getPath(filenameTemplate, {
<del> chunk: argumentedChunk
<del> })
<del> ] = source;
<del> chunk.files.push(file);
<del> this.applyPlugins("chunk-asset", chunk, file);
<del> if(chunk.id !== 0 && namedChunkFilename && chunk.name) {
<ide> this.assets[
<del> file = this.getPath(namedChunkFilename, {
<del> chunk: argumentedChunk
<add> file = this.getPath(filenameTemplate, {
<add> noChunkHash: !useChunkHash,
<add> chunk: chunk
<ide> })
<ide> ] = source;
<ide> chunk.files.push(file);
<ide> this.applyPlugins("chunk-asset", chunk, file);
<add> file = undefined;
<add> if(chunk.id !== 0 && namedChunkFilename && chunk.name) {
<add> this.assets[
<add> file = this.getPath(namedChunkFilename, {
<add> noChunkHash: !useChunkHash,
<add> chunk: chunk
<add> })
<add> ] = source;
<add> chunk.files.push(file);
<add> this.applyPlugins("chunk-asset", chunk, file);
<add> }
<add> } catch(err) {
<add> this.errors.push(new ChunkRenderError(chunk, file || filenameTemplate, err));
<ide> }
<ide> }
<ide> };
<ide><path>lib/Stats.js
<ide> Stats.prototype.toJson = function toJson(options, forToString) {
<ide> var text = "";
<ide> if(typeof e === "string")
<ide> e = {message: e};
<add> if(e.chunk) {
<add> text += "chunk " + (e.chunk.name || e.chunk.id) +
<add> (e.chunk.entry ? " [entry]" : e.chunk.initial ? " [initial]" : "") + "\n";
<add> }
<add> if(e.file) {
<add> text += e.file + "\n";
<add> }
<ide> if(e.module && e.module.readableIdentifier && typeof e.module.readableIdentifier === "function") {
<ide> text += e.module.readableIdentifier(requestShortener) + "\n";
<del> } else if(e.file) {
<del> text += e.file + "\n";
<ide> }
<ide> text += e.message;
<ide> if(showErrorDetails && e.details) text += "\n" + e.details;
<ide><path>lib/TemplatedPathPlugin.js
<ide> function replacePathVariables(path, data) {
<ide> var chunkHash = chunk && (chunk.renderedHash || chunk.hash);
<ide> var chunkHashWithLength = chunk && chunk.hashWithLength;
<ide>
<add> if(data.noChunkHash && REGEXP_CHUNKHASH_FOR_TEST.test(path)) {
<add> throw new Error("Cannot use [chunkhash] for chunk in '" + path + "' (use [hash] instead)");
<add> }
<add>
<ide> return path
<ide> .replace(REGEXP_HASH, withHashLength(getReplacer(data.hash), data.hashWithLength))
<ide> .replace(REGEXP_CHUNKHASH, withHashLength(getReplacer(chunkHash), chunkHashWithLength))
<ide><path>test/Errors.test.js
<ide> describe("Errors", function() {
<ide> lines[0].should.match(/non-entry/);
<ide> done();
<ide> });
<del>
<ide> });
<del>});
<ide>\ No newline at end of file
<add> it("should throw an error when trying to use [chunkhash] when it's invalid", function(done) {
<add> getErrors({
<add> entry: {
<add> a: "./entry-point",
<add> b: "./entry-point",
<add> c: "./entry-point"
<add> },
<add> output: {
<add> filename: "[chunkhash].js"
<add> },
<add> plugins: [
<add> new webpack.HotModuleReplacementPlugin()
<add> ]
<add> }, function(errors, warnings) {
<add> errors.length.should.be.eql(3);
<add> warnings.length.should.be.eql(0);
<add> errors.forEach(function(error) {
<add> var lines = error.split("\n");
<add> lines[0].should.match(/chunk (a|b|c)/);
<add> lines[2].should.match(/\[chunkhash\].js/);
<add> lines[2].should.match(/use \[hash\] instead/);
<add> });
<add> done();
<add> });
<add> });
<add>});
<ide><path>test/configCases/hash-length/output-filename/index.js
<del>it("should compile and run the test", function () {});
<add>it("should compile and run the test " + NAME, function () {});
<ide>
<del>it("should load additional chunks", function (done) {
<add>it("should load additional chunks in " + NAME, function (done) {
<ide> require(['./chunk'], function () {
<ide> done();
<ide> });
<ide><path>test/configCases/hash-length/output-filename/test.config.js
<ide> var fs = require("fs");
<add>require("should");
<ide>
<ide> module.exports = {
<ide> findBundle: function(i, options) {
<ide> var files = fs.readdirSync(options.output.path);
<del> var hashParamMatches = options.output.filename.match(/:(\d+)/);
<del> var hashLength = hashParamMatches && hashParamMatches[1];
<add> var expectedNameLength = options.output.expectedFilenameLength;
<ide> var bundleDetect = new RegExp("^bundle" + i, "i");
<del> for (var i = 0, file; i < files.length; i++) {
<del> file = files[i];
<add> for(var j = 0, file; j < files.length; j++) {
<add> file = files[j];
<ide> if (bundleDetect.test(file)) {
<add> file.should.match(new RegExp("^.{" + expectedNameLength + "}$"));
<ide> return "./" + file;
<ide> }
<ide> }
<ide><path>test/configCases/hash-length/output-filename/webpack.config.js
<add>var webpack = require("../../../../");
<ide> module.exports = [{
<add> name: "hash with length in publicPath",
<ide> output: {
<ide> publicPath: "/[hash:6]/",
<del> filename: 'bundle0.[hash:6].js'
<add> filename: "bundle0.[hash:6].js",
<add> chunkFilename: "[id].bundle1.[hash:6].js",
<add> expectedFilenameLength: 17
<ide> }
<ide> }, {
<add> name: "hash in publicPath",
<ide> output: {
<ide> publicPath: "/[hash]/",
<del> filename: 'bundle1.[hash].js'
<add> filename: "bundle1.[hash].js",
<add> chunkFilename: "[id].bundle1.[hash].js",
<add> expectedFilenameLength: 31
<ide> }
<ide> }, {
<add> name: "chunkhash with length",
<ide> output: {
<del> filename: 'bundle2.[chunkhash:8].js',
<del> chunkFilename: '[id].bundle.[chunkhash:8].js'
<add> filename: "bundle2.[chunkhash:8].js",
<add> chunkFilename: "[id].bundle2.[chunkhash:8].js",
<add> expectedFilenameLength: 19
<ide> }
<ide> }, {
<add> name: "chunkhash",
<ide> output: {
<del> filename: 'bundle3.[chunkhash].js',
<del> chunkFilename: '[id].bundle.[chunkhash].js'
<add> filename: "bundle3.[chunkhash].js",
<add> chunkFilename: "[id].bundle3.[chunkhash].js",
<add> expectedFilenameLength: 31
<ide> }
<ide> }, {
<add> name: "hash with and without length",
<ide> output: {
<del> filename: 'bundle4.[hash].js',
<del> chunkFilename: '[id].bundle.[hash:8].js'
<add> filename: "bundle4.[hash].js",
<add> chunkFilename: "[id].bundle4.[hash:8].js",
<add> expectedFilenameLength: 31
<ide> }
<ide> }, {
<add> name: "hash with length",
<ide> output: {
<del> filename: 'bundle5.[hash:6].js',
<del> chunkFilename: '[id].bundle.[hash:8].js'
<add> filename: "bundle5.[hash:6].js",
<add> chunkFilename: "[id].bundle5.[hash:8].js",
<add> expectedFilenameLength: 17
<ide> }
<add>}, {
<add> name: "chunkhash in chunkFilename ",
<add> output: {
<add> filename: "bundle6.[hash].js",
<add> chunkFilename: "[id].bundle6.[chunkhash:7].js",
<add> expectedFilenameLength: 31
<add> },
<add> plugins: [
<add> new webpack.HotModuleReplacementPlugin()
<add> ]
<ide> }];
<add>module.exports.forEach(function(options) {
<add> options.plugins = options.plugins || [];
<add> options.plugins.push(new webpack.DefinePlugin({
<add> NAME: JSON.stringify(options.name)
<add> }));
<add>}); | 8 |
Javascript | Javascript | add support for gltf emission textures | b2fba537f0e0103efebbef9813313fa7ee5e6a11 | <ide><path>examples/js/loaders/GLTFLoader.js
<ide> THREE.GLTFLoader = ( function () {
<ide>
<ide> materialParams.emissive = new THREE.Color().fromArray( materialValues.emission );
<ide>
<add> } else if ( typeof( materialValues.emission ) === 'string' ) {
<add>
<add> materialParams.map = dependencies.textures[ materialValues.emission ];
<add>
<ide> }
<ide>
<add> delete materialParams.emission;
<add>
<ide> if ( Array.isArray( materialValues.specular ) ) {
<ide>
<ide> materialParams.specular = new THREE.Color().fromArray( materialValues.specular ); | 1 |
Javascript | Javascript | assign missing deprecation code | f5f8a18831daa22ca6dcb1ec0b516ee5e1311bf8 | <ide><path>lib/internal/worker.js
<ide> class Worker extends EventEmitter {
<ide> process.emitWarning(
<ide> 'Passing a callback to worker.terminate() is deprecated. ' +
<ide> 'It returns a Promise instead.',
<del> 'DeprecationWarning', 'DEP0XXX');
<add> 'DeprecationWarning', 'DEP0132');
<ide> this.once('exit', (exitCode) => callback(null, exitCode));
<ide> }
<ide>
<ide><path>test/parallel/test-worker-nexttick-terminate.js
<ide> process.nextTick(() => {
<ide> common.expectWarning(
<ide> 'DeprecationWarning',
<ide> 'Passing a callback to worker.terminate() is deprecated. ' +
<del> 'It returns a Promise instead.', 'DEP0XXX');
<add> 'It returns a Promise instead.', 'DEP0132');
<ide>
<ide> w.on('message', common.mustCall(() => {
<ide> setTimeout(() => { | 2 |
Ruby | Ruby | remove `@etag` ivar | 53265e88067084855753522256b86568fdad5b0c | <ide><path>actionpack/lib/action_dispatch/http/cache.rb
<ide> def fresh?(response)
<ide> end
<ide>
<ide> module Response
<del> attr_reader :cache_control, :etag
<del> alias :etag? :etag
<add> attr_reader :cache_control
<ide>
<ide> def last_modified
<ide> if last = get_header(LAST_MODIFIED)
<ide> def date=(utc_time)
<ide>
<ide> def etag=(etag)
<ide> key = ActiveSupport::Cache.expand_cache_key(etag)
<del> @etag = %("#{Digest::MD5.hexdigest(key)}")
<del> set_header ETAG, @etag
<add> set_header ETAG, %("#{Digest::MD5.hexdigest(key)}")
<add> end
<add>
<add> def etag
<add> get_header ETAG
<ide> end
<add> alias :etag? :etag
<ide>
<ide> private
<ide>
<ide> def cache_control_headers
<ide>
<ide> def prepare_cache_control!
<ide> @cache_control = cache_control_headers
<del> @etag = get_header ETAG
<ide> end
<ide>
<ide> def handle_conditional_get! | 1 |
Text | Text | update citation in readme.md | 7512243a8dc5d57a3115bf69c9ab70ef7eb59324 | <ide><path>im2txt/README.md
<ide> # Show and Tell: A Neural Image Caption Generator
<ide>
<del>A TensorFlow implementation of the image-to-text model described in
<add>A TensorFlow implementation of the image-to-text model described in the paper:
<ide>
<del>*Show and Tell: A Neural Image Caption Generator*
<add>"Show and Tell: Lessons learned from the 2015 MSCOCO Image Captioning
<add>Challenge."
<ide>
<ide> Oriol Vinyals, Alexander Toshev, Samy Bengio, Dumitru Erhan.
<ide>
<del>http://arxiv.org/abs/1411.4555
<add>*IEEE transactions on pattern analysis and machine intelligence (2016).*
<add>
<add>Full text available at: http://arxiv.org/abs/1609.06647
<ide>
<ide> ## Contact
<ide> ***Author:*** Chris Shallue (shallue@google.com). | 1 |
PHP | PHP | remove unnecessary check | 3bf75151b8983b76bef1c7ae0c544dd432d56040 | <ide><path>src/Controller/Component/AuthComponent.php
<ide> public function startup(Event $event) {
<ide> return;
<ide> }
<ide>
<del> $result = $this->_unauthorized($controller);
<del> if ($result instanceof Response) {
<del> $event->stopPropagation();
<del> }
<del> return $result;
<add> $event->stopPropagation();
<add> return $this->_unauthorized($controller);
<ide> }
<ide>
<ide> /** | 1 |
Javascript | Javascript | make unwatchfile() insensitive to path | 1317032c9738790362b8e1bdd3638f1368b00188 | <ide><path>lib/fs.js
<ide> function inStatWatchers(filename) {
<ide>
<ide> fs.watchFile = function(filename) {
<ide> nullCheck(filename);
<add> filename = pathModule.resolve(filename);
<ide> var stat;
<ide> var listener;
<ide>
<ide> fs.watchFile = function(filename) {
<ide>
<ide> fs.unwatchFile = function(filename, listener) {
<ide> nullCheck(filename);
<add> filename = pathModule.resolve(filename);
<ide> if (!inStatWatchers(filename)) return;
<ide>
<ide> var stat = statWatchers[filename];
<ide><path>test/pummel/test-fs-watch-file.js
<ide> var fs = require('fs');
<ide> var watchSeenOne = 0;
<ide> var watchSeenTwo = 0;
<ide> var watchSeenThree = 0;
<add>var watchSeenFour = 0;
<ide>
<ide> var startDir = process.cwd();
<ide> var testDir = common.tmpDir;
<ide> var filepathTwoAbs = path.join(testDir, filenameTwo);
<ide>
<ide> var filenameThree = 'charm'; // because the third time is
<ide>
<add>var filenameFour = 'get';
<ide>
<ide> process.on('exit', function() {
<ide> fs.unlinkSync(filepathOne);
<ide> fs.unlinkSync(filepathTwoAbs);
<ide> fs.unlinkSync(filenameThree);
<add> fs.unlinkSync(filenameFour);
<ide> assert.equal(1, watchSeenOne);
<ide> assert.equal(2, watchSeenTwo);
<ide> assert.equal(1, watchSeenThree);
<add> assert.equal(1, watchSeenFour);
<ide> });
<ide>
<ide>
<ide> assert.doesNotThrow(
<ide> setTimeout(function() {
<ide> fs.writeFileSync(filenameThree, 'pardner');
<ide> }, 1000);
<add>
<add>setTimeout(function() {
<add> fs.writeFileSync(filenameFour, 'hey');
<add>}, 200);
<add>
<add>setTimeout(function() {
<add> fs.writeFileSync(filenameFour, 'hey');
<add>}, 500);
<add>
<add>assert.doesNotThrow(
<add> function() {
<add> function a(curr, prev) {
<add> ++watchSeenFour;
<add> assert.equal(1, watchSeenFour);
<add> fs.unwatchFile("." + path.sep + filenameFour, a);
<add> }
<add> fs.watchFile(filenameFour, a);
<add> }
<add>); | 2 |
PHP | PHP | fix white space | cc148714b51b56e5eb4701deea8d3be8dcb8e1b6 | <ide><path>src/Illuminate/Database/Eloquent/Relations/MorphPivot.php
<ide> public function setMorphType($morphType)
<ide> */
<ide> public function setMorphClass($morphClass)
<ide> {
<del> $this->morphClass = $morphClass;
<add> $this->morphClass = $morphClass;
<ide>
<del> return $this;
<add> return $this;
<ide> }
<ide>
<ide> | 1 |
Javascript | Javascript | fix comment about safari shortfalls | 451d0c37d9297598743b1372bf623d4b7d38e951 | <ide><path>src/core.js
<ide> jQuery.extend({
<ide> if ( obj == null ) {
<ide> return String( obj );
<ide> }
<del> // Support: Safari <5.1 (functionish RegExp)
<add> // Support: Safari <=5.1 (functionish RegExp)
<ide> return typeof obj === "object" || typeof obj === "function" ?
<ide> class2type[ core_toString.call(obj) ] || "object" :
<ide> typeof obj; | 1 |
Text | Text | add readme for daemon directory | b175b4dd434f6b16c0966d9c62be3d63cc8238bd | <ide><path>daemon/README.md
<add>This directory contains code pertaining to running containers and storing images
<add>
<add>Code pertaining to running containers:
<add>
<add> - execdriver
<add> - networkdriver
<add>
<add>Code pertaining to storing images:
<add>
<add> - graphdriver | 1 |
Javascript | Javascript | move lazy compile specs into a describe block | 00778aa239266c46d3f539a0c19b8a26cb2d7869 | <ide><path>test/ng/compileSpec.js
<ide> describe('$compile', function() {
<ide> }));
<ide>
<ide>
<del> // See https://github.com/angular/angular.js/issues/7183
<del> it("should pass transclusion through to template of a 'replace' directive", function() {
<del> module(function() {
<del> directive('transSync', function() {
<del> return {
<del> transclude: true,
<del> link: function(scope, element, attr, ctrl, transclude) {
<add> describe('lazy compilation', function() {
<add> // See https://github.com/angular/angular.js/issues/7183
<add> it("should pass transclusion through to template of a 'replace' directive", function() {
<add> module(function() {
<add> directive('transSync', function() {
<add> return {
<add> transclude: true,
<add> link: function(scope, element, attr, ctrl, transclude) {
<ide>
<del> expect(transclude).toEqual(jasmine.any(Function));
<add> expect(transclude).toEqual(jasmine.any(Function));
<ide>
<del> transclude(function(child) { element.append(child); });
<del> }
<del> };
<del> });
<add> transclude(function(child) { element.append(child); });
<add> }
<add> };
<add> });
<ide>
<del> directive('trans', function($timeout) {
<del> return {
<del> transclude: true,
<del> link: function(scope, element, attrs, ctrl, transclude) {
<add> directive('trans', function($timeout) {
<add> return {
<add> transclude: true,
<add> link: function(scope, element, attrs, ctrl, transclude) {
<ide>
<del> // We use timeout here to simulate how ng-if works
<del> $timeout(function() {
<del> transclude(function(child) { element.append(child); });
<del> });
<del> }
<del> };
<del> });
<add> // We use timeout here to simulate how ng-if works
<add> $timeout(function() {
<add> transclude(function(child) { element.append(child); });
<add> });
<add> }
<add> };
<add> });
<ide>
<del> directive('replaceWithTemplate', function() {
<del> return {
<del> templateUrl: "template.html",
<del> replace: true
<del> };
<add> directive('replaceWithTemplate', function() {
<add> return {
<add> templateUrl: "template.html",
<add> replace: true
<add> };
<add> });
<ide> });
<del> });
<ide>
<del> inject(function($compile, $rootScope, $templateCache, $timeout) {
<add> inject(function($compile, $rootScope, $templateCache, $timeout) {
<ide>
<del> $templateCache.put('template.html', '<div trans-sync>Content To Be Transcluded</div>');
<add> $templateCache.put('template.html', '<div trans-sync>Content To Be Transcluded</div>');
<ide>
<del> expect(function() {
<del> element = $compile('<div><div trans><div replace-with-template></div></div></div>')($rootScope);
<del> $timeout.flush();
<del> }).not.toThrow();
<add> expect(function() {
<add> element = $compile('<div><div trans><div replace-with-template></div></div></div>')($rootScope);
<add> $timeout.flush();
<add> }).not.toThrow();
<ide>
<del> expect(element.text()).toEqual('Content To Be Transcluded');
<del> });
<add> expect(element.text()).toEqual('Content To Be Transcluded');
<add> });
<ide>
<del> });
<add> });
<ide>
<del> it('should lazily compile the contents of directives that are transcluded', function() {
<del> var innerCompilationCount = 0, transclude;
<add> it('should lazily compile the contents of directives that are transcluded', function() {
<add> var innerCompilationCount = 0, transclude;
<ide>
<del> module(function() {
<del> directive('trans', valueFn({
<del> transclude: true,
<del> controller: function($transclude) {
<del> transclude = $transclude;
<del> }
<del> }));
<add> module(function() {
<add> directive('trans', valueFn({
<add> transclude: true,
<add> controller: function($transclude) {
<add> transclude = $transclude;
<add> }
<add> }));
<ide>
<del> directive('inner', valueFn({
<del> template: '<span>FooBar</span>',
<del> compile: function() {
<del> innerCompilationCount +=1;
<del> }
<del> }));
<del> });
<add> directive('inner', valueFn({
<add> template: '<span>FooBar</span>',
<add> compile: function() {
<add> innerCompilationCount +=1;
<add> }
<add> }));
<add> });
<ide>
<del> inject(function($compile, $rootScope) {
<del> element = $compile('<trans><inner></inner></trans>')($rootScope);
<del> expect(innerCompilationCount).toBe(0);
<del> transclude(function(child) { element.append(child); });
<del> expect(innerCompilationCount).toBe(1);
<del> expect(element.text()).toBe('FooBar');
<add> inject(function($compile, $rootScope) {
<add> element = $compile('<trans><inner></inner></trans>')($rootScope);
<add> expect(innerCompilationCount).toBe(0);
<add> transclude(function(child) { element.append(child); });
<add> expect(innerCompilationCount).toBe(1);
<add> expect(element.text()).toBe('FooBar');
<add> });
<ide> });
<del> });
<ide>
<del> it('should lazily compile the contents of directives that are transcluded with a template', function() {
<del> var innerCompilationCount = 0, transclude;
<add> it('should lazily compile the contents of directives that are transcluded with a template', function() {
<add> var innerCompilationCount = 0, transclude;
<ide>
<del> module(function() {
<del> directive('trans', valueFn({
<del> transclude: true,
<del> template: '<div>Baz</div>',
<del> controller: function($transclude) {
<del> transclude = $transclude;
<del> }
<del> }));
<add> module(function() {
<add> directive('trans', valueFn({
<add> transclude: true,
<add> template: '<div>Baz</div>',
<add> controller: function($transclude) {
<add> transclude = $transclude;
<add> }
<add> }));
<ide>
<del> directive('inner', valueFn({
<del> template: '<span>FooBar</span>',
<del> compile: function() {
<del> innerCompilationCount +=1;
<del> }
<del> }));
<del> });
<add> directive('inner', valueFn({
<add> template: '<span>FooBar</span>',
<add> compile: function() {
<add> innerCompilationCount +=1;
<add> }
<add> }));
<add> });
<ide>
<del> inject(function($compile, $rootScope) {
<del> element = $compile('<trans><inner></inner></trans>')($rootScope);
<del> expect(innerCompilationCount).toBe(0);
<del> transclude(function(child) { element.append(child); });
<del> expect(innerCompilationCount).toBe(1);
<del> expect(element.text()).toBe('BazFooBar');
<add> inject(function($compile, $rootScope) {
<add> element = $compile('<trans><inner></inner></trans>')($rootScope);
<add> expect(innerCompilationCount).toBe(0);
<add> transclude(function(child) { element.append(child); });
<add> expect(innerCompilationCount).toBe(1);
<add> expect(element.text()).toBe('BazFooBar');
<add> });
<ide> });
<del> });
<ide>
<del> it('should lazily compile the contents of directives that are transcluded with a templateUrl', function() {
<del> var innerCompilationCount = 0, transclude;
<add> it('should lazily compile the contents of directives that are transcluded with a templateUrl', function() {
<add> var innerCompilationCount = 0, transclude;
<ide>
<del> module(function() {
<del> directive('trans', valueFn({
<del> transclude: true,
<del> templateUrl: 'baz.html',
<del> controller: function($transclude) {
<del> transclude = $transclude;
<del> }
<del> }));
<add> module(function() {
<add> directive('trans', valueFn({
<add> transclude: true,
<add> templateUrl: 'baz.html',
<add> controller: function($transclude) {
<add> transclude = $transclude;
<add> }
<add> }));
<ide>
<del> directive('inner', valueFn({
<del> template: '<span>FooBar</span>',
<del> compile: function() {
<del> innerCompilationCount +=1;
<del> }
<del> }));
<del> });
<add> directive('inner', valueFn({
<add> template: '<span>FooBar</span>',
<add> compile: function() {
<add> innerCompilationCount +=1;
<add> }
<add> }));
<add> });
<ide>
<del> inject(function($compile, $rootScope, $httpBackend) {
<del> $httpBackend.expectGET('baz.html').respond('<div>Baz</div>');
<del> element = $compile('<trans><inner></inner></trans>')($rootScope);
<del> $httpBackend.flush();
<add> inject(function($compile, $rootScope, $httpBackend) {
<add> $httpBackend.expectGET('baz.html').respond('<div>Baz</div>');
<add> element = $compile('<trans><inner></inner></trans>')($rootScope);
<add> $httpBackend.flush();
<ide>
<del> expect(innerCompilationCount).toBe(0);
<del> transclude(function(child) { element.append(child); });
<del> expect(innerCompilationCount).toBe(1);
<del> expect(element.text()).toBe('BazFooBar');
<add> expect(innerCompilationCount).toBe(0);
<add> transclude(function(child) { element.append(child); });
<add> expect(innerCompilationCount).toBe(1);
<add> expect(element.text()).toBe('BazFooBar');
<add> });
<ide> });
<del> });
<ide>
<del> it('should lazily compile the contents of directives that are transclude element', function() {
<del> var innerCompilationCount = 0, transclude;
<add> it('should lazily compile the contents of directives that are transclude element', function() {
<add> var innerCompilationCount = 0, transclude;
<ide>
<del> module(function() {
<del> directive('trans', valueFn({
<del> transclude: 'element',
<del> controller: function($transclude) {
<del> transclude = $transclude;
<del> }
<del> }));
<add> module(function() {
<add> directive('trans', valueFn({
<add> transclude: 'element',
<add> controller: function($transclude) {
<add> transclude = $transclude;
<add> }
<add> }));
<ide>
<del> directive('inner', valueFn({
<del> template: '<span>FooBar</span>',
<del> compile: function() {
<del> innerCompilationCount +=1;
<del> }
<del> }));
<del> });
<add> directive('inner', valueFn({
<add> template: '<span>FooBar</span>',
<add> compile: function() {
<add> innerCompilationCount +=1;
<add> }
<add> }));
<add> });
<ide>
<del> inject(function($compile, $rootScope) {
<del> element = $compile('<div><trans><inner></inner></trans></div>')($rootScope);
<del> expect(innerCompilationCount).toBe(0);
<del> transclude(function(child) { element.append(child); });
<del> expect(innerCompilationCount).toBe(1);
<del> expect(element.text()).toBe('FooBar');
<add> inject(function($compile, $rootScope) {
<add> element = $compile('<div><trans><inner></inner></trans></div>')($rootScope);
<add> expect(innerCompilationCount).toBe(0);
<add> transclude(function(child) { element.append(child); });
<add> expect(innerCompilationCount).toBe(1);
<add> expect(element.text()).toBe('FooBar');
<add> });
<ide> });
<del> });
<ide>
<del> it('should lazily compile transcluded directives with ngIf on them', function() {
<del> var innerCompilationCount = 0, outerCompilationCount = 0, transclude;
<add> it('should lazily compile transcluded directives with ngIf on them', function() {
<add> var innerCompilationCount = 0, outerCompilationCount = 0, transclude;
<ide>
<del> module(function() {
<del> directive('outer', valueFn({
<del> transclude: true,
<del> compile: function() {
<del> outerCompilationCount += 1;
<del> },
<del> controller: function($transclude) {
<del> transclude = $transclude;
<del> }
<del> }));
<add> module(function() {
<add> directive('outer', valueFn({
<add> transclude: true,
<add> compile: function() {
<add> outerCompilationCount += 1;
<add> },
<add> controller: function($transclude) {
<add> transclude = $transclude;
<add> }
<add> }));
<ide>
<del> directive('inner', valueFn({
<del> template: '<span>FooBar</span>',
<del> compile: function() {
<del> innerCompilationCount +=1;
<del> }
<del> }));
<del> });
<add> directive('inner', valueFn({
<add> template: '<span>FooBar</span>',
<add> compile: function() {
<add> innerCompilationCount +=1;
<add> }
<add> }));
<add> });
<ide>
<del> inject(function($compile, $rootScope) {
<del> $rootScope.shouldCompile = false;
<del>
<del> element = $compile('<div><outer ng-if="shouldCompile"><inner></inner></outer></div>')($rootScope);
<del> expect(outerCompilationCount).toBe(0);
<del> expect(innerCompilationCount).toBe(0);
<del> expect(transclude).toBeUndefined();
<del> $rootScope.$apply('shouldCompile=true');
<del> expect(outerCompilationCount).toBe(1);
<del> expect(innerCompilationCount).toBe(0);
<del> expect(transclude).toBeDefined();
<del> transclude(function(child) { element.append(child); });
<del> expect(outerCompilationCount).toBe(1);
<del> expect(innerCompilationCount).toBe(1);
<del> expect(element.text()).toBe('FooBar');
<add> inject(function($compile, $rootScope) {
<add> $rootScope.shouldCompile = false;
<add>
<add> element = $compile('<div><outer ng-if="shouldCompile"><inner></inner></outer></div>')($rootScope);
<add> expect(outerCompilationCount).toBe(0);
<add> expect(innerCompilationCount).toBe(0);
<add> expect(transclude).toBeUndefined();
<add> $rootScope.$apply('shouldCompile=true');
<add> expect(outerCompilationCount).toBe(1);
<add> expect(innerCompilationCount).toBe(0);
<add> expect(transclude).toBeDefined();
<add> transclude(function(child) { element.append(child); });
<add> expect(outerCompilationCount).toBe(1);
<add> expect(innerCompilationCount).toBe(1);
<add> expect(element.text()).toBe('FooBar');
<add> });
<ide> });
<del> });
<ide>
<del> it('should eagerly compile multiple directives with transclusion and templateUrl/replace', function() {
<del> var innerCompilationCount = 0;
<add> it('should eagerly compile multiple directives with transclusion and templateUrl/replace', function() {
<add> var innerCompilationCount = 0;
<ide>
<del> module(function() {
<del> directive('outer', valueFn({
<del> transclude: true
<del> }));
<add> module(function() {
<add> directive('outer', valueFn({
<add> transclude: true
<add> }));
<ide>
<del> directive('outer', valueFn({
<del> templateUrl: 'inner.html',
<del> replace: true
<del> }));
<add> directive('outer', valueFn({
<add> templateUrl: 'inner.html',
<add> replace: true
<add> }));
<ide>
<del> directive('inner', valueFn({
<del> compile: function() {
<del> innerCompilationCount +=1;
<del> }
<del> }));
<del> });
<add> directive('inner', valueFn({
<add> compile: function() {
<add> innerCompilationCount +=1;
<add> }
<add> }));
<add> });
<ide>
<del> inject(function($compile, $rootScope, $httpBackend) {
<del> $httpBackend.expectGET('inner.html').respond('<inner></inner>');
<del> element = $compile('<outer></outer>')($rootScope);
<del> $httpBackend.flush();
<add> inject(function($compile, $rootScope, $httpBackend) {
<add> $httpBackend.expectGET('inner.html').respond('<inner></inner>');
<add> element = $compile('<outer></outer>')($rootScope);
<add> $httpBackend.flush();
<ide>
<del> expect(innerCompilationCount).toBe(1);
<add> expect(innerCompilationCount).toBe(1);
<add> });
<ide> });
<ide> });
<add>
<ide> });
<ide>
<ide> | 1 |
Javascript | Javascript | add start property that is used by the <ol> tag | 5c9d616735c4c5c31fb68b789c8c6f3afeae9592 | <ide><path>src/browser/ui/dom/DOMProperty.js
<ide> var DOMPropertyInjection = {
<ide> MUST_USE_PROPERTY: 0x2,
<ide> HAS_SIDE_EFFECTS: 0x4,
<ide> HAS_BOOLEAN_VALUE: 0x8,
<del> HAS_POSITIVE_NUMERIC_VALUE: 0x10,
<add> HAS_NUMERIC_VALUE: 0x10,
<add> HAS_POSITIVE_NUMERIC_VALUE: 0x20 | 0x10,
<ide>
<ide> /**
<ide> * Inject some specialized knowledge about the DOM. This takes a config object
<ide> var DOMPropertyInjection = {
<ide> propConfig & DOMPropertyInjection.HAS_SIDE_EFFECTS;
<ide> DOMProperty.hasBooleanValue[propName] =
<ide> propConfig & DOMPropertyInjection.HAS_BOOLEAN_VALUE;
<add> DOMProperty.hasNumericValue[propName] =
<add> propConfig & DOMPropertyInjection.HAS_NUMERIC_VALUE;
<ide> DOMProperty.hasPositiveNumericValue[propName] =
<ide> propConfig & DOMPropertyInjection.HAS_POSITIVE_NUMERIC_VALUE;
<ide>
<ide> var DOMPropertyInjection = {
<ide> );
<ide> invariant(
<ide> !DOMProperty.hasBooleanValue[propName] ||
<del> !DOMProperty.hasPositiveNumericValue[propName],
<del> 'DOMProperty: Cannot have both boolean and positive numeric value: %s',
<add> !DOMProperty.hasNumericValue[propName],
<add> 'DOMProperty: Cannot have both boolean and numeric value: %s',
<ide> propName
<ide> );
<ide> }
<ide> var DOMProperty = {
<ide> */
<ide> hasBooleanValue: {},
<ide>
<add> /**
<add> * Whether the property must be numeric or parse as a
<add> * numeric and should be removed when set to a falsey value.
<add> * @type {Object}
<add> */
<add> hasNumericValue: {},
<add>
<ide> /**
<ide> * Whether the property must be positive numeric or parse as a positive
<ide> * numeric and should be removed when set to a falsey value.
<ide><path>src/browser/ui/dom/DOMPropertyOperations.js
<ide> var warning = require('warning');
<ide>
<ide> function shouldIgnoreValue(name, value) {
<ide> return value == null ||
<del> DOMProperty.hasBooleanValue[name] && !value ||
<del> DOMProperty.hasPositiveNumericValue[name] && (isNaN(value) || value < 1);
<add> (DOMProperty.hasBooleanValue[name] && !value) ||
<add> (DOMProperty.hasNumericValue[name] && isNaN(value)) ||
<add> (DOMProperty.hasPositiveNumericValue[name] && (value < 1));
<ide> }
<ide>
<ide> var processAttributeNameAndPrefix = memoizeStringOnly(function(name) {
<ide><path>src/browser/ui/dom/DefaultDOMPropertyConfig.js
<ide> var MUST_USE_ATTRIBUTE = DOMProperty.injection.MUST_USE_ATTRIBUTE;
<ide> var MUST_USE_PROPERTY = DOMProperty.injection.MUST_USE_PROPERTY;
<ide> var HAS_BOOLEAN_VALUE = DOMProperty.injection.HAS_BOOLEAN_VALUE;
<ide> var HAS_SIDE_EFFECTS = DOMProperty.injection.HAS_SIDE_EFFECTS;
<add>var HAS_NUMERIC_VALUE = DOMProperty.injection.HAS_NUMERIC_VALUE;
<ide> var HAS_POSITIVE_NUMERIC_VALUE =
<ide> DOMProperty.injection.HAS_POSITIVE_NUMERIC_VALUE;
<ide>
<ide> var DefaultDOMPropertyConfig = {
<ide> src: null,
<ide> srcDoc: MUST_USE_PROPERTY,
<ide> srcSet: null,
<add> start: HAS_NUMERIC_VALUE,
<ide> step: null,
<ide> style: null,
<ide> tabIndex: null, | 3 |
Javascript | Javascript | remove redundant github auth | 503d6ada8a8ad3560d96bedd9d1fa516dd5a394e | <ide><path>config/passport.js
<ide> var _ = require('lodash'),
<ide> OAuthStrategy = require('passport-oauth').OAuthStrategy,
<ide> OAuth2Strategy = require('passport-oauth').OAuth2Strategy,
<ide> User = require('../models/User'),
<add> nodemailer = require('nodemailer'),
<ide> secrets = require('./secrets');
<ide>
<ide> // Login Required middleware.
<ide> module.exports = {
<ide> isAuthenticated: isAuthenticated,
<del> isAuthorized: isAuthorized,
<add> isAuthorized: isAuthorized
<ide> };
<ide>
<ide> passport.serializeUser(function(user, done) {
<ide> passport.deserializeUser(function(id, done) {
<ide> });
<ide> });
<ide>
<add>// Sign in using Email and Password.
<add>
<add>passport.use(new LocalStrategy({ usernameField: 'email' }, function(email, password, done) {
<add> User.findOne({ email: email }, function(err, user) {
<add> if (!user) return done(null, false, { message: 'Email ' + email + ' not found'});
<add> user.comparePassword(password, function(err, isMatch) {
<add> if (isMatch) {
<add> return done(null, user);
<add> } else {
<add> return done(null, false, { message: 'Invalid email or password.' });
<add> }
<add> });
<add> });
<add>}));
<add>
<ide> /**
<ide> * OAuth Strategy Overview
<ide> *
<ide> passport.deserializeUser(function(id, done) {
<ide> * - Else create a new account.
<ide> */
<ide>
<add>// Sign in with Facebook.
<add>
<add>passport.use(new FacebookStrategy(secrets.facebook, function(req, accessToken, refreshToken, profile, done) {
<add> if (req.user) {
<add> User.findOne({ facebook: profile.id }, function(err, existingUser) {
<add> if (existingUser) {
<add> req.flash('errors', { msg: 'There is already a Facebook account that belongs to you. Sign in with that account or delete it, then link it with your current account.' });
<add> done(err);
<add> } else {
<add> User.findById(req.user.id, function(err, user) {
<add> user.facebook = profile.id;
<add> user.tokens.push({ kind: 'facebook', accessToken: accessToken });
<add> user.profile.name = user.profile.name || profile.displayName;
<add> user.profile.gender = user.profile.gender || profile._json.gender;
<add> user.profile.picture = user.profile.picture || 'https://graph.facebook.com/' + profile.id + '/picture?type=large';
<add> user.save(function(err) {
<add> req.flash('info', { msg: 'Facebook account has been linked.' });
<add> done(err, user);
<add> });
<add> });
<add> }
<add> });
<add> } else {
<add> User.findOne({ facebook: profile.id }, function(err, existingUser) {
<add> if (existingUser) return done(null, existingUser);
<add> User.findOne({ email: profile._json.email }, function(err, existingEmailUser) {
<add> if (existingEmailUser) {
<add> req.flash('errors', { msg: 'There is already an account using this email address. Sign in to that account and link it with Facebook manually from Account Settings.' });
<add> done(err);
<add> } else {
<add> var user = new User();
<add> user.email = profile._json.email;
<add> user.facebook = profile.id;
<add> user.tokens.push({ kind: 'facebook', accessToken: accessToken });
<add> user.profile.name = profile.displayName;
<add> user.profile.gender = profile._json.gender;
<add> user.profile.picture = 'https://graph.facebook.com/' + profile.id + '/picture?type=large';
<add> user.profile.location = (profile._json.location) ? profile._json.location.name : '';
<add> user.save(function(err) {
<add> done(err, user);
<add> });
<add> var transporter = nodemailer.createTransport({
<add> service: 'Mandrill',
<add> auth: {
<add> user: secrets.mandrill.user,
<add> pass: secrets.mandrill.password
<add> }
<add> });
<add> var mailOptions = {
<add> to: user.email,
<add> from: 'Team@freecodecamp.com',
<add> subject: 'Welcome to Free Code Camp!',
<add> text: [
<add> 'Greetings from San Francisco!\n\n',
<add> 'Thank you for joining our community.\n',
<add> 'Feel free to email us at this address if you have any questions about Free Code Camp.\n',
<add> "And if you have a moment, check out our blog: blog.freecodecamp.com.\n",
<add> 'Good luck with the challenges!\n\n',
<add> '- the Volunteer Camp Counselor Team'
<add> ].join('')
<add> };
<add> transporter.sendMail(mailOptions, function(err) {
<add> if (err) { return err; }
<add> });
<add> }
<add> });
<add> });
<add> }
<add>}));
<add>
<add>// Sign in with GitHub.
<add>
<add>passport.use(new GitHubStrategy(secrets.github, function(req, accessToken, refreshToken, profile, done) {
<add> if (req.user) {
<add> User.findOne({ github: profile.id }, function(err, existingUser) {
<add> if (existingUser) {
<add> req.flash('errors', { msg: 'There is already a GitHub account that belongs to you. Sign in with that account or delete it, then link it with your current account.' });
<add> done(err);
<add> } else {
<add> User.findById(req.user.id, function(err, user) {
<add> user.github = profile.id;
<add> user.tokens.push({ kind: 'github', accessToken: accessToken });
<add> user.profile.name = user.profile.name || profile.displayName;
<add> user.profile.picture = user.profile.picture || profile._json.avatar_url;
<add> user.profile.location = user.profile.location || profile._json.location;
<add> user.profile.website = user.profile.website || profile._json.blog;
<add> user.save(function(err) {
<add> req.flash('info', { msg: 'GitHub account has been linked.' });
<add> done(err, user);
<add> });
<add> });
<add> }
<add> });
<add> } else {
<add> User.findOne({ github: profile.id }, function(err, existingUser) {
<add> if (existingUser) return done(null, existingUser);
<add> User.findOne({ email: profile._json.email }, function(err, existingEmailUser) {
<add> if (existingEmailUser) {
<add> req.flash('errors', { msg: 'There is already an account using this email address. Sign in to that account and link it with GitHub manually from Account Settings.' });
<add> done(err);
<add> } else {
<add> var user = new User();
<add> user.email = profile._json.email;
<add> user.github = profile.id;
<add> user.tokens.push({ kind: 'github', accessToken: accessToken });
<add> user.profile.name = profile.displayName;
<add> user.profile.picture = profile._json.avatar_url;
<add> user.profile.location = profile._json.location;
<add> user.profile.website = profile._json.blog;
<add> user.save(function(err) {
<add> done(err, user);
<add> });
<add> var transporter = nodemailer.createTransport({
<add> service: 'Mandrill',
<add> auth: {
<add> user: secrets.mandrill.user,
<add> pass: secrets.mandrill.password
<add> }
<add> });
<add> var mailOptions = {
<add> to: user.email,
<add> from: 'Team@freecodecamp.com',
<add> subject: 'Welcome to Free Code Camp!',
<add> text: [
<add> 'Greetings from San Francisco!\n\n',
<add> 'Thank you for joining our community.\n',
<add> 'Feel free to email us at this address if you have any questions about Free Code Camp.\n',
<add> "And if you have a moment, check out our blog: blog.freecodecamp.com.\n",
<add> 'Good luck with the challenges!\n\n',
<add> '- the Volunteer Camp Counselor Team'
<add> ].join('')
<add> };
<add> transporter.sendMail(mailOptions, function(err) {
<add> if (err) { return err; }
<add> });
<add> }
<add> });
<add> });
<add> }
<add>}));
<add>
<ide> // Sign in with Twitter.
<ide>
<ide> passport.use(new TwitterStrategy(secrets.twitter, function(req, accessToken, tokenSecret, profile, done) {
<ide> passport.use(new TwitterStrategy(secrets.twitter, function(req, accessToken, tok
<ide> User.findOne({ twitter: profile.id }, function(err, existingUser) {
<ide> if (existingUser) return done(null, existingUser);
<ide> var user = new User();
<del> // Twitter will not provide an email address. Period.
<del> // But a person’s twitter username is guaranteed to be unique
<del> // so we can "fake" a twitter email address as follows:
<del> user.email = '';
<ide> user.profile.username = profile.username;
<ide> user.twitter = profile.id;
<ide> user.tokens.push({ kind: 'twitter', accessToken: accessToken, tokenSecret: tokenSecret });
<ide> passport.use(new GoogleStrategy(secrets.google, function(req, accessToken, refre
<ide> user.save(function(err) {
<ide> done(err, user);
<ide> });
<add> var transporter = nodemailer.createTransport({
<add> service: 'Mandrill',
<add> auth: {
<add> user: secrets.mandrill.user,
<add> pass: secrets.mandrill.password
<add> }
<add> });
<add> var mailOptions = {
<add> to: user.email,
<add> from: 'Team@freecodecamp.com',
<add> subject: 'Welcome to Free Code Camp!',
<add> text: [
<add> 'Greetings from San Francisco!\n\n',
<add> 'Thank you for joining our community.\n',
<add> 'Feel free to email us at this address if you have any questions about Free Code Camp.\n',
<add> "And if you have a moment, check out our blog: blog.freecodecamp.com.\n",
<add> 'Good luck with the challenges!\n\n',
<add> '- the Volunteer Camp Counselor Team'
<add> ].join('')
<add> };
<add> transporter.sendMail(mailOptions, function(err) {
<add> if (err) { return err; }
<add> });
<ide> }
<ide> });
<ide> });
<ide> passport.use(new LinkedInStrategy(secrets.linkedin, function(req, accessToken, r
<ide> user.save(function(err) {
<ide> done(err, user);
<ide> });
<del> }
<del> });
<del> });
<del> }
<del>}));
<del>
<del>// Sign in with GitHub.
<del>
<del>passport.use(new GitHubStrategy(secrets.github, function(req, accessToken, refreshToken, profile, done) {
<del> if (req.user) {
<del> User.findOne({ github: profile.id }, function(err, existingUser) {
<del> if (existingUser) {
<del> req.flash('errors', { msg: 'There is already a GitHub account that belongs to you. Sign in with that account or delete it, then link it with your current account.' });
<del> done(err);
<del> } else {
<del> User.findById(req.user.id, function(err, user) {
<del> user.github = profile.id;
<del> user.tokens.push({ kind: 'github', accessToken: accessToken });
<del> user.profile.name = user.profile.name || profile.displayName;
<del> user.profile.picture = user.profile.picture || profile._json.avatar_url;
<del> user.profile.location = user.profile.location || profile._json.location;
<del> user.profile.website = user.profile.website || profile._json.blog;
<del> user.save(function(err) {
<del> req.flash('info', { msg: 'GitHub account has been linked.' });
<del> done(err, user);
<del> });
<del> });
<del> }
<del> });
<del> } else {
<del> User.findOne({ github: profile.id }, function(err, existingUser) {
<del> if (existingUser) return done(null, existingUser);
<del> User.findOne({ email: profile._json.email }, function(err, existingEmailUser) {
<del> if (existingEmailUser) {
<del> req.flash('errors', { msg: 'There is already an account using this email address. Sign in to that account and link it with GitHub manually from Account Settings.' });
<del> done(err);
<del> } else {
<del> var user = new User();
<del> user.email = profile._json.email;
<del> user.github = profile.id;
<del> user.tokens.push({ kind: 'github', accessToken: accessToken });
<del> user.profile.name = profile.displayName;
<del> user.profile.picture = profile._json.avatar_url;
<del> user.profile.location = profile._json.location;
<del> user.profile.website = profile._json.blog;
<del> user.save(function(err) {
<del> done(err, user);
<add> var transporter = nodemailer.createTransport({
<add> service: 'Mandrill',
<add> auth: {
<add> user: secrets.mandrill.user,
<add> pass: secrets.mandrill.password
<add> }
<ide> });
<del> }
<del> });
<del> });
<del> }
<del>}));
<del>
<del>// Sign in with Facebook.
<del>
<del>passport.use(new FacebookStrategy(secrets.facebook, function(req, accessToken, refreshToken, profile, done) {
<del> if (req.user) {
<del> User.findOne({ facebook: profile.id }, function(err, existingUser) {
<del> if (existingUser) {
<del> req.flash('errors', { msg: 'There is already a Facebook account that belongs to you. Sign in with that account or delete it, then link it with your current account.' });
<del> done(err);
<del> } else {
<del> User.findById(req.user.id, function(err, user) {
<del> user.facebook = profile.id;
<del> user.tokens.push({ kind: 'facebook', accessToken: accessToken });
<del> user.profile.name = user.profile.name || profile.displayName;
<del> user.profile.gender = user.profile.gender || profile._json.gender;
<del> user.profile.picture = user.profile.picture || 'https://graph.facebook.com/' + profile.id + '/picture?type=large';
<del> user.save(function(err) {
<del> req.flash('info', { msg: 'Facebook account has been linked.' });
<del> done(err, user);
<del> });
<del> });
<del> }
<del> });
<del> } else {
<del> User.findOne({ facebook: profile.id }, function(err, existingUser) {
<del> if (existingUser) return done(null, existingUser);
<del> User.findOne({ email: profile._json.email }, function(err, existingEmailUser) {
<del> if (existingEmailUser) {
<del> req.flash('errors', { msg: 'There is already an account using this email address. Sign in to that account and link it with Facebook manually from Account Settings.' });
<del> done(err);
<del> } else {
<del> var user = new User();
<del> user.email = profile._json.email;
<del> user.facebook = profile.id;
<del> user.tokens.push({ kind: 'facebook', accessToken: accessToken });
<del> user.profile.name = profile.displayName;
<del> user.profile.gender = profile._json.gender;
<del> user.profile.picture = 'https://graph.facebook.com/' + profile.id + '/picture?type=large';
<del> user.profile.location = (profile._json.location) ? profile._json.location.name : '';
<del> user.save(function(err) {
<del> done(err, user);
<add> var mailOptions = {
<add> to: user.email,
<add> from: 'Team@freecodecamp.com',
<add> subject: 'Welcome to Free Code Camp!',
<add> text: [
<add> 'Greetings from San Francisco!\n\n',
<add> 'Thank you for joining our community.\n',
<add> 'Feel free to email us at this address if you have any questions about Free Code Camp.\n',
<add> "And if you have a moment, check out our blog: blog.freecodecamp.com.\n",
<add> 'Good luck with the challenges!\n\n',
<add> '- the Volunteer Camp Counselor Team'
<add> ].join('')
<add> };
<add> transporter.sendMail(mailOptions, function(err) {
<add> if (err) { return err; }
<ide> });
<ide> }
<ide> });
<ide> });
<ide> }
<ide> }));
<ide>
<del>// Sign in using Email and Password.
<del>passport.use(
<del> new LocalStrategy(
<del> { usernameField: 'email' }, function(email, password, done) {
<del> User.findOne({ email: email }, function(err, user) {
<del> if (err) { return done(err); }
<del>
<del> if (!user) {
<del> return done(null, false, { message: 'Email ' + email + ' not found'});
<del> }
<del> user.comparePassword(password, function(err, isMatch) {
<del> if (err) { return done(err); }
<del>
<del> if (isMatch) {
<del> return done(null, user);
<del> } else {
<del> return done(null, false, { message: 'Invalid email or password.' });
<del> }
<del> });
<del> });
<del>}));
<del>
<del>
<del>// Sign in with Facebook.
<del>passport.use(
<del> new FacebookStrategy(
<del> secrets.facebook, function(req, accessToken, refreshToken, profile, done) {
<del> if (req.user) {
<del> User.findOne({ facebook: profile.id }, function(err, existingUser) {
<del> if (err) { return done(err); }
<del>
<del> if (existingUser) {
<del> req.flash('errors', {
<del> msg: [
<del> 'There is already a Facebook account that belongs to you.',
<del> 'Sign in with that account or delete it, then link it with',
<del> 'your current account.'
<del> ].join(' ')
<del> });
<del> done();
<del> } else {
<del> User.findById(req.user.id, function(err, user) {
<del> if (err) { return done(err); }
<del>
<del> user.facebook = profile.id;
<del> user.tokens.push({
<del> kind: 'facebook',
<del> accessToken: accessToken
<del> });
<del>
<del> user.profile.name = user.profile.name || profile.displayName;
<del> user.profile.gender = user.profile.gender || profile._json.gender;
<del>
<del> user.profile.picture =
<del> user.profile.picture ||
<del> 'https://graph.facebook.com/' +
<del> profile.id +
<del> '/picture?type=large';
<del>
<del> user.save(function(err) {
<del> if (err) { return done(err); }
<del>
<del> req.flash(
<del> 'info', { msg: 'Facebook account has been linked.' });
<del> done(null, user);
<del> });
<del> });
<del> }
<del> });
<del> } else {
<del> User.findOne({ facebook: profile.id }, function(err, existingUser) {
<del> if (err) { return done(err); }
<del>
<del> if (existingUser) { return done(null, existingUser); }
<del>
<del> User.findOne(
<del> { email: profile._json.email }, function(err, existingEmailUser) {
<del> if (err) { return done(err); }
<del>
<del> var user = existingEmailUser || new User();
<del> user.email = user.email || profile._json.email;
<del> user.facebook = profile.id;
<del> user.tokens.push({
<del> kind: 'facebook',
<del> accessToken: accessToken
<del> });
<del> user.profile.name = user.profile.name || profile.displayName;
<del>
<del> user.profile.gender =
<del> user.profile.gender || profile._json.gender;
<del>
<del> user.profile.picture =
<del> user.profile.picture ||
<del> 'https://graph.facebook.com/' +
<del> profile.id +
<del> '/picture?type=large';
<del>
<del> user.profile.location =
<del> user.profile.location ||
<del> (profile._json.location) ? profile._json.location.name : '';
<del>
<del> user.challengesComplete = user.challengesCompleted || [];
<del> user.save(function(err) {
<del> if (err) { return done(err); }
<del> done(null, user);
<del> });
<del> });
<del> });
<del> }
<del>}));
<del>
<del>// Sign in with GitHub.
<del>
<del>passport.use(
<del> new GitHubStrategy(
<del> secrets.github, function(req, accessToken, refreshToken, profile, done) {
<del> if (req.user) {
<del> User.findOne({ github: profile.id }, function(err, existingUser) {
<del> if (err) { return done(err); }
<del>
<del> if (existingUser) {
<del> req.flash('errors', {
<del> msg: [
<del> 'There is already a GitHub account that belongs to you.',
<del> 'Sign in with that account or delete it, then link it with',
<del> 'your current account.'
<del> ].join(' ')
<del> });
<del> done();
<del> } else {
<del> User.findById(req.user.id, function(err, user) {
<del> if (err) { return done(err); }
<del>
<del> user.github = profile.id;
<del> user.tokens.push({ kind: 'github', accessToken: accessToken });
<del> user.profile.name = user.profile.name || profile.displayName;
<del>
<del> user.profile.picture =
<del> user.profile.picture || profile._json.avatar_url;
<del>
<del> user.profile.location =
<del> user.profile.location || profile._json.location;
<del>
<del> user.profile.website =
<del> user.profile.website || profile._json.blog;
<del>
<del> user.save(function(err) {
<del> if (err) { return done(err); }
<del>
<del> req.flash('info', { msg: 'GitHub account has been linked.' });
<del> done(null, user);
<del> });
<del> });
<del> }
<del> });
<del> } else {
<del> User.findOne({ github: profile.id }, function(err, existingUser) {
<del> if (err) { return done(err); }
<del>
<del> if (existingUser) { return done(null, existingUser); }
<del> User.findOne(
<del> { email: profile._json.email }, function(err, existingEmailUser) {
<del> if (err) { return done(err); }
<del>
<del> var user = existingEmailUser || new User();
<del> user.email = user.email || profile._json.email;
<del> user.github = profile.id;
<del> user.tokens.push({
<del> kind: 'github',
<del> accessToken: accessToken
<del> });
<del> user.profile.name = user.profile.name || profile.displayName;
<del>
<del> user.profile.picture =
<del> user.profile.picture || profile._json.avatar_url;
<del>
<del> user.profile.location =
<del> user.profile.location || profile._json.location;
<del>
<del> user.profile.website =
<del> user.profile.website || profile._json.blog;
<del>
<del> user.save(function(err) {
<del> if (err) { return done(err); }
<del> done(null, user);
<del> });
<del> });
<del> });
<del> }
<del>}));
<del>
<del>
<del>
<del>
<ide> function isAuthenticated(req, res, next) {
<ide> if (req.isAuthenticated()) return next();
<ide> res.redirect('/login'); | 1 |
Go | Go | add freezer stats | bce49dff0d46dec620e755ed859efa791054a843 | <ide><path>pkg/cgroups/fs/freezer.go
<ide> package fs
<ide>
<ide> import (
<add> "fmt"
<ide> "github.com/dotcloud/docker/pkg/cgroups"
<add> "io/ioutil"
<add> "os"
<add> "path/filepath"
<add> "strconv"
<add> "strings"
<ide> )
<ide>
<ide> type freezerGroup struct {
<ide> func (s *freezerGroup) Remove(d *data) error {
<ide> }
<ide>
<ide> func (s *freezerGroup) Stats(d *data) (map[string]float64, error) {
<del> return nil, ErrNotSupportStat
<add> var (
<add> paramData = make(map[string]float64)
<add> params = []string{
<add> "parent_freezing",
<add> "self_freezing",
<add> // comment out right now because this is string "state",
<add> }
<add> )
<add>
<add> path, err := d.path("freezer")
<add> if err != nil {
<add> return nil, err
<add> }
<add>
<add> for _, param := range params {
<add> f, err := os.Open(filepath.Join(path, fmt.Sprintf("freezer.%s", param)))
<add> if err != nil {
<add> return nil, err
<add> }
<add> defer f.Close()
<add>
<add> data, err := ioutil.ReadAll(f)
<add> if err != nil {
<add> return nil, err
<add> }
<add>
<add> v, err := strconv.ParseFloat(strings.TrimSuffix(string(data), "\n"), 64)
<add> if err != nil {
<add> return nil, err
<add> }
<add> paramData[param] = v
<add> }
<add> return paramData, nil
<ide> } | 1 |
Java | Java | fix tests in rxjava-math | 88679528fa96c0b0dbeb0da14f35566279fde8ff | <ide><path>rxjava-contrib/rxjava-math/src/test/java/rx/math/operators/OperationMinMaxTest.java
<ide> import java.util.Arrays;
<ide> import java.util.Comparator;
<ide> import java.util.List;
<add>import java.util.NoSuchElementException;
<ide>
<ide> import org.junit.Test;
<ide> import org.mockito.InOrder;
<ide> public void testMinWithEmpty() {
<ide> observable.subscribe(observer);
<ide> InOrder inOrder = inOrder(observer);
<ide> inOrder.verify(observer, times(1)).onError(
<del> isA(IllegalArgumentException.class));
<add> isA(NoSuchElementException.class));
<ide> inOrder.verifyNoMoreInteractions();
<ide> }
<ide>
<ide> public int compare(Integer o1, Integer o2) {
<ide> observable.subscribe(observer);
<ide> InOrder inOrder = inOrder(observer);
<ide> inOrder.verify(observer, times(1)).onError(
<del> isA(IllegalArgumentException.class));
<add> isA(NoSuchElementException.class));
<ide> inOrder.verifyNoMoreInteractions();
<ide> }
<ide>
<ide> public void testMaxWithEmpty() {
<ide> observable.subscribe(observer);
<ide> InOrder inOrder = inOrder(observer);
<ide> inOrder.verify(observer, times(1)).onError(
<del> isA(IllegalArgumentException.class));
<add> isA(NoSuchElementException.class));
<ide> inOrder.verifyNoMoreInteractions();
<ide> }
<ide>
<ide> public int compare(Integer o1, Integer o2) {
<ide> observable.subscribe(observer);
<ide> InOrder inOrder = inOrder(observer);
<ide> inOrder.verify(observer, times(1)).onError(
<del> isA(IllegalArgumentException.class));
<add> isA(NoSuchElementException.class));
<ide> inOrder.verifyNoMoreInteractions();
<ide> }
<ide> | 1 |
Text | Text | fix mapping of content | b69a6c3214800dafb4d467e8181dfaeb4f98ab4f | <ide><path>guides/source/active_record_basics.md
<ide> of two or more words, the model class name should follow the Ruby conventions,
<ide> using the CamelCase form, while the table name must contain the words separated
<ide> by underscores. Examples:
<ide>
<del>* Database Table - Plural with underscores separating words (e.g., `book_clubs`).
<ide> * Model Class - Singular with the first letter of each word capitalized (e.g.,
<ide> `BookClub`).
<add>* Database Table - Plural with underscores separating words (e.g., `book_clubs`).
<ide>
<ide> | Model / Class | Table / Schema |
<ide> | ---------------- | -------------- | | 1 |
Text | Text | remove non-style information from style guide | f51067a85d64b77f2eae2e099092209156d6e602 | <ide><path>doc/STYLE_GUIDE.md
<ide> * The formatting described in `.editorconfig` is preferred.
<ide> * A [plugin][] is available for some editors to automatically apply these
<ide> rules.
<del>* Mechanical issues, like spelling and grammar, should be identified by tools,
<del> insofar as is possible. If not caught by a tool, they should be pointed out by
<del> human reviewers.
<add>* Changes to documentation should be checked with `make lint-md`.
<ide> * American English spelling is preferred. "Capitalize" vs. "Capitalise",
<ide> "color" vs. "colour", etc.
<ide> * Use [serial commas][].
<ide><path>doc/onboarding.md
<ide> onboarding session.
<ide> avoid stalling the pull request.
<ide> * Note that they are nits when you comment: `Nit: change foo() to bar().`
<ide> * If they are stalling the pull request, fix them yourself on merge.
<add>* Insofar as possible, issues should be identified by tools rather than human
<add> reviewers. If you are leaving comments about issues that could be identified
<add> by tools but are not, consider implementing the necessary tooling.
<ide> * Minimum wait for comments time
<ide> * There is a minimum waiting time which we try to respect for non-trivial
<ide> changes, so that people who may have important input in such a distributed | 2 |
Ruby | Ruby | convert encoding before escaping | 8aaed3d456bad8a0bdf4789b69b41f7d817f981c | <ide><path>activesupport/lib/active_support/json.rb
<ide> module Encoding #:nodoc:
<ide> }
<ide>
<ide> def self.escape(string)
<del> json = '"' + string.gsub(escape_regex) { |s| ESCAPED_CHARS[s] }
<del> json.force_encoding('ascii-8bit') if respond_to?(:force_encoding)
<del> json.gsub(/([\xC0-\xDF][\x80-\xBF]|
<add> string = string.dup.force_encoding(::Encoding::BINARY) if string.respond_to?(:force_encoding)
<add> json = string.gsub(escape_regex) { |s| ESCAPED_CHARS[s] }.
<add> gsub(/([\xC0-\xDF][\x80-\xBF]|
<ide> [\xE0-\xEF][\x80-\xBF]{2}|
<ide> [\xF0-\xF7][\x80-\xBF]{3})+/nx) { |s|
<del> s.unpack("U*").pack("n*").unpack("H*")[0].gsub(/.{4}/, '\\\\u\&')
<del> } + '"'
<add> s.unpack("U*").pack("n*").unpack("H*")[0].gsub(/.{4}/, '\\\\u\&')
<add> }
<add> %("#{json}")
<ide> end
<ide> end
<ide> | 1 |
Ruby | Ruby | fix ci failure on ruby master | df9b61f38f1eeb750da2c95a503563783b4bc04f | <ide><path>activerecord/test/cases/migration/command_recorder_test.rb
<ide> def test_invert_change_table
<ide> t.rename :kind, :cultivar
<ide> end
<ide> end
<del> assert_equal [
<del> [:rename_column, [:fruits, :cultivar, :kind]],
<del> [:remove_column, [:fruits, :name, :string, {}], nil],
<del> ], @recorder.commands
<add>
<add> if RUBY_VERSION >= "2.8"
<add> assert_equal [
<add> [:rename_column, [:fruits, :cultivar, :kind]],
<add> [:remove_column, [:fruits, :name, :string], nil],
<add> ], @recorder.commands
<add> else
<add> assert_equal [
<add> [:rename_column, [:fruits, :cultivar, :kind]],
<add> [:remove_column, [:fruits, :name, :string, {}], nil],
<add> ], @recorder.commands
<add> end
<ide>
<ide> assert_raises(ActiveRecord::IrreversibleMigration) do
<ide> @recorder.revert do | 1 |
PHP | PHP | update detectslostconnections.php | 13546a703c210298517b25307647778d4fe3ab9f | <ide><path>src/Illuminate/Database/DetectsLostConnections.php
<ide> protected function causedByLostConnection(Throwable $e)
<ide> 'SQLSTATE[HY000]: General error: 7 SSL SYSCALL error: EOF detected',
<ide> 'SQLSTATE[HY000] [2002] Connection timed out',
<ide> 'SSL: Connection timed out',
<add> 'SQLSTATE[HY000]: General error: 1105 The last transaction was aborted due to Seamless Scaling. Please retry.',
<ide> ]);
<ide> }
<ide> } | 1 |
Ruby | Ruby | improve receipt check | e04e23492cd011cb0073f9bd5614bdce8e03b39e | <ide><path>Library/Homebrew/formula_installer.rb
<ide> def build
<ide> raise "Suspicious installation failure" unless $?.success?
<ide>
<ide> # Write an installation receipt (a Tab) to the prefix
<del> Tab.for_install(f, args).write if f.prefix.exist?
<add> Tab.for_install(f, args).write if f.installed?
<ide> end
<ide> end
<ide> | 1 |
Text | Text | add more tools to 更多信息 | 525a20ab6617e0cc126a88ae8b6f694c2adb2851 | <ide><path>guide/chinese/css/colors/index.md
<ide> body {
<ide>
<ide> #### 更多信息:
<ide>
<del>[Adobe Color CC](https://color.adobe.com/) [Chrome网上应用店中的ColorPick Eyedropper](https://chrome.google.com/webstore/detail/colorpick-eyedropper/ohcpnigalekghcmgcdcenkpelffpdolg?hl=en) [适用于Firefox的ColorZilla插件](https://addons.mozilla.org/en-US/firefox/addon/colorzilla/) [探索不同的六角颜色](http://www.colorhexa.com/) [WebAIM颜色对比度检查器](https://webaim.org/resources/contrastchecker/)
<ide>\ No newline at end of file
<add>[Adobe Color CC](https://color.adobe.com/) [Chrome网上应用店中的ColorPick Eyedropper](https://chrome.google.com/webstore/detail/colorpick-eyedropper/ohcpnigalekghcmgcdcenkpelffpdolg?hl=en) [适用于Firefox的ColorZilla插件](https://addons.mozilla.org/en-US/firefox/addon/colorzilla/) [探索不同的六角颜色](http://www.colorhexa.com/) [WebAIM颜色对比度检查器](https://webaim.org/resources/contrastchecker/) [Flat UI Colors](https://flatuicolors.com/) [Material Palette](https://www.materialpalette.com/) [Color Hunt](https://colorhunt.co/) [0to255](http://www.0to255.com/) | 1 |
Ruby | Ruby | remove the country_select helper | 2d27b82d4cf446543539ad20afcbad256d8aeff7 | <ide><path>actionpack/lib/action_view/helpers.rb
<ide> module ClassMethods
<ide> include CaptureHelper
<ide> include DateHelper
<ide> include DebugHelper
<del> include FormCountryHelper
<ide> include FormHelper
<ide> include FormOptionsHelper
<ide> include FormTagHelper
<ide><path>actionpack/lib/action_view/helpers/form_country_helper.rb
<del>require 'action_view/helpers/form_options_helper'
<del>
<del>module ActionView
<del> module Helpers
<del> module FormCountryHelper
<del>
<del> # Return select and option tags for the given object and method, using country_options_for_select to generate the list of option tags.
<del> def country_select(object, method, priority_countries = nil, options = {}, html_options = {})
<del> InstanceTag.new(object, method, self, options.delete(:object)).to_country_select_tag(priority_countries, options, html_options)
<del> end
<del>
<del> # Returns a string of option tags for pretty much any country in the world. Supply a country name as +selected+ to
<del> # have it marked as the selected option tag. You can also supply an array of countries as +priority_countries+, so
<del> # that they will be listed above the rest of the (long) list.
<del> #
<del> # NOTE: Only the option tags are returned, you have to wrap this call in a regular HTML select tag.
<del> def country_options_for_select(selected = nil, priority_countries = nil)
<del> country_options = ""
<del>
<del> if priority_countries
<del> country_options += options_for_select(priority_countries, selected)
<del> country_options += "<option value=\"\" disabled=\"disabled\">-------------</option>\n"
<del> end
<del>
<del> return country_options + options_for_select(COUNTRIES, selected)
<del> end
<del>
<del> private
<del>
<del> # All the countries included in the country_options output.
<del> COUNTRIES = ["Afghanistan", "Aland Islands", "Albania", "Algeria", "American Samoa", "Andorra", "Angola",
<del> "Anguilla", "Antarctica", "Antigua And Barbuda", "Argentina", "Armenia", "Aruba", "Australia", "Austria",
<del> "Azerbaijan", "Bahamas", "Bahrain", "Bangladesh", "Barbados", "Belarus", "Belgium", "Belize", "Benin",
<del> "Bermuda", "Bhutan", "Bolivia", "Bosnia and Herzegowina", "Botswana", "Bouvet Island", "Brazil",
<del> "British Indian Ocean Territory", "Brunei Darussalam", "Bulgaria", "Burkina Faso", "Burundi", "Cambodia",
<del> "Cameroon", "Canada", "Cape Verde", "Cayman Islands", "Central African Republic", "Chad", "Chile", "China",
<del> "Christmas Island", "Cocos (Keeling) Islands", "Colombia", "Comoros", "Congo",
<del> "Congo, the Democratic Republic of the", "Cook Islands", "Costa Rica", "Cote d'Ivoire", "Croatia", "Cuba",
<del> "Cyprus", "Czech Republic", "Denmark", "Djibouti", "Dominica", "Dominican Republic", "Ecuador", "Egypt",
<del> "El Salvador", "Equatorial Guinea", "Eritrea", "Estonia", "Ethiopia", "Falkland Islands (Malvinas)",
<del> "Faroe Islands", "Fiji", "Finland", "France", "French Guiana", "French Polynesia",
<del> "French Southern Territories", "Gabon", "Gambia", "Georgia", "Germany", "Ghana", "Gibraltar", "Greece", "Greenland", "Grenada", "Guadeloupe", "Guam", "Guatemala", "Guernsey", "Guinea",
<del> "Guinea-Bissau", "Guyana", "Haiti", "Heard and McDonald Islands", "Holy See (Vatican City State)",
<del> "Honduras", "Hong Kong", "Hungary", "Iceland", "India", "Indonesia", "Iran, Islamic Republic of", "Iraq",
<del> "Ireland", "Isle of Man", "Israel", "Italy", "Jamaica", "Japan", "Jersey", "Jordan", "Kazakhstan", "Kenya",
<del> "Kiribati", "Korea, Democratic People's Republic of", "Korea, Republic of", "Kuwait", "Kyrgyzstan",
<del> "Lao People's Democratic Republic", "Latvia", "Lebanon", "Lesotho", "Liberia", "Libyan Arab Jamahiriya",
<del> "Liechtenstein", "Lithuania", "Luxembourg", "Macao", "Macedonia, The Former Yugoslav Republic Of",
<del> "Madagascar", "Malawi", "Malaysia", "Maldives", "Mali", "Malta", "Marshall Islands", "Martinique",
<del> "Mauritania", "Mauritius", "Mayotte", "Mexico", "Micronesia, Federated States of", "Moldova, Republic of",
<del> "Monaco", "Mongolia", "Montenegro", "Montserrat", "Morocco", "Mozambique", "Myanmar", "Namibia", "Nauru",
<del> "Nepal", "Netherlands", "Netherlands Antilles", "New Caledonia", "New Zealand", "Nicaragua", "Niger",
<del> "Nigeria", "Niue", "Norfolk Island", "Northern Mariana Islands", "Norway", "Oman", "Pakistan", "Palau",
<del> "Palestinian Territory, Occupied", "Panama", "Papua New Guinea", "Paraguay", "Peru", "Philippines",
<del> "Pitcairn", "Poland", "Portugal", "Puerto Rico", "Qatar", "Reunion", "Romania", "Russian Federation",
<del> "Rwanda", "Saint Barthelemy", "Saint Helena", "Saint Kitts and Nevis", "Saint Lucia",
<del> "Saint Pierre and Miquelon", "Saint Vincent and the Grenadines", "Samoa", "San Marino",
<del> "Sao Tome and Principe", "Saudi Arabia", "Senegal", "Serbia", "Seychelles", "Sierra Leone", "Singapore",
<del> "Slovakia", "Slovenia", "Solomon Islands", "Somalia", "South Africa",
<del> "South Georgia and the South Sandwich Islands", "Spain", "Sri Lanka", "Sudan", "Suriname",
<del> "Svalbard and Jan Mayen", "Swaziland", "Sweden", "Switzerland", "Syrian Arab Republic",
<del> "Taiwan, Province of China", "Tajikistan", "Tanzania, United Republic of", "Thailand", "Timor-Leste",
<del> "Togo", "Tokelau", "Tonga", "Trinidad and Tobago", "Tunisia", "Turkey", "Turkmenistan",
<del> "Turks and Caicos Islands", "Tuvalu", "Uganda", "Ukraine", "United Arab Emirates", "United Kingdom",
<del> "United States", "United States Minor Outlying Islands", "Uruguay", "Uzbekistan", "Vanuatu", "Venezuela",
<del> "Viet Nam", "Virgin Islands, British", "Virgin Islands, U.S.", "Wallis and Futuna", "Western Sahara",
<del> "Yemen", "Zambia", "Zimbabwe"] unless const_defined?("COUNTRIES")
<del> end
<del>
<del> class InstanceTag #:nodoc:
<del> include FormCountryHelper
<del>
<del> def to_country_select_tag(priority_countries, options, html_options)
<del> html_options = html_options.stringify_keys
<del> add_default_name_and_id(html_options)
<del> value = value(object)
<del> content_tag("select",
<del> add_options(
<del> country_options_for_select(value, priority_countries),
<del> options, value
<del> ), html_options
<del> )
<del> end
<del> end
<del>
<del> class FormBuilder
<del> def country_select(method, priority_countries = nil, options = {}, html_options = {})
<del> @template.country_select(@object_name, method, priority_countries, objectify_options(options), @default_options.merge(html_options))
<del> end
<del> end
<del> end
<del>end
<ide>\ No newline at end of file
<ide><path>actionpack/lib/action_view/helpers/form_options_helper.rb
<ide> def option_value_selected?(value, selected)
<ide> value == selected
<ide> end
<ide> end
<del>
<del> # All the countries included in the country_options output.
<del> COUNTRIES = ActiveSupport::Deprecation::DeprecatedConstantProxy.new 'COUNTRIES', 'ActionView::Helpers::FormCountryHelper::COUNTRIES'
<ide> end
<ide>
<ide> class InstanceTag #:nodoc:
<ide><path>actionpack/test/template/form_country_helper_test.rb
<del>require 'abstract_unit'
<del>
<del>class FormCountryHelperTest < ActionView::TestCase
<del> tests ActionView::Helpers::FormCountryHelper
<del>
<del> silence_warnings do
<del> Post = Struct.new('Post', :title, :author_name, :body, :secret, :written_on, :category, :origin)
<del> end
<del>
<del> def test_country_select
<del> @post = Post.new
<del> @post.origin = "Denmark"
<del> expected_select = <<-COUNTRIES
<del><select id="post_origin" name="post[origin]"><option value="Afghanistan">Afghanistan</option>
<del><option value="Aland Islands">Aland Islands</option>
<del><option value="Albania">Albania</option>
<del><option value="Algeria">Algeria</option>
<del><option value="American Samoa">American Samoa</option>
<del><option value="Andorra">Andorra</option>
<del><option value="Angola">Angola</option>
<del><option value="Anguilla">Anguilla</option>
<del><option value="Antarctica">Antarctica</option>
<del><option value="Antigua And Barbuda">Antigua And Barbuda</option>
<del><option value="Argentina">Argentina</option>
<del><option value="Armenia">Armenia</option>
<del><option value="Aruba">Aruba</option>
<del><option value="Australia">Australia</option>
<del><option value="Austria">Austria</option>
<del><option value="Azerbaijan">Azerbaijan</option>
<del><option value="Bahamas">Bahamas</option>
<del><option value="Bahrain">Bahrain</option>
<del><option value="Bangladesh">Bangladesh</option>
<del><option value="Barbados">Barbados</option>
<del><option value="Belarus">Belarus</option>
<del><option value="Belgium">Belgium</option>
<del><option value="Belize">Belize</option>
<del><option value="Benin">Benin</option>
<del><option value="Bermuda">Bermuda</option>
<del><option value="Bhutan">Bhutan</option>
<del><option value="Bolivia">Bolivia</option>
<del><option value="Bosnia and Herzegowina">Bosnia and Herzegowina</option>
<del><option value="Botswana">Botswana</option>
<del><option value="Bouvet Island">Bouvet Island</option>
<del><option value="Brazil">Brazil</option>
<del><option value="British Indian Ocean Territory">British Indian Ocean Territory</option>
<del><option value="Brunei Darussalam">Brunei Darussalam</option>
<del><option value="Bulgaria">Bulgaria</option>
<del><option value="Burkina Faso">Burkina Faso</option>
<del><option value="Burundi">Burundi</option>
<del><option value="Cambodia">Cambodia</option>
<del><option value="Cameroon">Cameroon</option>
<del><option value="Canada">Canada</option>
<del><option value="Cape Verde">Cape Verde</option>
<del><option value="Cayman Islands">Cayman Islands</option>
<del><option value="Central African Republic">Central African Republic</option>
<del><option value="Chad">Chad</option>
<del><option value="Chile">Chile</option>
<del><option value="China">China</option>
<del><option value="Christmas Island">Christmas Island</option>
<del><option value="Cocos (Keeling) Islands">Cocos (Keeling) Islands</option>
<del><option value="Colombia">Colombia</option>
<del><option value="Comoros">Comoros</option>
<del><option value="Congo">Congo</option>
<del><option value="Congo, the Democratic Republic of the">Congo, the Democratic Republic of the</option>
<del><option value="Cook Islands">Cook Islands</option>
<del><option value="Costa Rica">Costa Rica</option>
<del><option value="Cote d'Ivoire">Cote d'Ivoire</option>
<del><option value="Croatia">Croatia</option>
<del><option value="Cuba">Cuba</option>
<del><option value="Cyprus">Cyprus</option>
<del><option value="Czech Republic">Czech Republic</option>
<del><option selected="selected" value="Denmark">Denmark</option>
<del><option value="Djibouti">Djibouti</option>
<del><option value="Dominica">Dominica</option>
<del><option value="Dominican Republic">Dominican Republic</option>
<del><option value="Ecuador">Ecuador</option>
<del><option value="Egypt">Egypt</option>
<del><option value="El Salvador">El Salvador</option>
<del><option value="Equatorial Guinea">Equatorial Guinea</option>
<del><option value="Eritrea">Eritrea</option>
<del><option value="Estonia">Estonia</option>
<del><option value="Ethiopia">Ethiopia</option>
<del><option value="Falkland Islands (Malvinas)">Falkland Islands (Malvinas)</option>
<del><option value="Faroe Islands">Faroe Islands</option>
<del><option value="Fiji">Fiji</option>
<del><option value="Finland">Finland</option>
<del><option value="France">France</option>
<del><option value="French Guiana">French Guiana</option>
<del><option value="French Polynesia">French Polynesia</option>
<del><option value="French Southern Territories">French Southern Territories</option>
<del><option value="Gabon">Gabon</option>
<del><option value="Gambia">Gambia</option>
<del><option value="Georgia">Georgia</option>
<del><option value="Germany">Germany</option>
<del><option value="Ghana">Ghana</option>
<del><option value="Gibraltar">Gibraltar</option>
<del><option value="Greece">Greece</option>
<del><option value="Greenland">Greenland</option>
<del><option value="Grenada">Grenada</option>
<del><option value="Guadeloupe">Guadeloupe</option>
<del><option value="Guam">Guam</option>
<del><option value="Guatemala">Guatemala</option>
<del><option value="Guernsey">Guernsey</option>
<del><option value="Guinea">Guinea</option>
<del><option value="Guinea-Bissau">Guinea-Bissau</option>
<del><option value="Guyana">Guyana</option>
<del><option value="Haiti">Haiti</option>
<del><option value="Heard and McDonald Islands">Heard and McDonald Islands</option>
<del><option value="Holy See (Vatican City State)">Holy See (Vatican City State)</option>
<del><option value="Honduras">Honduras</option>
<del><option value="Hong Kong">Hong Kong</option>
<del><option value="Hungary">Hungary</option>
<del><option value="Iceland">Iceland</option>
<del><option value="India">India</option>
<del><option value="Indonesia">Indonesia</option>
<del><option value="Iran, Islamic Republic of">Iran, Islamic Republic of</option>
<del><option value="Iraq">Iraq</option>
<del><option value="Ireland">Ireland</option>
<del><option value="Isle of Man">Isle of Man</option>
<del><option value="Israel">Israel</option>
<del><option value="Italy">Italy</option>
<del><option value="Jamaica">Jamaica</option>
<del><option value="Japan">Japan</option>
<del><option value="Jersey">Jersey</option>
<del><option value="Jordan">Jordan</option>
<del><option value="Kazakhstan">Kazakhstan</option>
<del><option value="Kenya">Kenya</option>
<del><option value="Kiribati">Kiribati</option>
<del><option value="Korea, Democratic People's Republic of">Korea, Democratic People's Republic of</option>
<del><option value="Korea, Republic of">Korea, Republic of</option>
<del><option value="Kuwait">Kuwait</option>
<del><option value="Kyrgyzstan">Kyrgyzstan</option>
<del><option value="Lao People's Democratic Republic">Lao People's Democratic Republic</option>
<del><option value="Latvia">Latvia</option>
<del><option value="Lebanon">Lebanon</option>
<del><option value="Lesotho">Lesotho</option>
<del><option value="Liberia">Liberia</option>
<del><option value="Libyan Arab Jamahiriya">Libyan Arab Jamahiriya</option>
<del><option value="Liechtenstein">Liechtenstein</option>
<del><option value="Lithuania">Lithuania</option>
<del><option value="Luxembourg">Luxembourg</option>
<del><option value="Macao">Macao</option>
<del><option value="Macedonia, The Former Yugoslav Republic Of">Macedonia, The Former Yugoslav Republic Of</option>
<del><option value="Madagascar">Madagascar</option>
<del><option value="Malawi">Malawi</option>
<del><option value="Malaysia">Malaysia</option>
<del><option value="Maldives">Maldives</option>
<del><option value="Mali">Mali</option>
<del><option value="Malta">Malta</option>
<del><option value="Marshall Islands">Marshall Islands</option>
<del><option value="Martinique">Martinique</option>
<del><option value="Mauritania">Mauritania</option>
<del><option value="Mauritius">Mauritius</option>
<del><option value="Mayotte">Mayotte</option>
<del><option value="Mexico">Mexico</option>
<del><option value="Micronesia, Federated States of">Micronesia, Federated States of</option>
<del><option value="Moldova, Republic of">Moldova, Republic of</option>
<del><option value="Monaco">Monaco</option>
<del><option value="Mongolia">Mongolia</option>
<del><option value="Montenegro">Montenegro</option>
<del><option value="Montserrat">Montserrat</option>
<del><option value="Morocco">Morocco</option>
<del><option value="Mozambique">Mozambique</option>
<del><option value="Myanmar">Myanmar</option>
<del><option value="Namibia">Namibia</option>
<del><option value="Nauru">Nauru</option>
<del><option value="Nepal">Nepal</option>
<del><option value="Netherlands">Netherlands</option>
<del><option value="Netherlands Antilles">Netherlands Antilles</option>
<del><option value="New Caledonia">New Caledonia</option>
<del><option value="New Zealand">New Zealand</option>
<del><option value="Nicaragua">Nicaragua</option>
<del><option value="Niger">Niger</option>
<del><option value="Nigeria">Nigeria</option>
<del><option value="Niue">Niue</option>
<del><option value="Norfolk Island">Norfolk Island</option>
<del><option value="Northern Mariana Islands">Northern Mariana Islands</option>
<del><option value="Norway">Norway</option>
<del><option value="Oman">Oman</option>
<del><option value="Pakistan">Pakistan</option>
<del><option value="Palau">Palau</option>
<del><option value="Palestinian Territory, Occupied">Palestinian Territory, Occupied</option>
<del><option value="Panama">Panama</option>
<del><option value="Papua New Guinea">Papua New Guinea</option>
<del><option value="Paraguay">Paraguay</option>
<del><option value="Peru">Peru</option>
<del><option value="Philippines">Philippines</option>
<del><option value="Pitcairn">Pitcairn</option>
<del><option value="Poland">Poland</option>
<del><option value="Portugal">Portugal</option>
<del><option value="Puerto Rico">Puerto Rico</option>
<del><option value="Qatar">Qatar</option>
<del><option value="Reunion">Reunion</option>
<del><option value="Romania">Romania</option>
<del><option value="Russian Federation">Russian Federation</option>
<del><option value="Rwanda">Rwanda</option>
<del><option value="Saint Barthelemy">Saint Barthelemy</option>
<del><option value="Saint Helena">Saint Helena</option>
<del><option value="Saint Kitts and Nevis">Saint Kitts and Nevis</option>
<del><option value="Saint Lucia">Saint Lucia</option>
<del><option value="Saint Pierre and Miquelon">Saint Pierre and Miquelon</option>
<del><option value="Saint Vincent and the Grenadines">Saint Vincent and the Grenadines</option>
<del><option value="Samoa">Samoa</option>
<del><option value="San Marino">San Marino</option>
<del><option value="Sao Tome and Principe">Sao Tome and Principe</option>
<del><option value="Saudi Arabia">Saudi Arabia</option>
<del><option value="Senegal">Senegal</option>
<del><option value="Serbia">Serbia</option>
<del><option value="Seychelles">Seychelles</option>
<del><option value="Sierra Leone">Sierra Leone</option>
<del><option value="Singapore">Singapore</option>
<del><option value="Slovakia">Slovakia</option>
<del><option value="Slovenia">Slovenia</option>
<del><option value="Solomon Islands">Solomon Islands</option>
<del><option value="Somalia">Somalia</option>
<del><option value="South Africa">South Africa</option>
<del><option value="South Georgia and the South Sandwich Islands">South Georgia and the South Sandwich Islands</option>
<del><option value="Spain">Spain</option>
<del><option value="Sri Lanka">Sri Lanka</option>
<del><option value="Sudan">Sudan</option>
<del><option value="Suriname">Suriname</option>
<del><option value="Svalbard and Jan Mayen">Svalbard and Jan Mayen</option>
<del><option value="Swaziland">Swaziland</option>
<del><option value="Sweden">Sweden</option>
<del><option value="Switzerland">Switzerland</option>
<del><option value="Syrian Arab Republic">Syrian Arab Republic</option>
<del><option value="Taiwan, Province of China">Taiwan, Province of China</option>
<del><option value="Tajikistan">Tajikistan</option>
<del><option value="Tanzania, United Republic of">Tanzania, United Republic of</option>
<del><option value="Thailand">Thailand</option>
<del><option value="Timor-Leste">Timor-Leste</option>
<del><option value="Togo">Togo</option>
<del><option value="Tokelau">Tokelau</option>
<del><option value="Tonga">Tonga</option>
<del><option value="Trinidad and Tobago">Trinidad and Tobago</option>
<del><option value="Tunisia">Tunisia</option>
<del><option value="Turkey">Turkey</option>
<del><option value="Turkmenistan">Turkmenistan</option>
<del><option value="Turks and Caicos Islands">Turks and Caicos Islands</option>
<del><option value="Tuvalu">Tuvalu</option>
<del><option value="Uganda">Uganda</option>
<del><option value="Ukraine">Ukraine</option>
<del><option value="United Arab Emirates">United Arab Emirates</option>
<del><option value="United Kingdom">United Kingdom</option>
<del><option value="United States">United States</option>
<del><option value="United States Minor Outlying Islands">United States Minor Outlying Islands</option>
<del><option value="Uruguay">Uruguay</option>
<del><option value="Uzbekistan">Uzbekistan</option>
<del><option value="Vanuatu">Vanuatu</option>
<del><option value="Venezuela">Venezuela</option>
<del><option value="Viet Nam">Viet Nam</option>
<del><option value="Virgin Islands, British">Virgin Islands, British</option>
<del><option value="Virgin Islands, U.S.">Virgin Islands, U.S.</option>
<del><option value="Wallis and Futuna">Wallis and Futuna</option>
<del><option value="Western Sahara">Western Sahara</option>
<del><option value="Yemen">Yemen</option>
<del><option value="Zambia">Zambia</option>
<del><option value="Zimbabwe">Zimbabwe</option></select>
<del>COUNTRIES
<del> assert_dom_equal(expected_select[0..-2], country_select("post", "origin"))
<del> end
<del>
<del> def test_country_select_with_priority_countries
<del> @post = Post.new
<del> @post.origin = "Denmark"
<del> expected_select = <<-COUNTRIES
<del><select id="post_origin" name="post[origin]"><option value="New Zealand">New Zealand</option>
<del><option value="Nicaragua">Nicaragua</option><option value="" disabled="disabled">-------------</option>
<del><option value="Afghanistan">Afghanistan</option>
<del><option value="Aland Islands">Aland Islands</option>
<del><option value="Albania">Albania</option>
<del><option value="Algeria">Algeria</option>
<del><option value="American Samoa">American Samoa</option>
<del><option value="Andorra">Andorra</option>
<del><option value="Angola">Angola</option>
<del><option value="Anguilla">Anguilla</option>
<del><option value="Antarctica">Antarctica</option>
<del><option value="Antigua And Barbuda">Antigua And Barbuda</option>
<del><option value="Argentina">Argentina</option>
<del><option value="Armenia">Armenia</option>
<del><option value="Aruba">Aruba</option>
<del><option value="Australia">Australia</option>
<del><option value="Austria">Austria</option>
<del><option value="Azerbaijan">Azerbaijan</option>
<del><option value="Bahamas">Bahamas</option>
<del><option value="Bahrain">Bahrain</option>
<del><option value="Bangladesh">Bangladesh</option>
<del><option value="Barbados">Barbados</option>
<del><option value="Belarus">Belarus</option>
<del><option value="Belgium">Belgium</option>
<del><option value="Belize">Belize</option>
<del><option value="Benin">Benin</option>
<del><option value="Bermuda">Bermuda</option>
<del><option value="Bhutan">Bhutan</option>
<del><option value="Bolivia">Bolivia</option>
<del><option value="Bosnia and Herzegowina">Bosnia and Herzegowina</option>
<del><option value="Botswana">Botswana</option>
<del><option value="Bouvet Island">Bouvet Island</option>
<del><option value="Brazil">Brazil</option>
<del><option value="British Indian Ocean Territory">British Indian Ocean Territory</option>
<del><option value="Brunei Darussalam">Brunei Darussalam</option>
<del><option value="Bulgaria">Bulgaria</option>
<del><option value="Burkina Faso">Burkina Faso</option>
<del><option value="Burundi">Burundi</option>
<del><option value="Cambodia">Cambodia</option>
<del><option value="Cameroon">Cameroon</option>
<del><option value="Canada">Canada</option>
<del><option value="Cape Verde">Cape Verde</option>
<del><option value="Cayman Islands">Cayman Islands</option>
<del><option value="Central African Republic">Central African Republic</option>
<del><option value="Chad">Chad</option>
<del><option value="Chile">Chile</option>
<del><option value="China">China</option>
<del><option value="Christmas Island">Christmas Island</option>
<del><option value="Cocos (Keeling) Islands">Cocos (Keeling) Islands</option>
<del><option value="Colombia">Colombia</option>
<del><option value="Comoros">Comoros</option>
<del><option value="Congo">Congo</option>
<del><option value="Congo, the Democratic Republic of the">Congo, the Democratic Republic of the</option>
<del><option value="Cook Islands">Cook Islands</option>
<del><option value="Costa Rica">Costa Rica</option>
<del><option value="Cote d'Ivoire">Cote d'Ivoire</option>
<del><option value="Croatia">Croatia</option>
<del><option value="Cuba">Cuba</option>
<del><option value="Cyprus">Cyprus</option>
<del><option value="Czech Republic">Czech Republic</option>
<del><option selected="selected" value="Denmark">Denmark</option>
<del><option value="Djibouti">Djibouti</option>
<del><option value="Dominica">Dominica</option>
<del><option value="Dominican Republic">Dominican Republic</option>
<del><option value="Ecuador">Ecuador</option>
<del><option value="Egypt">Egypt</option>
<del><option value="El Salvador">El Salvador</option>
<del><option value="Equatorial Guinea">Equatorial Guinea</option>
<del><option value="Eritrea">Eritrea</option>
<del><option value="Estonia">Estonia</option>
<del><option value="Ethiopia">Ethiopia</option>
<del><option value="Falkland Islands (Malvinas)">Falkland Islands (Malvinas)</option>
<del><option value="Faroe Islands">Faroe Islands</option>
<del><option value="Fiji">Fiji</option>
<del><option value="Finland">Finland</option>
<del><option value="France">France</option>
<del><option value="French Guiana">French Guiana</option>
<del><option value="French Polynesia">French Polynesia</option>
<del><option value="French Southern Territories">French Southern Territories</option>
<del><option value="Gabon">Gabon</option>
<del><option value="Gambia">Gambia</option>
<del><option value="Georgia">Georgia</option>
<del><option value="Germany">Germany</option>
<del><option value="Ghana">Ghana</option>
<del><option value="Gibraltar">Gibraltar</option>
<del><option value="Greece">Greece</option>
<del><option value="Greenland">Greenland</option>
<del><option value="Grenada">Grenada</option>
<del><option value="Guadeloupe">Guadeloupe</option>
<del><option value="Guam">Guam</option>
<del><option value="Guatemala">Guatemala</option>
<del><option value="Guernsey">Guernsey</option>
<del><option value="Guinea">Guinea</option>
<del><option value="Guinea-Bissau">Guinea-Bissau</option>
<del><option value="Guyana">Guyana</option>
<del><option value="Haiti">Haiti</option>
<del><option value="Heard and McDonald Islands">Heard and McDonald Islands</option>
<del><option value="Holy See (Vatican City State)">Holy See (Vatican City State)</option>
<del><option value="Honduras">Honduras</option>
<del><option value="Hong Kong">Hong Kong</option>
<del><option value="Hungary">Hungary</option>
<del><option value="Iceland">Iceland</option>
<del><option value="India">India</option>
<del><option value="Indonesia">Indonesia</option>
<del><option value="Iran, Islamic Republic of">Iran, Islamic Republic of</option>
<del><option value="Iraq">Iraq</option>
<del><option value="Ireland">Ireland</option>
<del><option value="Isle of Man">Isle of Man</option>
<del><option value="Israel">Israel</option>
<del><option value="Italy">Italy</option>
<del><option value="Jamaica">Jamaica</option>
<del><option value="Japan">Japan</option>
<del><option value="Jersey">Jersey</option>
<del><option value="Jordan">Jordan</option>
<del><option value="Kazakhstan">Kazakhstan</option>
<del><option value="Kenya">Kenya</option>
<del><option value="Kiribati">Kiribati</option>
<del><option value="Korea, Democratic People's Republic of">Korea, Democratic People's Republic of</option>
<del><option value="Korea, Republic of">Korea, Republic of</option>
<del><option value="Kuwait">Kuwait</option>
<del><option value="Kyrgyzstan">Kyrgyzstan</option>
<del><option value="Lao People's Democratic Republic">Lao People's Democratic Republic</option>
<del><option value="Latvia">Latvia</option>
<del><option value="Lebanon">Lebanon</option>
<del><option value="Lesotho">Lesotho</option>
<del><option value="Liberia">Liberia</option>
<del><option value="Libyan Arab Jamahiriya">Libyan Arab Jamahiriya</option>
<del><option value="Liechtenstein">Liechtenstein</option>
<del><option value="Lithuania">Lithuania</option>
<del><option value="Luxembourg">Luxembourg</option>
<del><option value="Macao">Macao</option>
<del><option value="Macedonia, The Former Yugoslav Republic Of">Macedonia, The Former Yugoslav Republic Of</option>
<del><option value="Madagascar">Madagascar</option>
<del><option value="Malawi">Malawi</option>
<del><option value="Malaysia">Malaysia</option>
<del><option value="Maldives">Maldives</option>
<del><option value="Mali">Mali</option>
<del><option value="Malta">Malta</option>
<del><option value="Marshall Islands">Marshall Islands</option>
<del><option value="Martinique">Martinique</option>
<del><option value="Mauritania">Mauritania</option>
<del><option value="Mauritius">Mauritius</option>
<del><option value="Mayotte">Mayotte</option>
<del><option value="Mexico">Mexico</option>
<del><option value="Micronesia, Federated States of">Micronesia, Federated States of</option>
<del><option value="Moldova, Republic of">Moldova, Republic of</option>
<del><option value="Monaco">Monaco</option>
<del><option value="Mongolia">Mongolia</option>
<del><option value="Montenegro">Montenegro</option>
<del><option value="Montserrat">Montserrat</option>
<del><option value="Morocco">Morocco</option>
<del><option value="Mozambique">Mozambique</option>
<del><option value="Myanmar">Myanmar</option>
<del><option value="Namibia">Namibia</option>
<del><option value="Nauru">Nauru</option>
<del><option value="Nepal">Nepal</option>
<del><option value="Netherlands">Netherlands</option>
<del><option value="Netherlands Antilles">Netherlands Antilles</option>
<del><option value="New Caledonia">New Caledonia</option>
<del><option value="New Zealand">New Zealand</option>
<del><option value="Nicaragua">Nicaragua</option>
<del><option value="Niger">Niger</option>
<del><option value="Nigeria">Nigeria</option>
<del><option value="Niue">Niue</option>
<del><option value="Norfolk Island">Norfolk Island</option>
<del><option value="Northern Mariana Islands">Northern Mariana Islands</option>
<del><option value="Norway">Norway</option>
<del><option value="Oman">Oman</option>
<del><option value="Pakistan">Pakistan</option>
<del><option value="Palau">Palau</option>
<del><option value="Palestinian Territory, Occupied">Palestinian Territory, Occupied</option>
<del><option value="Panama">Panama</option>
<del><option value="Papua New Guinea">Papua New Guinea</option>
<del><option value="Paraguay">Paraguay</option>
<del><option value="Peru">Peru</option>
<del><option value="Philippines">Philippines</option>
<del><option value="Pitcairn">Pitcairn</option>
<del><option value="Poland">Poland</option>
<del><option value="Portugal">Portugal</option>
<del><option value="Puerto Rico">Puerto Rico</option>
<del><option value="Qatar">Qatar</option>
<del><option value="Reunion">Reunion</option>
<del><option value="Romania">Romania</option>
<del><option value="Russian Federation">Russian Federation</option>
<del><option value="Rwanda">Rwanda</option>
<del><option value="Saint Barthelemy">Saint Barthelemy</option>
<del><option value="Saint Helena">Saint Helena</option>
<del><option value="Saint Kitts and Nevis">Saint Kitts and Nevis</option>
<del><option value="Saint Lucia">Saint Lucia</option>
<del><option value="Saint Pierre and Miquelon">Saint Pierre and Miquelon</option>
<del><option value="Saint Vincent and the Grenadines">Saint Vincent and the Grenadines</option>
<del><option value="Samoa">Samoa</option>
<del><option value="San Marino">San Marino</option>
<del><option value="Sao Tome and Principe">Sao Tome and Principe</option>
<del><option value="Saudi Arabia">Saudi Arabia</option>
<del><option value="Senegal">Senegal</option>
<del><option value="Serbia">Serbia</option>
<del><option value="Seychelles">Seychelles</option>
<del><option value="Sierra Leone">Sierra Leone</option>
<del><option value="Singapore">Singapore</option>
<del><option value="Slovakia">Slovakia</option>
<del><option value="Slovenia">Slovenia</option>
<del><option value="Solomon Islands">Solomon Islands</option>
<del><option value="Somalia">Somalia</option>
<del><option value="South Africa">South Africa</option>
<del><option value="South Georgia and the South Sandwich Islands">South Georgia and the South Sandwich Islands</option>
<del><option value="Spain">Spain</option>
<del><option value="Sri Lanka">Sri Lanka</option>
<del><option value="Sudan">Sudan</option>
<del><option value="Suriname">Suriname</option>
<del><option value="Svalbard and Jan Mayen">Svalbard and Jan Mayen</option>
<del><option value="Swaziland">Swaziland</option>
<del><option value="Sweden">Sweden</option>
<del><option value="Switzerland">Switzerland</option>
<del><option value="Syrian Arab Republic">Syrian Arab Republic</option>
<del><option value="Taiwan, Province of China">Taiwan, Province of China</option>
<del><option value="Tajikistan">Tajikistan</option>
<del><option value="Tanzania, United Republic of">Tanzania, United Republic of</option>
<del><option value="Thailand">Thailand</option>
<del><option value="Timor-Leste">Timor-Leste</option>
<del><option value="Togo">Togo</option>
<del><option value="Tokelau">Tokelau</option>
<del><option value="Tonga">Tonga</option>
<del><option value="Trinidad and Tobago">Trinidad and Tobago</option>
<del><option value="Tunisia">Tunisia</option>
<del><option value="Turkey">Turkey</option>
<del><option value="Turkmenistan">Turkmenistan</option>
<del><option value="Turks and Caicos Islands">Turks and Caicos Islands</option>
<del><option value="Tuvalu">Tuvalu</option>
<del><option value="Uganda">Uganda</option>
<del><option value="Ukraine">Ukraine</option>
<del><option value="United Arab Emirates">United Arab Emirates</option>
<del><option value="United Kingdom">United Kingdom</option>
<del><option value="United States">United States</option>
<del><option value="United States Minor Outlying Islands">United States Minor Outlying Islands</option>
<del><option value="Uruguay">Uruguay</option>
<del><option value="Uzbekistan">Uzbekistan</option>
<del><option value="Vanuatu">Vanuatu</option>
<del><option value="Venezuela">Venezuela</option>
<del><option value="Viet Nam">Viet Nam</option>
<del><option value="Virgin Islands, British">Virgin Islands, British</option>
<del><option value="Virgin Islands, U.S.">Virgin Islands, U.S.</option>
<del><option value="Wallis and Futuna">Wallis and Futuna</option>
<del><option value="Western Sahara">Western Sahara</option>
<del><option value="Yemen">Yemen</option>
<del><option value="Zambia">Zambia</option>
<del><option value="Zimbabwe">Zimbabwe</option></select>
<del>COUNTRIES
<del> assert_dom_equal(expected_select[0..-2], country_select("post", "origin", ["New Zealand", "Nicaragua"]))
<del> end
<del>
<del> def test_country_select_with_selected_priority_country
<del> @post = Post.new
<del> @post.origin = "New Zealand"
<del> expected_select = <<-COUNTRIES
<del><select id="post_origin" name="post[origin]"><option selected="selected" value="New Zealand">New Zealand</option>
<del><option value="Nicaragua">Nicaragua</option><option value="" disabled="disabled">-------------</option>
<del><option value="Afghanistan">Afghanistan</option>
<del><option value="Aland Islands">Aland Islands</option>
<del><option value="Albania">Albania</option>
<del><option value="Algeria">Algeria</option>
<del><option value="American Samoa">American Samoa</option>
<del><option value="Andorra">Andorra</option>
<del><option value="Angola">Angola</option>
<del><option value="Anguilla">Anguilla</option>
<del><option value="Antarctica">Antarctica</option>
<del><option value="Antigua And Barbuda">Antigua And Barbuda</option>
<del><option value="Argentina">Argentina</option>
<del><option value="Armenia">Armenia</option>
<del><option value="Aruba">Aruba</option>
<del><option value="Australia">Australia</option>
<del><option value="Austria">Austria</option>
<del><option value="Azerbaijan">Azerbaijan</option>
<del><option value="Bahamas">Bahamas</option>
<del><option value="Bahrain">Bahrain</option>
<del><option value="Bangladesh">Bangladesh</option>
<del><option value="Barbados">Barbados</option>
<del><option value="Belarus">Belarus</option>
<del><option value="Belgium">Belgium</option>
<del><option value="Belize">Belize</option>
<del><option value="Benin">Benin</option>
<del><option value="Bermuda">Bermuda</option>
<del><option value="Bhutan">Bhutan</option>
<del><option value="Bolivia">Bolivia</option>
<del><option value="Bosnia and Herzegowina">Bosnia and Herzegowina</option>
<del><option value="Botswana">Botswana</option>
<del><option value="Bouvet Island">Bouvet Island</option>
<del><option value="Brazil">Brazil</option>
<del><option value="British Indian Ocean Territory">British Indian Ocean Territory</option>
<del><option value="Brunei Darussalam">Brunei Darussalam</option>
<del><option value="Bulgaria">Bulgaria</option>
<del><option value="Burkina Faso">Burkina Faso</option>
<del><option value="Burundi">Burundi</option>
<del><option value="Cambodia">Cambodia</option>
<del><option value="Cameroon">Cameroon</option>
<del><option value="Canada">Canada</option>
<del><option value="Cape Verde">Cape Verde</option>
<del><option value="Cayman Islands">Cayman Islands</option>
<del><option value="Central African Republic">Central African Republic</option>
<del><option value="Chad">Chad</option>
<del><option value="Chile">Chile</option>
<del><option value="China">China</option>
<del><option value="Christmas Island">Christmas Island</option>
<del><option value="Cocos (Keeling) Islands">Cocos (Keeling) Islands</option>
<del><option value="Colombia">Colombia</option>
<del><option value="Comoros">Comoros</option>
<del><option value="Congo">Congo</option>
<del><option value="Congo, the Democratic Republic of the">Congo, the Democratic Republic of the</option>
<del><option value="Cook Islands">Cook Islands</option>
<del><option value="Costa Rica">Costa Rica</option>
<del><option value="Cote d'Ivoire">Cote d'Ivoire</option>
<del><option value="Croatia">Croatia</option>
<del><option value="Cuba">Cuba</option>
<del><option value="Cyprus">Cyprus</option>
<del><option value="Czech Republic">Czech Republic</option>
<del><option value="Denmark">Denmark</option>
<del><option value="Djibouti">Djibouti</option>
<del><option value="Dominica">Dominica</option>
<del><option value="Dominican Republic">Dominican Republic</option>
<del><option value="Ecuador">Ecuador</option>
<del><option value="Egypt">Egypt</option>
<del><option value="El Salvador">El Salvador</option>
<del><option value="Equatorial Guinea">Equatorial Guinea</option>
<del><option value="Eritrea">Eritrea</option>
<del><option value="Estonia">Estonia</option>
<del><option value="Ethiopia">Ethiopia</option>
<del><option value="Falkland Islands (Malvinas)">Falkland Islands (Malvinas)</option>
<del><option value="Faroe Islands">Faroe Islands</option>
<del><option value="Fiji">Fiji</option>
<del><option value="Finland">Finland</option>
<del><option value="France">France</option>
<del><option value="French Guiana">French Guiana</option>
<del><option value="French Polynesia">French Polynesia</option>
<del><option value="French Southern Territories">French Southern Territories</option>
<del><option value="Gabon">Gabon</option>
<del><option value="Gambia">Gambia</option>
<del><option value="Georgia">Georgia</option>
<del><option value="Germany">Germany</option>
<del><option value="Ghana">Ghana</option>
<del><option value="Gibraltar">Gibraltar</option>
<del><option value="Greece">Greece</option>
<del><option value="Greenland">Greenland</option>
<del><option value="Grenada">Grenada</option>
<del><option value="Guadeloupe">Guadeloupe</option>
<del><option value="Guam">Guam</option>
<del><option value="Guatemala">Guatemala</option>
<del><option value="Guernsey">Guernsey</option>
<del><option value="Guinea">Guinea</option>
<del><option value="Guinea-Bissau">Guinea-Bissau</option>
<del><option value="Guyana">Guyana</option>
<del><option value="Haiti">Haiti</option>
<del><option value="Heard and McDonald Islands">Heard and McDonald Islands</option>
<del><option value="Holy See (Vatican City State)">Holy See (Vatican City State)</option>
<del><option value="Honduras">Honduras</option>
<del><option value="Hong Kong">Hong Kong</option>
<del><option value="Hungary">Hungary</option>
<del><option value="Iceland">Iceland</option>
<del><option value="India">India</option>
<del><option value="Indonesia">Indonesia</option>
<del><option value="Iran, Islamic Republic of">Iran, Islamic Republic of</option>
<del><option value="Iraq">Iraq</option>
<del><option value="Ireland">Ireland</option>
<del><option value="Isle of Man">Isle of Man</option>
<del><option value="Israel">Israel</option>
<del><option value="Italy">Italy</option>
<del><option value="Jamaica">Jamaica</option>
<del><option value="Japan">Japan</option>
<del><option value="Jersey">Jersey</option>
<del><option value="Jordan">Jordan</option>
<del><option value="Kazakhstan">Kazakhstan</option>
<del><option value="Kenya">Kenya</option>
<del><option value="Kiribati">Kiribati</option>
<del><option value="Korea, Democratic People's Republic of">Korea, Democratic People's Republic of</option>
<del><option value="Korea, Republic of">Korea, Republic of</option>
<del><option value="Kuwait">Kuwait</option>
<del><option value="Kyrgyzstan">Kyrgyzstan</option>
<del><option value="Lao People's Democratic Republic">Lao People's Democratic Republic</option>
<del><option value="Latvia">Latvia</option>
<del><option value="Lebanon">Lebanon</option>
<del><option value="Lesotho">Lesotho</option>
<del><option value="Liberia">Liberia</option>
<del><option value="Libyan Arab Jamahiriya">Libyan Arab Jamahiriya</option>
<del><option value="Liechtenstein">Liechtenstein</option>
<del><option value="Lithuania">Lithuania</option>
<del><option value="Luxembourg">Luxembourg</option>
<del><option value="Macao">Macao</option>
<del><option value="Macedonia, The Former Yugoslav Republic Of">Macedonia, The Former Yugoslav Republic Of</option>
<del><option value="Madagascar">Madagascar</option>
<del><option value="Malawi">Malawi</option>
<del><option value="Malaysia">Malaysia</option>
<del><option value="Maldives">Maldives</option>
<del><option value="Mali">Mali</option>
<del><option value="Malta">Malta</option>
<del><option value="Marshall Islands">Marshall Islands</option>
<del><option value="Martinique">Martinique</option>
<del><option value="Mauritania">Mauritania</option>
<del><option value="Mauritius">Mauritius</option>
<del><option value="Mayotte">Mayotte</option>
<del><option value="Mexico">Mexico</option>
<del><option value="Micronesia, Federated States of">Micronesia, Federated States of</option>
<del><option value="Moldova, Republic of">Moldova, Republic of</option>
<del><option value="Monaco">Monaco</option>
<del><option value="Mongolia">Mongolia</option>
<del><option value="Montenegro">Montenegro</option>
<del><option value="Montserrat">Montserrat</option>
<del><option value="Morocco">Morocco</option>
<del><option value="Mozambique">Mozambique</option>
<del><option value="Myanmar">Myanmar</option>
<del><option value="Namibia">Namibia</option>
<del><option value="Nauru">Nauru</option>
<del><option value="Nepal">Nepal</option>
<del><option value="Netherlands">Netherlands</option>
<del><option value="Netherlands Antilles">Netherlands Antilles</option>
<del><option value="New Caledonia">New Caledonia</option>
<del><option selected="selected" value="New Zealand">New Zealand</option>
<del><option value="Nicaragua">Nicaragua</option>
<del><option value="Niger">Niger</option>
<del><option value="Nigeria">Nigeria</option>
<del><option value="Niue">Niue</option>
<del><option value="Norfolk Island">Norfolk Island</option>
<del><option value="Northern Mariana Islands">Northern Mariana Islands</option>
<del><option value="Norway">Norway</option>
<del><option value="Oman">Oman</option>
<del><option value="Pakistan">Pakistan</option>
<del><option value="Palau">Palau</option>
<del><option value="Palestinian Territory, Occupied">Palestinian Territory, Occupied</option>
<del><option value="Panama">Panama</option>
<del><option value="Papua New Guinea">Papua New Guinea</option>
<del><option value="Paraguay">Paraguay</option>
<del><option value="Peru">Peru</option>
<del><option value="Philippines">Philippines</option>
<del><option value="Pitcairn">Pitcairn</option>
<del><option value="Poland">Poland</option>
<del><option value="Portugal">Portugal</option>
<del><option value="Puerto Rico">Puerto Rico</option>
<del><option value="Qatar">Qatar</option>
<del><option value="Reunion">Reunion</option>
<del><option value="Romania">Romania</option>
<del><option value="Russian Federation">Russian Federation</option>
<del><option value="Rwanda">Rwanda</option>
<del><option value="Saint Barthelemy">Saint Barthelemy</option>
<del><option value="Saint Helena">Saint Helena</option>
<del><option value="Saint Kitts and Nevis">Saint Kitts and Nevis</option>
<del><option value="Saint Lucia">Saint Lucia</option>
<del><option value="Saint Pierre and Miquelon">Saint Pierre and Miquelon</option>
<del><option value="Saint Vincent and the Grenadines">Saint Vincent and the Grenadines</option>
<del><option value="Samoa">Samoa</option>
<del><option value="San Marino">San Marino</option>
<del><option value="Sao Tome and Principe">Sao Tome and Principe</option>
<del><option value="Saudi Arabia">Saudi Arabia</option>
<del><option value="Senegal">Senegal</option>
<del><option value="Serbia">Serbia</option>
<del><option value="Seychelles">Seychelles</option>
<del><option value="Sierra Leone">Sierra Leone</option>
<del><option value="Singapore">Singapore</option>
<del><option value="Slovakia">Slovakia</option>
<del><option value="Slovenia">Slovenia</option>
<del><option value="Solomon Islands">Solomon Islands</option>
<del><option value="Somalia">Somalia</option>
<del><option value="South Africa">South Africa</option>
<del><option value="South Georgia and the South Sandwich Islands">South Georgia and the South Sandwich Islands</option>
<del><option value="Spain">Spain</option>
<del><option value="Sri Lanka">Sri Lanka</option>
<del><option value="Sudan">Sudan</option>
<del><option value="Suriname">Suriname</option>
<del><option value="Svalbard and Jan Mayen">Svalbard and Jan Mayen</option>
<del><option value="Swaziland">Swaziland</option>
<del><option value="Sweden">Sweden</option>
<del><option value="Switzerland">Switzerland</option>
<del><option value="Syrian Arab Republic">Syrian Arab Republic</option>
<del><option value="Taiwan, Province of China">Taiwan, Province of China</option>
<del><option value="Tajikistan">Tajikistan</option>
<del><option value="Tanzania, United Republic of">Tanzania, United Republic of</option>
<del><option value="Thailand">Thailand</option>
<del><option value="Timor-Leste">Timor-Leste</option>
<del><option value="Togo">Togo</option>
<del><option value="Tokelau">Tokelau</option>
<del><option value="Tonga">Tonga</option>
<del><option value="Trinidad and Tobago">Trinidad and Tobago</option>
<del><option value="Tunisia">Tunisia</option>
<del><option value="Turkey">Turkey</option>
<del><option value="Turkmenistan">Turkmenistan</option>
<del><option value="Turks and Caicos Islands">Turks and Caicos Islands</option>
<del><option value="Tuvalu">Tuvalu</option>
<del><option value="Uganda">Uganda</option>
<del><option value="Ukraine">Ukraine</option>
<del><option value="United Arab Emirates">United Arab Emirates</option>
<del><option value="United Kingdom">United Kingdom</option>
<del><option value="United States">United States</option>
<del><option value="United States Minor Outlying Islands">United States Minor Outlying Islands</option>
<del><option value="Uruguay">Uruguay</option>
<del><option value="Uzbekistan">Uzbekistan</option>
<del><option value="Vanuatu">Vanuatu</option>
<del><option value="Venezuela">Venezuela</option>
<del><option value="Viet Nam">Viet Nam</option>
<del><option value="Virgin Islands, British">Virgin Islands, British</option>
<del><option value="Virgin Islands, U.S.">Virgin Islands, U.S.</option>
<del><option value="Wallis and Futuna">Wallis and Futuna</option>
<del><option value="Western Sahara">Western Sahara</option>
<del><option value="Yemen">Yemen</option>
<del><option value="Zambia">Zambia</option>
<del><option value="Zimbabwe">Zimbabwe</option></select>
<del>COUNTRIES
<del> assert_dom_equal(expected_select[0..-2], country_select("post", "origin", ["New Zealand", "Nicaragua"]))
<del> end
<del>
<del> def test_country_select_under_fields_for
<del> @post = Post.new
<del> @post.origin = "Australia"
<del> expected_select = <<-COUNTRIES
<del><select id="post_origin" name="post[origin]"><option value="Afghanistan">Afghanistan</option>
<del><option value="Aland Islands">Aland Islands</option>
<del><option value="Albania">Albania</option>
<del><option value="Algeria">Algeria</option>
<del><option value="American Samoa">American Samoa</option>
<del><option value="Andorra">Andorra</option>
<del><option value="Angola">Angola</option>
<del><option value="Anguilla">Anguilla</option>
<del><option value="Antarctica">Antarctica</option>
<del><option value="Antigua And Barbuda">Antigua And Barbuda</option>
<del><option value="Argentina">Argentina</option>
<del><option value="Armenia">Armenia</option>
<del><option value="Aruba">Aruba</option>
<del><option selected="selected" value="Australia">Australia</option>
<del><option value="Austria">Austria</option>
<del><option value="Azerbaijan">Azerbaijan</option>
<del><option value="Bahamas">Bahamas</option>
<del><option value="Bahrain">Bahrain</option>
<del><option value="Bangladesh">Bangladesh</option>
<del><option value="Barbados">Barbados</option>
<del><option value="Belarus">Belarus</option>
<del><option value="Belgium">Belgium</option>
<del><option value="Belize">Belize</option>
<del><option value="Benin">Benin</option>
<del><option value="Bermuda">Bermuda</option>
<del><option value="Bhutan">Bhutan</option>
<del><option value="Bolivia">Bolivia</option>
<del><option value="Bosnia and Herzegowina">Bosnia and Herzegowina</option>
<del><option value="Botswana">Botswana</option>
<del><option value="Bouvet Island">Bouvet Island</option>
<del><option value="Brazil">Brazil</option>
<del><option value="British Indian Ocean Territory">British Indian Ocean Territory</option>
<del><option value="Brunei Darussalam">Brunei Darussalam</option>
<del><option value="Bulgaria">Bulgaria</option>
<del><option value="Burkina Faso">Burkina Faso</option>
<del><option value="Burundi">Burundi</option>
<del><option value="Cambodia">Cambodia</option>
<del><option value="Cameroon">Cameroon</option>
<del><option value="Canada">Canada</option>
<del><option value="Cape Verde">Cape Verde</option>
<del><option value="Cayman Islands">Cayman Islands</option>
<del><option value="Central African Republic">Central African Republic</option>
<del><option value="Chad">Chad</option>
<del><option value="Chile">Chile</option>
<del><option value="China">China</option>
<del><option value="Christmas Island">Christmas Island</option>
<del><option value="Cocos (Keeling) Islands">Cocos (Keeling) Islands</option>
<del><option value="Colombia">Colombia</option>
<del><option value="Comoros">Comoros</option>
<del><option value="Congo">Congo</option>
<del><option value="Congo, the Democratic Republic of the">Congo, the Democratic Republic of the</option>
<del><option value="Cook Islands">Cook Islands</option>
<del><option value="Costa Rica">Costa Rica</option>
<del><option value="Cote d'Ivoire">Cote d'Ivoire</option>
<del><option value="Croatia">Croatia</option>
<del><option value="Cuba">Cuba</option>
<del><option value="Cyprus">Cyprus</option>
<del><option value="Czech Republic">Czech Republic</option>
<del><option value="Denmark">Denmark</option>
<del><option value="Djibouti">Djibouti</option>
<del><option value="Dominica">Dominica</option>
<del><option value="Dominican Republic">Dominican Republic</option>
<del><option value="Ecuador">Ecuador</option>
<del><option value="Egypt">Egypt</option>
<del><option value="El Salvador">El Salvador</option>
<del><option value="Equatorial Guinea">Equatorial Guinea</option>
<del><option value="Eritrea">Eritrea</option>
<del><option value="Estonia">Estonia</option>
<del><option value="Ethiopia">Ethiopia</option>
<del><option value="Falkland Islands (Malvinas)">Falkland Islands (Malvinas)</option>
<del><option value="Faroe Islands">Faroe Islands</option>
<del><option value="Fiji">Fiji</option>
<del><option value="Finland">Finland</option>
<del><option value="France">France</option>
<del><option value="French Guiana">French Guiana</option>
<del><option value="French Polynesia">French Polynesia</option>
<del><option value="French Southern Territories">French Southern Territories</option>
<del><option value="Gabon">Gabon</option>
<del><option value="Gambia">Gambia</option>
<del><option value="Georgia">Georgia</option>
<del><option value="Germany">Germany</option>
<del><option value="Ghana">Ghana</option>
<del><option value="Gibraltar">Gibraltar</option>
<del><option value="Greece">Greece</option>
<del><option value="Greenland">Greenland</option>
<del><option value="Grenada">Grenada</option>
<del><option value="Guadeloupe">Guadeloupe</option>
<del><option value="Guam">Guam</option>
<del><option value="Guatemala">Guatemala</option>
<del><option value="Guernsey">Guernsey</option>
<del><option value="Guinea">Guinea</option>
<del><option value="Guinea-Bissau">Guinea-Bissau</option>
<del><option value="Guyana">Guyana</option>
<del><option value="Haiti">Haiti</option>
<del><option value="Heard and McDonald Islands">Heard and McDonald Islands</option>
<del><option value="Holy See (Vatican City State)">Holy See (Vatican City State)</option>
<del><option value="Honduras">Honduras</option>
<del><option value="Hong Kong">Hong Kong</option>
<del><option value="Hungary">Hungary</option>
<del><option value="Iceland">Iceland</option>
<del><option value="India">India</option>
<del><option value="Indonesia">Indonesia</option>
<del><option value="Iran, Islamic Republic of">Iran, Islamic Republic of</option>
<del><option value="Iraq">Iraq</option>
<del><option value="Ireland">Ireland</option>
<del><option value="Isle of Man">Isle of Man</option>
<del><option value="Israel">Israel</option>
<del><option value="Italy">Italy</option>
<del><option value="Jamaica">Jamaica</option>
<del><option value="Japan">Japan</option>
<del><option value="Jersey">Jersey</option>
<del><option value="Jordan">Jordan</option>
<del><option value="Kazakhstan">Kazakhstan</option>
<del><option value="Kenya">Kenya</option>
<del><option value="Kiribati">Kiribati</option>
<del><option value="Korea, Democratic People's Republic of">Korea, Democratic People's Republic of</option>
<del><option value="Korea, Republic of">Korea, Republic of</option>
<del><option value="Kuwait">Kuwait</option>
<del><option value="Kyrgyzstan">Kyrgyzstan</option>
<del><option value="Lao People's Democratic Republic">Lao People's Democratic Republic</option>
<del><option value="Latvia">Latvia</option>
<del><option value="Lebanon">Lebanon</option>
<del><option value="Lesotho">Lesotho</option>
<del><option value="Liberia">Liberia</option>
<del><option value="Libyan Arab Jamahiriya">Libyan Arab Jamahiriya</option>
<del><option value="Liechtenstein">Liechtenstein</option>
<del><option value="Lithuania">Lithuania</option>
<del><option value="Luxembourg">Luxembourg</option>
<del><option value="Macao">Macao</option>
<del><option value="Macedonia, The Former Yugoslav Republic Of">Macedonia, The Former Yugoslav Republic Of</option>
<del><option value="Madagascar">Madagascar</option>
<del><option value="Malawi">Malawi</option>
<del><option value="Malaysia">Malaysia</option>
<del><option value="Maldives">Maldives</option>
<del><option value="Mali">Mali</option>
<del><option value="Malta">Malta</option>
<del><option value="Marshall Islands">Marshall Islands</option>
<del><option value="Martinique">Martinique</option>
<del><option value="Mauritania">Mauritania</option>
<del><option value="Mauritius">Mauritius</option>
<del><option value="Mayotte">Mayotte</option>
<del><option value="Mexico">Mexico</option>
<del><option value="Micronesia, Federated States of">Micronesia, Federated States of</option>
<del><option value="Moldova, Republic of">Moldova, Republic of</option>
<del><option value="Monaco">Monaco</option>
<del><option value="Mongolia">Mongolia</option>
<del><option value="Montenegro">Montenegro</option>
<del><option value="Montserrat">Montserrat</option>
<del><option value="Morocco">Morocco</option>
<del><option value="Mozambique">Mozambique</option>
<del><option value="Myanmar">Myanmar</option>
<del><option value="Namibia">Namibia</option>
<del><option value="Nauru">Nauru</option>
<del><option value="Nepal">Nepal</option>
<del><option value="Netherlands">Netherlands</option>
<del><option value="Netherlands Antilles">Netherlands Antilles</option>
<del><option value="New Caledonia">New Caledonia</option>
<del><option value="New Zealand">New Zealand</option>
<del><option value="Nicaragua">Nicaragua</option>
<del><option value="Niger">Niger</option>
<del><option value="Nigeria">Nigeria</option>
<del><option value="Niue">Niue</option>
<del><option value="Norfolk Island">Norfolk Island</option>
<del><option value="Northern Mariana Islands">Northern Mariana Islands</option>
<del><option value="Norway">Norway</option>
<del><option value="Oman">Oman</option>
<del><option value="Pakistan">Pakistan</option>
<del><option value="Palau">Palau</option>
<del><option value="Palestinian Territory, Occupied">Palestinian Territory, Occupied</option>
<del><option value="Panama">Panama</option>
<del><option value="Papua New Guinea">Papua New Guinea</option>
<del><option value="Paraguay">Paraguay</option>
<del><option value="Peru">Peru</option>
<del><option value="Philippines">Philippines</option>
<del><option value="Pitcairn">Pitcairn</option>
<del><option value="Poland">Poland</option>
<del><option value="Portugal">Portugal</option>
<del><option value="Puerto Rico">Puerto Rico</option>
<del><option value="Qatar">Qatar</option>
<del><option value="Reunion">Reunion</option>
<del><option value="Romania">Romania</option>
<del><option value="Russian Federation">Russian Federation</option>
<del><option value="Rwanda">Rwanda</option>
<del><option value="Saint Barthelemy">Saint Barthelemy</option>
<del><option value="Saint Helena">Saint Helena</option>
<del><option value="Saint Kitts and Nevis">Saint Kitts and Nevis</option>
<del><option value="Saint Lucia">Saint Lucia</option>
<del><option value="Saint Pierre and Miquelon">Saint Pierre and Miquelon</option>
<del><option value="Saint Vincent and the Grenadines">Saint Vincent and the Grenadines</option>
<del><option value="Samoa">Samoa</option>
<del><option value="San Marino">San Marino</option>
<del><option value="Sao Tome and Principe">Sao Tome and Principe</option>
<del><option value="Saudi Arabia">Saudi Arabia</option>
<del><option value="Senegal">Senegal</option>
<del><option value="Serbia">Serbia</option>
<del><option value="Seychelles">Seychelles</option>
<del><option value="Sierra Leone">Sierra Leone</option>
<del><option value="Singapore">Singapore</option>
<del><option value="Slovakia">Slovakia</option>
<del><option value="Slovenia">Slovenia</option>
<del><option value="Solomon Islands">Solomon Islands</option>
<del><option value="Somalia">Somalia</option>
<del><option value="South Africa">South Africa</option>
<del><option value="South Georgia and the South Sandwich Islands">South Georgia and the South Sandwich Islands</option>
<del><option value="Spain">Spain</option>
<del><option value="Sri Lanka">Sri Lanka</option>
<del><option value="Sudan">Sudan</option>
<del><option value="Suriname">Suriname</option>
<del><option value="Svalbard and Jan Mayen">Svalbard and Jan Mayen</option>
<del><option value="Swaziland">Swaziland</option>
<del><option value="Sweden">Sweden</option>
<del><option value="Switzerland">Switzerland</option>
<del><option value="Syrian Arab Republic">Syrian Arab Republic</option>
<del><option value="Taiwan, Province of China">Taiwan, Province of China</option>
<del><option value="Tajikistan">Tajikistan</option>
<del><option value="Tanzania, United Republic of">Tanzania, United Republic of</option>
<del><option value="Thailand">Thailand</option>
<del><option value="Timor-Leste">Timor-Leste</option>
<del><option value="Togo">Togo</option>
<del><option value="Tokelau">Tokelau</option>
<del><option value="Tonga">Tonga</option>
<del><option value="Trinidad and Tobago">Trinidad and Tobago</option>
<del><option value="Tunisia">Tunisia</option>
<del><option value="Turkey">Turkey</option>
<del><option value="Turkmenistan">Turkmenistan</option>
<del><option value="Turks and Caicos Islands">Turks and Caicos Islands</option>
<del><option value="Tuvalu">Tuvalu</option>
<del><option value="Uganda">Uganda</option>
<del><option value="Ukraine">Ukraine</option>
<del><option value="United Arab Emirates">United Arab Emirates</option>
<del><option value="United Kingdom">United Kingdom</option>
<del><option value="United States">United States</option>
<del><option value="United States Minor Outlying Islands">United States Minor Outlying Islands</option>
<del><option value="Uruguay">Uruguay</option>
<del><option value="Uzbekistan">Uzbekistan</option>
<del><option value="Vanuatu">Vanuatu</option>
<del><option value="Venezuela">Venezuela</option>
<del><option value="Viet Nam">Viet Nam</option>
<del><option value="Virgin Islands, British">Virgin Islands, British</option>
<del><option value="Virgin Islands, U.S.">Virgin Islands, U.S.</option>
<del><option value="Wallis and Futuna">Wallis and Futuna</option>
<del><option value="Western Sahara">Western Sahara</option>
<del><option value="Yemen">Yemen</option>
<del><option value="Zambia">Zambia</option>
<del><option value="Zimbabwe">Zimbabwe</option></select>
<del>COUNTRIES
<del>
<del> fields_for :post, @post do |f|
<del> concat f.country_select("origin")
<del> end
<del>
<del> assert_dom_equal(expected_select[0..-2], output_buffer)
<del> end
<del>
<del> def test_country_select_under_fields_for_with_index
<del> @post = Post.new
<del> @post.origin = "United States"
<del> expected_select = <<-COUNTRIES
<del><select id="post_325_origin" name="post[325][origin]"><option value="Afghanistan">Afghanistan</option>
<del><option value="Aland Islands">Aland Islands</option>
<del><option value="Albania">Albania</option>
<del><option value="Algeria">Algeria</option>
<del><option value="American Samoa">American Samoa</option>
<del><option value="Andorra">Andorra</option>
<del><option value="Angola">Angola</option>
<del><option value="Anguilla">Anguilla</option>
<del><option value="Antarctica">Antarctica</option>
<del><option value="Antigua And Barbuda">Antigua And Barbuda</option>
<del><option value="Argentina">Argentina</option>
<del><option value="Armenia">Armenia</option>
<del><option value="Aruba">Aruba</option>
<del><option value="Australia">Australia</option>
<del><option value="Austria">Austria</option>
<del><option value="Azerbaijan">Azerbaijan</option>
<del><option value="Bahamas">Bahamas</option>
<del><option value="Bahrain">Bahrain</option>
<del><option value="Bangladesh">Bangladesh</option>
<del><option value="Barbados">Barbados</option>
<del><option value="Belarus">Belarus</option>
<del><option value="Belgium">Belgium</option>
<del><option value="Belize">Belize</option>
<del><option value="Benin">Benin</option>
<del><option value="Bermuda">Bermuda</option>
<del><option value="Bhutan">Bhutan</option>
<del><option value="Bolivia">Bolivia</option>
<del><option value="Bosnia and Herzegowina">Bosnia and Herzegowina</option>
<del><option value="Botswana">Botswana</option>
<del><option value="Bouvet Island">Bouvet Island</option>
<del><option value="Brazil">Brazil</option>
<del><option value="British Indian Ocean Territory">British Indian Ocean Territory</option>
<del><option value="Brunei Darussalam">Brunei Darussalam</option>
<del><option value="Bulgaria">Bulgaria</option>
<del><option value="Burkina Faso">Burkina Faso</option>
<del><option value="Burundi">Burundi</option>
<del><option value="Cambodia">Cambodia</option>
<del><option value="Cameroon">Cameroon</option>
<del><option value="Canada">Canada</option>
<del><option value="Cape Verde">Cape Verde</option>
<del><option value="Cayman Islands">Cayman Islands</option>
<del><option value="Central African Republic">Central African Republic</option>
<del><option value="Chad">Chad</option>
<del><option value="Chile">Chile</option>
<del><option value="China">China</option>
<del><option value="Christmas Island">Christmas Island</option>
<del><option value="Cocos (Keeling) Islands">Cocos (Keeling) Islands</option>
<del><option value="Colombia">Colombia</option>
<del><option value="Comoros">Comoros</option>
<del><option value="Congo">Congo</option>
<del><option value="Congo, the Democratic Republic of the">Congo, the Democratic Republic of the</option>
<del><option value="Cook Islands">Cook Islands</option>
<del><option value="Costa Rica">Costa Rica</option>
<del><option value="Cote d'Ivoire">Cote d'Ivoire</option>
<del><option value="Croatia">Croatia</option>
<del><option value="Cuba">Cuba</option>
<del><option value="Cyprus">Cyprus</option>
<del><option value="Czech Republic">Czech Republic</option>
<del><option value="Denmark">Denmark</option>
<del><option value="Djibouti">Djibouti</option>
<del><option value="Dominica">Dominica</option>
<del><option value="Dominican Republic">Dominican Republic</option>
<del><option value="Ecuador">Ecuador</option>
<del><option value="Egypt">Egypt</option>
<del><option value="El Salvador">El Salvador</option>
<del><option value="Equatorial Guinea">Equatorial Guinea</option>
<del><option value="Eritrea">Eritrea</option>
<del><option value="Estonia">Estonia</option>
<del><option value="Ethiopia">Ethiopia</option>
<del><option value="Falkland Islands (Malvinas)">Falkland Islands (Malvinas)</option>
<del><option value="Faroe Islands">Faroe Islands</option>
<del><option value="Fiji">Fiji</option>
<del><option value="Finland">Finland</option>
<del><option value="France">France</option>
<del><option value="French Guiana">French Guiana</option>
<del><option value="French Polynesia">French Polynesia</option>
<del><option value="French Southern Territories">French Southern Territories</option>
<del><option value="Gabon">Gabon</option>
<del><option value="Gambia">Gambia</option>
<del><option value="Georgia">Georgia</option>
<del><option value="Germany">Germany</option>
<del><option value="Ghana">Ghana</option>
<del><option value="Gibraltar">Gibraltar</option>
<del><option value="Greece">Greece</option>
<del><option value="Greenland">Greenland</option>
<del><option value="Grenada">Grenada</option>
<del><option value="Guadeloupe">Guadeloupe</option>
<del><option value="Guam">Guam</option>
<del><option value="Guatemala">Guatemala</option>
<del><option value="Guernsey">Guernsey</option>
<del><option value="Guinea">Guinea</option>
<del><option value="Guinea-Bissau">Guinea-Bissau</option>
<del><option value="Guyana">Guyana</option>
<del><option value="Haiti">Haiti</option>
<del><option value="Heard and McDonald Islands">Heard and McDonald Islands</option>
<del><option value="Holy See (Vatican City State)">Holy See (Vatican City State)</option>
<del><option value="Honduras">Honduras</option>
<del><option value="Hong Kong">Hong Kong</option>
<del><option value="Hungary">Hungary</option>
<del><option value="Iceland">Iceland</option>
<del><option value="India">India</option>
<del><option value="Indonesia">Indonesia</option>
<del><option value="Iran, Islamic Republic of">Iran, Islamic Republic of</option>
<del><option value="Iraq">Iraq</option>
<del><option value="Ireland">Ireland</option>
<del><option value="Isle of Man">Isle of Man</option>
<del><option value="Israel">Israel</option>
<del><option value="Italy">Italy</option>
<del><option value="Jamaica">Jamaica</option>
<del><option value="Japan">Japan</option>
<del><option value="Jersey">Jersey</option>
<del><option value="Jordan">Jordan</option>
<del><option value="Kazakhstan">Kazakhstan</option>
<del><option value="Kenya">Kenya</option>
<del><option value="Kiribati">Kiribati</option>
<del><option value="Korea, Democratic People's Republic of">Korea, Democratic People's Republic of</option>
<del><option value="Korea, Republic of">Korea, Republic of</option>
<del><option value="Kuwait">Kuwait</option>
<del><option value="Kyrgyzstan">Kyrgyzstan</option>
<del><option value="Lao People's Democratic Republic">Lao People's Democratic Republic</option>
<del><option value="Latvia">Latvia</option>
<del><option value="Lebanon">Lebanon</option>
<del><option value="Lesotho">Lesotho</option>
<del><option value="Liberia">Liberia</option>
<del><option value="Libyan Arab Jamahiriya">Libyan Arab Jamahiriya</option>
<del><option value="Liechtenstein">Liechtenstein</option>
<del><option value="Lithuania">Lithuania</option>
<del><option value="Luxembourg">Luxembourg</option>
<del><option value="Macao">Macao</option>
<del><option value="Macedonia, The Former Yugoslav Republic Of">Macedonia, The Former Yugoslav Republic Of</option>
<del><option value="Madagascar">Madagascar</option>
<del><option value="Malawi">Malawi</option>
<del><option value="Malaysia">Malaysia</option>
<del><option value="Maldives">Maldives</option>
<del><option value="Mali">Mali</option>
<del><option value="Malta">Malta</option>
<del><option value="Marshall Islands">Marshall Islands</option>
<del><option value="Martinique">Martinique</option>
<del><option value="Mauritania">Mauritania</option>
<del><option value="Mauritius">Mauritius</option>
<del><option value="Mayotte">Mayotte</option>
<del><option value="Mexico">Mexico</option>
<del><option value="Micronesia, Federated States of">Micronesia, Federated States of</option>
<del><option value="Moldova, Republic of">Moldova, Republic of</option>
<del><option value="Monaco">Monaco</option>
<del><option value="Mongolia">Mongolia</option>
<del><option value="Montenegro">Montenegro</option>
<del><option value="Montserrat">Montserrat</option>
<del><option value="Morocco">Morocco</option>
<del><option value="Mozambique">Mozambique</option>
<del><option value="Myanmar">Myanmar</option>
<del><option value="Namibia">Namibia</option>
<del><option value="Nauru">Nauru</option>
<del><option value="Nepal">Nepal</option>
<del><option value="Netherlands">Netherlands</option>
<del><option value="Netherlands Antilles">Netherlands Antilles</option>
<del><option value="New Caledonia">New Caledonia</option>
<del><option value="New Zealand">New Zealand</option>
<del><option value="Nicaragua">Nicaragua</option>
<del><option value="Niger">Niger</option>
<del><option value="Nigeria">Nigeria</option>
<del><option value="Niue">Niue</option>
<del><option value="Norfolk Island">Norfolk Island</option>
<del><option value="Northern Mariana Islands">Northern Mariana Islands</option>
<del><option value="Norway">Norway</option>
<del><option value="Oman">Oman</option>
<del><option value="Pakistan">Pakistan</option>
<del><option value="Palau">Palau</option>
<del><option value="Palestinian Territory, Occupied">Palestinian Territory, Occupied</option>
<del><option value="Panama">Panama</option>
<del><option value="Papua New Guinea">Papua New Guinea</option>
<del><option value="Paraguay">Paraguay</option>
<del><option value="Peru">Peru</option>
<del><option value="Philippines">Philippines</option>
<del><option value="Pitcairn">Pitcairn</option>
<del><option value="Poland">Poland</option>
<del><option value="Portugal">Portugal</option>
<del><option value="Puerto Rico">Puerto Rico</option>
<del><option value="Qatar">Qatar</option>
<del><option value="Reunion">Reunion</option>
<del><option value="Romania">Romania</option>
<del><option value="Russian Federation">Russian Federation</option>
<del><option value="Rwanda">Rwanda</option>
<del><option value="Saint Barthelemy">Saint Barthelemy</option>
<del><option value="Saint Helena">Saint Helena</option>
<del><option value="Saint Kitts and Nevis">Saint Kitts and Nevis</option>
<del><option value="Saint Lucia">Saint Lucia</option>
<del><option value="Saint Pierre and Miquelon">Saint Pierre and Miquelon</option>
<del><option value="Saint Vincent and the Grenadines">Saint Vincent and the Grenadines</option>
<del><option value="Samoa">Samoa</option>
<del><option value="San Marino">San Marino</option>
<del><option value="Sao Tome and Principe">Sao Tome and Principe</option>
<del><option value="Saudi Arabia">Saudi Arabia</option>
<del><option value="Senegal">Senegal</option>
<del><option value="Serbia">Serbia</option>
<del><option value="Seychelles">Seychelles</option>
<del><option value="Sierra Leone">Sierra Leone</option>
<del><option value="Singapore">Singapore</option>
<del><option value="Slovakia">Slovakia</option>
<del><option value="Slovenia">Slovenia</option>
<del><option value="Solomon Islands">Solomon Islands</option>
<del><option value="Somalia">Somalia</option>
<del><option value="South Africa">South Africa</option>
<del><option value="South Georgia and the South Sandwich Islands">South Georgia and the South Sandwich Islands</option>
<del><option value="Spain">Spain</option>
<del><option value="Sri Lanka">Sri Lanka</option>
<del><option value="Sudan">Sudan</option>
<del><option value="Suriname">Suriname</option>
<del><option value="Svalbard and Jan Mayen">Svalbard and Jan Mayen</option>
<del><option value="Swaziland">Swaziland</option>
<del><option value="Sweden">Sweden</option>
<del><option value="Switzerland">Switzerland</option>
<del><option value="Syrian Arab Republic">Syrian Arab Republic</option>
<del><option value="Taiwan, Province of China">Taiwan, Province of China</option>
<del><option value="Tajikistan">Tajikistan</option>
<del><option value="Tanzania, United Republic of">Tanzania, United Republic of</option>
<del><option value="Thailand">Thailand</option>
<del><option value="Timor-Leste">Timor-Leste</option>
<del><option value="Togo">Togo</option>
<del><option value="Tokelau">Tokelau</option>
<del><option value="Tonga">Tonga</option>
<del><option value="Trinidad and Tobago">Trinidad and Tobago</option>
<del><option value="Tunisia">Tunisia</option>
<del><option value="Turkey">Turkey</option>
<del><option value="Turkmenistan">Turkmenistan</option>
<del><option value="Turks and Caicos Islands">Turks and Caicos Islands</option>
<del><option value="Tuvalu">Tuvalu</option>
<del><option value="Uganda">Uganda</option>
<del><option value="Ukraine">Ukraine</option>
<del><option value="United Arab Emirates">United Arab Emirates</option>
<del><option value="United Kingdom">United Kingdom</option>
<del><option selected="selected" value="United States">United States</option>
<del><option value="United States Minor Outlying Islands">United States Minor Outlying Islands</option>
<del><option value="Uruguay">Uruguay</option>
<del><option value="Uzbekistan">Uzbekistan</option>
<del><option value="Vanuatu">Vanuatu</option>
<del><option value="Venezuela">Venezuela</option>
<del><option value="Viet Nam">Viet Nam</option>
<del><option value="Virgin Islands, British">Virgin Islands, British</option>
<del><option value="Virgin Islands, U.S.">Virgin Islands, U.S.</option>
<del><option value="Wallis and Futuna">Wallis and Futuna</option>
<del><option value="Western Sahara">Western Sahara</option>
<del><option value="Yemen">Yemen</option>
<del><option value="Zambia">Zambia</option>
<del><option value="Zimbabwe">Zimbabwe</option></select>
<del>COUNTRIES
<del>
<del> fields_for :post, @post, :index => 325 do |f|
<del> concat f.country_select("origin")
<del> end
<del>
<del> assert_dom_equal(expected_select[0..-2], output_buffer)
<del> end
<del>
<del> def test_country_select_under_fields_for_with_auto_index
<del> @post = Post.new
<del> @post.origin = "Iraq"
<del> def @post.to_param; 325; end
<del>
<del> expected_select = <<-COUNTRIES
<del><select id="post_325_origin" name="post[325][origin]"><option value="Afghanistan">Afghanistan</option>
<del><option value="Aland Islands">Aland Islands</option>
<del><option value="Albania">Albania</option>
<del><option value="Algeria">Algeria</option>
<del><option value="American Samoa">American Samoa</option>
<del><option value="Andorra">Andorra</option>
<del><option value="Angola">Angola</option>
<del><option value="Anguilla">Anguilla</option>
<del><option value="Antarctica">Antarctica</option>
<del><option value="Antigua And Barbuda">Antigua And Barbuda</option>
<del><option value="Argentina">Argentina</option>
<del><option value="Armenia">Armenia</option>
<del><option value="Aruba">Aruba</option>
<del><option value="Australia">Australia</option>
<del><option value="Austria">Austria</option>
<del><option value="Azerbaijan">Azerbaijan</option>
<del><option value="Bahamas">Bahamas</option>
<del><option value="Bahrain">Bahrain</option>
<del><option value="Bangladesh">Bangladesh</option>
<del><option value="Barbados">Barbados</option>
<del><option value="Belarus">Belarus</option>
<del><option value="Belgium">Belgium</option>
<del><option value="Belize">Belize</option>
<del><option value="Benin">Benin</option>
<del><option value="Bermuda">Bermuda</option>
<del><option value="Bhutan">Bhutan</option>
<del><option value="Bolivia">Bolivia</option>
<del><option value="Bosnia and Herzegowina">Bosnia and Herzegowina</option>
<del><option value="Botswana">Botswana</option>
<del><option value="Bouvet Island">Bouvet Island</option>
<del><option value="Brazil">Brazil</option>
<del><option value="British Indian Ocean Territory">British Indian Ocean Territory</option>
<del><option value="Brunei Darussalam">Brunei Darussalam</option>
<del><option value="Bulgaria">Bulgaria</option>
<del><option value="Burkina Faso">Burkina Faso</option>
<del><option value="Burundi">Burundi</option>
<del><option value="Cambodia">Cambodia</option>
<del><option value="Cameroon">Cameroon</option>
<del><option value="Canada">Canada</option>
<del><option value="Cape Verde">Cape Verde</option>
<del><option value="Cayman Islands">Cayman Islands</option>
<del><option value="Central African Republic">Central African Republic</option>
<del><option value="Chad">Chad</option>
<del><option value="Chile">Chile</option>
<del><option value="China">China</option>
<del><option value="Christmas Island">Christmas Island</option>
<del><option value="Cocos (Keeling) Islands">Cocos (Keeling) Islands</option>
<del><option value="Colombia">Colombia</option>
<del><option value="Comoros">Comoros</option>
<del><option value="Congo">Congo</option>
<del><option value="Congo, the Democratic Republic of the">Congo, the Democratic Republic of the</option>
<del><option value="Cook Islands">Cook Islands</option>
<del><option value="Costa Rica">Costa Rica</option>
<del><option value="Cote d'Ivoire">Cote d'Ivoire</option>
<del><option value="Croatia">Croatia</option>
<del><option value="Cuba">Cuba</option>
<del><option value="Cyprus">Cyprus</option>
<del><option value="Czech Republic">Czech Republic</option>
<del><option value="Denmark">Denmark</option>
<del><option value="Djibouti">Djibouti</option>
<del><option value="Dominica">Dominica</option>
<del><option value="Dominican Republic">Dominican Republic</option>
<del><option value="Ecuador">Ecuador</option>
<del><option value="Egypt">Egypt</option>
<del><option value="El Salvador">El Salvador</option>
<del><option value="Equatorial Guinea">Equatorial Guinea</option>
<del><option value="Eritrea">Eritrea</option>
<del><option value="Estonia">Estonia</option>
<del><option value="Ethiopia">Ethiopia</option>
<del><option value="Falkland Islands (Malvinas)">Falkland Islands (Malvinas)</option>
<del><option value="Faroe Islands">Faroe Islands</option>
<del><option value="Fiji">Fiji</option>
<del><option value="Finland">Finland</option>
<del><option value="France">France</option>
<del><option value="French Guiana">French Guiana</option>
<del><option value="French Polynesia">French Polynesia</option>
<del><option value="French Southern Territories">French Southern Territories</option>
<del><option value="Gabon">Gabon</option>
<del><option value="Gambia">Gambia</option>
<del><option value="Georgia">Georgia</option>
<del><option value="Germany">Germany</option>
<del><option value="Ghana">Ghana</option>
<del><option value="Gibraltar">Gibraltar</option>
<del><option value="Greece">Greece</option>
<del><option value="Greenland">Greenland</option>
<del><option value="Grenada">Grenada</option>
<del><option value="Guadeloupe">Guadeloupe</option>
<del><option value="Guam">Guam</option>
<del><option value="Guatemala">Guatemala</option>
<del><option value="Guernsey">Guernsey</option>
<del><option value="Guinea">Guinea</option>
<del><option value="Guinea-Bissau">Guinea-Bissau</option>
<del><option value="Guyana">Guyana</option>
<del><option value="Haiti">Haiti</option>
<del><option value="Heard and McDonald Islands">Heard and McDonald Islands</option>
<del><option value="Holy See (Vatican City State)">Holy See (Vatican City State)</option>
<del><option value="Honduras">Honduras</option>
<del><option value="Hong Kong">Hong Kong</option>
<del><option value="Hungary">Hungary</option>
<del><option value="Iceland">Iceland</option>
<del><option value="India">India</option>
<del><option value="Indonesia">Indonesia</option>
<del><option value="Iran, Islamic Republic of">Iran, Islamic Republic of</option>
<del><option selected="selected" value="Iraq">Iraq</option>
<del><option value="Ireland">Ireland</option>
<del><option value="Isle of Man">Isle of Man</option>
<del><option value="Israel">Israel</option>
<del><option value="Italy">Italy</option>
<del><option value="Jamaica">Jamaica</option>
<del><option value="Japan">Japan</option>
<del><option value="Jersey">Jersey</option>
<del><option value="Jordan">Jordan</option>
<del><option value="Kazakhstan">Kazakhstan</option>
<del><option value="Kenya">Kenya</option>
<del><option value="Kiribati">Kiribati</option>
<del><option value="Korea, Democratic People's Republic of">Korea, Democratic People's Republic of</option>
<del><option value="Korea, Republic of">Korea, Republic of</option>
<del><option value="Kuwait">Kuwait</option>
<del><option value="Kyrgyzstan">Kyrgyzstan</option>
<del><option value="Lao People's Democratic Republic">Lao People's Democratic Republic</option>
<del><option value="Latvia">Latvia</option>
<del><option value="Lebanon">Lebanon</option>
<del><option value="Lesotho">Lesotho</option>
<del><option value="Liberia">Liberia</option>
<del><option value="Libyan Arab Jamahiriya">Libyan Arab Jamahiriya</option>
<del><option value="Liechtenstein">Liechtenstein</option>
<del><option value="Lithuania">Lithuania</option>
<del><option value="Luxembourg">Luxembourg</option>
<del><option value="Macao">Macao</option>
<del><option value="Macedonia, The Former Yugoslav Republic Of">Macedonia, The Former Yugoslav Republic Of</option>
<del><option value="Madagascar">Madagascar</option>
<del><option value="Malawi">Malawi</option>
<del><option value="Malaysia">Malaysia</option>
<del><option value="Maldives">Maldives</option>
<del><option value="Mali">Mali</option>
<del><option value="Malta">Malta</option>
<del><option value="Marshall Islands">Marshall Islands</option>
<del><option value="Martinique">Martinique</option>
<del><option value="Mauritania">Mauritania</option>
<del><option value="Mauritius">Mauritius</option>
<del><option value="Mayotte">Mayotte</option>
<del><option value="Mexico">Mexico</option>
<del><option value="Micronesia, Federated States of">Micronesia, Federated States of</option>
<del><option value="Moldova, Republic of">Moldova, Republic of</option>
<del><option value="Monaco">Monaco</option>
<del><option value="Mongolia">Mongolia</option>
<del><option value="Montenegro">Montenegro</option>
<del><option value="Montserrat">Montserrat</option>
<del><option value="Morocco">Morocco</option>
<del><option value="Mozambique">Mozambique</option>
<del><option value="Myanmar">Myanmar</option>
<del><option value="Namibia">Namibia</option>
<del><option value="Nauru">Nauru</option>
<del><option value="Nepal">Nepal</option>
<del><option value="Netherlands">Netherlands</option>
<del><option value="Netherlands Antilles">Netherlands Antilles</option>
<del><option value="New Caledonia">New Caledonia</option>
<del><option value="New Zealand">New Zealand</option>
<del><option value="Nicaragua">Nicaragua</option>
<del><option value="Niger">Niger</option>
<del><option value="Nigeria">Nigeria</option>
<del><option value="Niue">Niue</option>
<del><option value="Norfolk Island">Norfolk Island</option>
<del><option value="Northern Mariana Islands">Northern Mariana Islands</option>
<del><option value="Norway">Norway</option>
<del><option value="Oman">Oman</option>
<del><option value="Pakistan">Pakistan</option>
<del><option value="Palau">Palau</option>
<del><option value="Palestinian Territory, Occupied">Palestinian Territory, Occupied</option>
<del><option value="Panama">Panama</option>
<del><option value="Papua New Guinea">Papua New Guinea</option>
<del><option value="Paraguay">Paraguay</option>
<del><option value="Peru">Peru</option>
<del><option value="Philippines">Philippines</option>
<del><option value="Pitcairn">Pitcairn</option>
<del><option value="Poland">Poland</option>
<del><option value="Portugal">Portugal</option>
<del><option value="Puerto Rico">Puerto Rico</option>
<del><option value="Qatar">Qatar</option>
<del><option value="Reunion">Reunion</option>
<del><option value="Romania">Romania</option>
<del><option value="Russian Federation">Russian Federation</option>
<del><option value="Rwanda">Rwanda</option>
<del><option value="Saint Barthelemy">Saint Barthelemy</option>
<del><option value="Saint Helena">Saint Helena</option>
<del><option value="Saint Kitts and Nevis">Saint Kitts and Nevis</option>
<del><option value="Saint Lucia">Saint Lucia</option>
<del><option value="Saint Pierre and Miquelon">Saint Pierre and Miquelon</option>
<del><option value="Saint Vincent and the Grenadines">Saint Vincent and the Grenadines</option>
<del><option value="Samoa">Samoa</option>
<del><option value="San Marino">San Marino</option>
<del><option value="Sao Tome and Principe">Sao Tome and Principe</option>
<del><option value="Saudi Arabia">Saudi Arabia</option>
<del><option value="Senegal">Senegal</option>
<del><option value="Serbia">Serbia</option>
<del><option value="Seychelles">Seychelles</option>
<del><option value="Sierra Leone">Sierra Leone</option>
<del><option value="Singapore">Singapore</option>
<del><option value="Slovakia">Slovakia</option>
<del><option value="Slovenia">Slovenia</option>
<del><option value="Solomon Islands">Solomon Islands</option>
<del><option value="Somalia">Somalia</option>
<del><option value="South Africa">South Africa</option>
<del><option value="South Georgia and the South Sandwich Islands">South Georgia and the South Sandwich Islands</option>
<del><option value="Spain">Spain</option>
<del><option value="Sri Lanka">Sri Lanka</option>
<del><option value="Sudan">Sudan</option>
<del><option value="Suriname">Suriname</option>
<del><option value="Svalbard and Jan Mayen">Svalbard and Jan Mayen</option>
<del><option value="Swaziland">Swaziland</option>
<del><option value="Sweden">Sweden</option>
<del><option value="Switzerland">Switzerland</option>
<del><option value="Syrian Arab Republic">Syrian Arab Republic</option>
<del><option value="Taiwan, Province of China">Taiwan, Province of China</option>
<del><option value="Tajikistan">Tajikistan</option>
<del><option value="Tanzania, United Republic of">Tanzania, United Republic of</option>
<del><option value="Thailand">Thailand</option>
<del><option value="Timor-Leste">Timor-Leste</option>
<del><option value="Togo">Togo</option>
<del><option value="Tokelau">Tokelau</option>
<del><option value="Tonga">Tonga</option>
<del><option value="Trinidad and Tobago">Trinidad and Tobago</option>
<del><option value="Tunisia">Tunisia</option>
<del><option value="Turkey">Turkey</option>
<del><option value="Turkmenistan">Turkmenistan</option>
<del><option value="Turks and Caicos Islands">Turks and Caicos Islands</option>
<del><option value="Tuvalu">Tuvalu</option>
<del><option value="Uganda">Uganda</option>
<del><option value="Ukraine">Ukraine</option>
<del><option value="United Arab Emirates">United Arab Emirates</option>
<del><option value="United Kingdom">United Kingdom</option>
<del><option value="United States">United States</option>
<del><option value="United States Minor Outlying Islands">United States Minor Outlying Islands</option>
<del><option value="Uruguay">Uruguay</option>
<del><option value="Uzbekistan">Uzbekistan</option>
<del><option value="Vanuatu">Vanuatu</option>
<del><option value="Venezuela">Venezuela</option>
<del><option value="Viet Nam">Viet Nam</option>
<del><option value="Virgin Islands, British">Virgin Islands, British</option>
<del><option value="Virgin Islands, U.S.">Virgin Islands, U.S.</option>
<del><option value="Wallis and Futuna">Wallis and Futuna</option>
<del><option value="Western Sahara">Western Sahara</option>
<del><option value="Yemen">Yemen</option>
<del><option value="Zambia">Zambia</option>
<del><option value="Zimbabwe">Zimbabwe</option></select>
<del>COUNTRIES
<del>
<del> fields_for "post[]", @post do |f|
<del> concat f.country_select("origin")
<del> end
<del>
<del> assert_dom_equal(expected_select[0..-2], output_buffer)
<del> end
<del>
<del>end
<ide>\ No newline at end of file | 4 |
Go | Go | reuse subsystems mountpoints between checks | 781a33b6e77a122f2a171a941da3a1798fc73c27 | <ide><path>pkg/sysinfo/sysinfo_linux.go
<ide> package sysinfo
<ide>
<ide> import (
<add> "fmt"
<ide> "io/ioutil"
<ide> "os"
<ide> "path"
<ide> const (
<ide> SeccompModeFilter = uintptr(2)
<ide> )
<ide>
<add>func findCgroupMountpoints() (map[string]string, error) {
<add> cgMounts, err := cgroups.GetCgroupMounts()
<add> if err != nil {
<add> return nil, fmt.Errorf("Failed to parse cgroup information: %v", err)
<add> }
<add> mps := make(map[string]string)
<add> for _, m := range cgMounts {
<add> for _, ss := range m.Subsystems {
<add> mps[ss] = m.Mountpoint
<add> }
<add> }
<add> return mps, nil
<add>}
<add>
<ide> // New returns a new SysInfo, using the filesystem to detect which features
<ide> // the kernel supports. If `quiet` is `false` warnings are printed in logs
<ide> // whenever an error occurs or misconfigurations are present.
<ide> func New(quiet bool) *SysInfo {
<ide> sysInfo := &SysInfo{}
<del> sysInfo.cgroupMemInfo = checkCgroupMem(quiet)
<del> sysInfo.cgroupCPUInfo = checkCgroupCPU(quiet)
<del> sysInfo.cgroupBlkioInfo = checkCgroupBlkioInfo(quiet)
<del> sysInfo.cgroupCpusetInfo = checkCgroupCpusetInfo(quiet)
<add> cgMounts, err := findCgroupMountpoints()
<add> if err != nil {
<add> logrus.Warnf("Failed to parse cgroup information: %v", err)
<add> } else {
<add> sysInfo.cgroupMemInfo = checkCgroupMem(cgMounts, quiet)
<add> sysInfo.cgroupCPUInfo = checkCgroupCPU(cgMounts, quiet)
<add> sysInfo.cgroupBlkioInfo = checkCgroupBlkioInfo(cgMounts, quiet)
<add> sysInfo.cgroupCpusetInfo = checkCgroupCpusetInfo(cgMounts, quiet)
<add> }
<ide>
<del> _, err := cgroups.FindCgroupMountpoint("devices")
<del> sysInfo.CgroupDevicesEnabled = err == nil
<add> _, ok := cgMounts["devices"]
<add> sysInfo.CgroupDevicesEnabled = ok
<ide>
<ide> sysInfo.IPv4ForwardingDisabled = !readProcBool("/proc/sys/net/ipv4/ip_forward")
<ide> sysInfo.BridgeNfCallIptablesDisabled = !readProcBool("/proc/sys/net/bridge/bridge-nf-call-iptables")
<ide> func New(quiet bool) *SysInfo {
<ide> }
<ide>
<ide> // checkCgroupMem reads the memory information from the memory cgroup mount point.
<del>func checkCgroupMem(quiet bool) cgroupMemInfo {
<del> mountPoint, err := cgroups.FindCgroupMountpoint("memory")
<del> if err != nil {
<add>func checkCgroupMem(cgMounts map[string]string, quiet bool) cgroupMemInfo {
<add> mountPoint, ok := cgMounts["memory"]
<add> if !ok {
<ide> if !quiet {
<del> logrus.Warnf("Your kernel does not support cgroup memory limit: %v", err)
<add> logrus.Warnf("Your kernel does not support cgroup memory limit")
<ide> }
<ide> return cgroupMemInfo{}
<ide> }
<ide> func checkCgroupMem(quiet bool) cgroupMemInfo {
<ide> }
<ide>
<ide> // checkCgroupCPU reads the cpu information from the cpu cgroup mount point.
<del>func checkCgroupCPU(quiet bool) cgroupCPUInfo {
<del> mountPoint, err := cgroups.FindCgroupMountpoint("cpu")
<del> if err != nil {
<add>func checkCgroupCPU(cgMounts map[string]string, quiet bool) cgroupCPUInfo {
<add> mountPoint, ok := cgMounts["cpu"]
<add> if !ok {
<ide> if !quiet {
<del> logrus.Warn(err)
<add> logrus.Warnf("Unable to find cpu cgroup in mounts")
<ide> }
<ide> return cgroupCPUInfo{}
<ide> }
<ide> func checkCgroupCPU(quiet bool) cgroupCPUInfo {
<ide> }
<ide>
<ide> // checkCgroupBlkioInfo reads the blkio information from the blkio cgroup mount point.
<del>func checkCgroupBlkioInfo(quiet bool) cgroupBlkioInfo {
<del> mountPoint, err := cgroups.FindCgroupMountpoint("blkio")
<del> if err != nil {
<add>func checkCgroupBlkioInfo(cgMounts map[string]string, quiet bool) cgroupBlkioInfo {
<add> mountPoint, ok := cgMounts["blkio"]
<add> if !ok {
<ide> if !quiet {
<del> logrus.Warn(err)
<add> logrus.Warnf("Unable to find blkio cgroup in mounts")
<ide> }
<ide> return cgroupBlkioInfo{}
<ide> }
<ide> func checkCgroupBlkioInfo(quiet bool) cgroupBlkioInfo {
<ide> }
<ide>
<ide> // checkCgroupCpusetInfo reads the cpuset information from the cpuset cgroup mount point.
<del>func checkCgroupCpusetInfo(quiet bool) cgroupCpusetInfo {
<del> mountPoint, err := cgroups.FindCgroupMountpoint("cpuset")
<del> if err != nil {
<add>func checkCgroupCpusetInfo(cgMounts map[string]string, quiet bool) cgroupCpusetInfo {
<add> mountPoint, ok := cgMounts["cpuset"]
<add> if !ok {
<ide> if !quiet {
<del> logrus.Warn(err)
<add> logrus.Warnf("Unable to find cpuset cgroup in mounts")
<ide> }
<ide> return cgroupCpusetInfo{}
<ide> } | 1 |
Javascript | Javascript | update vrmlloader to support normals. | 39f09176735e00ceba688722c6fc2843a919d5c4 | <ide><path>examples/js/loaders/VRMLLoader.js
<ide> THREE.VRMLLoader.prototype = {
<ide> break;
<ide>
<ide> case 'point':
<add> case 'vector':
<ide> scope.recordingFieldname = fieldName;
<ide> scope.isRecordingPoints = true;
<ide> scope.points = [];
<ide> THREE.VRMLLoader.prototype = {
<ide>
<ide> }
<ide>
<add> if ( node.nodeType == 'Normal' ) {
<add>
<add> while ( null !== ( parts = float3_pattern.exec( line ) ) ) {
<add>
<add> point = {
<add> x: parseFloat( parts[ 1 ] ),
<add> y: parseFloat( parts[ 2 ] ),
<add> z: parseFloat( parts[ 3 ] )
<add> };
<add>
<add> scope.points.push( point );
<add>
<add> }
<add>
<add> }
<add>
<ide> if ( node.nodeType == 'TextureCoordinate' ) {
<ide>
<ide> while ( null !== ( parts = float2_pattern.exec( line ) ) ) {
<ide> THREE.VRMLLoader.prototype = {
<ide> var geometry = new THREE.BufferGeometry();
<ide>
<ide> var positions = [];
<add> var normals = [];
<ide> var uvs = [];
<ide>
<del> var position, uv;
<add> var position, normal, uv;
<ide>
<ide> var i, il, j, jl;
<ide>
<ide> THREE.VRMLLoader.prototype = {
<ide>
<ide> }
<ide>
<add> // normals
<add>
<add> if ( child.nodeType === 'Normal' ) {
<add>
<add> if ( child.points ) {
<add>
<add> for ( j = 0, jl = child.points.length; j < jl; j ++ ) {
<add>
<add> normal = child.points[ j ];
<add> normals.push( normal.x, normal.y, normal.z );
<add>
<add> }
<add>
<add> }
<add>
<add> }
<add>
<ide> // positions
<ide>
<ide> if ( child.nodeType === 'Coordinate' ) {
<ide> THREE.VRMLLoader.prototype = {
<ide> if ( data.coordIndex ) {
<ide>
<ide> var newPositions = [];
<add> var newNormals = [];
<ide> var newUvs = [];
<ide>
<ide> position = new THREE.Vector3();
<add> normal = new THREE.Vector3();
<ide> uv = new THREE.Vector2();
<ide>
<ide> for ( i = 0, il = data.coordIndex.length; i < il; i ++ ) {
<ide> THREE.VRMLLoader.prototype = {
<ide> // create non indexed geometry, necessary for face normal generation
<ide>
<ide> position.fromArray( positions, i1 * 3 );
<del> uv.fromArray( uvs, i1 * 2 );
<ide> newPositions.push( position.x, position.y, position.z );
<del> newUvs.push( uv.x, uv.y );
<del>
<ide> position.fromArray( positions, i2 * 3 );
<del> uv.fromArray( uvs, i2 * 2 );
<ide> newPositions.push( position.x, position.y, position.z );
<del> newUvs.push( uv.x, uv.y );
<del>
<ide> position.fromArray( positions, i3 * 3 );
<del> uv.fromArray( uvs, i3 * 2 );
<ide> newPositions.push( position.x, position.y, position.z );
<del> newUvs.push( uv.x, uv.y );
<add>
<add> if ( uvs.length > 0 ) {
<add>
<add> uv.fromArray( uvs, i1 * 2 );
<add> newUvs.push( uv.x, uv.y );
<add> uv.fromArray( uvs, i2 * 2 );
<add> newUvs.push( uv.x, uv.y );
<add> uv.fromArray( uvs, i3 * 2 );
<add> newUvs.push( uv.x, uv.y );
<add>
<add> }
<add>
<add> if ( normals.length > 0 ) {
<add>
<add> normal.fromArray( normals, i1 * 3 );
<add> newNormals.push( normal.x, normal.y, normal.z );
<add> normal.fromArray( normals, i2 * 3 );
<add> newNormals.push( normal.x, normal.y, normal.z );
<add> normal.fromArray( normals, i3 * 3 );
<add> newNormals.push( normal.x, normal.y, normal.z );
<add>
<add> }
<ide>
<ide> skip ++;
<ide>
<ide> THREE.VRMLLoader.prototype = {
<ide> }
<ide>
<ide> positions = newPositions;
<add> normals = newNormals;
<ide> uvs = newUvs;
<ide>
<ide> } else {
<ide> THREE.VRMLLoader.prototype = {
<ide>
<ide> }
<ide>
<del> geometry.computeVertexNormals();
<add> if (normals.length > 0) {
<add>
<add> geometry.addAttribute( 'normal', new THREE.Float32BufferAttribute( normals, 3 ) );
<add>
<add> } else {
<add>
<add> geometry.computeVertexNormals();
<add>
<add> }
<add>
<ide> geometry.computeBoundingSphere();
<ide>
<ide> // see if it's a define | 1 |
Python | Python | add iteration setter to lossscaleoptimizer | e5922a2cd37d14c1e427fb7ab5ab087439d5f3fa | <ide><path>keras/mixed_precision/loss_scale_optimizer.py
<ide> def from_config(cls, config, custom_objects=None):
<ide> def iterations(self):
<ide> return self._optimizer.iterations
<ide>
<add> @iterations.setter
<add> def iterations(self, variable):
<add> self._optimizer.iterations = variable
<add>
<ide> @property
<ide> def learning_rate(self):
<ide> return self._optimizer.learning_rate | 1 |
Javascript | Javascript | improve process.env benchmarks | 82ebcb37d6e01417bc729b8a9a949c7926d0c351 | <ide><path>benchmark/process/bench-env.js
<ide> const common = require('../common');
<ide>
<ide> const bench = common.createBenchmark(main, {
<del> n: [1e5],
<add> n: [1e6],
<add> operation: ['get', 'set', 'enumerate', 'query', 'delete']
<ide> });
<ide>
<ide>
<del>function main({ n }) {
<del> bench.start();
<del> for (var i = 0; i < n; i++) {
<del> // Access every item in object to process values.
<del> Object.keys(process.env);
<add>function main({ n, operation }) {
<add> switch (operation) {
<add> case 'get':
<add> bench.start();
<add> for (let i = 0; i < n; i++) {
<add> process.env.PATH;
<add> }
<add> bench.end(n);
<add> break;
<add> case 'set':
<add> bench.start();
<add> for (let i = 0; i < n; i++) {
<add> process.env.DUMMY = 'hello, world';
<add> }
<add> bench.end(n);
<add> break;
<add> case 'enumerate':
<add> // First, normalize process.env so that benchmark results are comparable.
<add> for (const key of Object.keys(process.env))
<add> delete process.env[key];
<add> for (let i = 0; i < 64; i++)
<add> process.env[Math.random()] = Math.random();
<add>
<add> n /= 10; // Enumeration is comparatively heavy.
<add> bench.start();
<add> for (let i = 0; i < n; i++) {
<add> // Access every item in object to process values.
<add> Object.keys(process.env);
<add> }
<add> bench.end(n);
<add> break;
<add> case 'query':
<add> bench.start();
<add> for (let i = 0; i < n; i++) {
<add> 'PATH' in process.env;
<add> }
<add> bench.end(n);
<add> break;
<add> case 'delete':
<add> bench.start();
<add> for (let i = 0; i < n; i++) {
<add> delete process.env.DUMMY;
<add> }
<add> bench.end(n);
<add> break;
<ide> }
<del> bench.end(n);
<ide> }
<ide><path>test/benchmark/test-benchmark-process.js
<ide> const runBenchmark = require('../common/benchmark');
<ide> runBenchmark('process',
<ide> [
<ide> 'n=1',
<del> 'type=raw'
<add> 'type=raw',
<add> 'operation=enumerate',
<ide> ], { NODEJS_BENCHMARK_ZERO_ALLOWED: 1 }); | 2 |
Javascript | Javascript | fix orf/olf being undefined | 88fc6ecc5c5b7ed3c36e9baca74e9fbfa48a17c5 | <ide><path>src/core/core.tooltip.js
<ide> if (this._model.yAlign === 'center') {
<ide> lf = function(x) { return x <= midX; };
<ide> rf = function(x) { return x > midX; };
<del> olf = function(x) { return x + size.width > _this._chart.width; };
<del> orf = function(x) { return x - size.width < 0; };
<del> yf = function(y) { return y <= midY ? 'top' : 'bottom'; };
<ide> } else {
<ide> lf = function(x) { return x <= (size.width / 2); };
<ide> rf = function(x) { return x >= (_this._chart.width - (size.width / 2)); };
<ide> }
<add>
<add> olf = function(x) { return x + size.width > _this._chart.width; };
<add> orf = function(x) { return x - size.width < 0; };
<add> yf = function(y) { return y <= midY ? 'top' : 'bottom'; };
<ide>
<ide> if (lf(this._model.x)) {
<ide> this._model.xAlign = 'left'; | 1 |
Ruby | Ruby | ignore `formulaunreadableerror` in `formula.each` | 8fb769e60c1ec4aa04582f640e426fd9a4d09c66 | <ide><path>Library/Homebrew/formula.rb
<ide> def self.full_names
<ide> # @private
<ide> def self.each
<ide> files.each do |file|
<del> yield begin
<del> Formulary.factory(file)
<del> rescue FormulaUnavailableError => e
<del> # Don't let one broken formula break commands. But do complain.
<del> onoe "Failed to import: #{file}"
<del> puts e
<del> next
<del> end
<add> yield Formulary.factory(file)
<add> rescue FormulaUnavailableError, FormulaUnreadableError => e
<add> # Don't let one broken formula break commands. But do complain.
<add> onoe "Failed to import: #{file}"
<add> $stderr.puts e
<add> next
<ide> end
<ide> end
<ide>
<ide><path>Library/Homebrew/formulary.rb
<ide> def self.load_formula(name, path, contents, namespace, flags:)
<ide> # access them from within the formula's class scope.
<ide> mod.const_set(:BUILD_FLAGS, flags)
<ide> mod.module_eval(contents, path)
<del> rescue NameError, ArgumentError, ScriptError => e
<add> rescue NameError, ArgumentError, ScriptError, MethodDeprecatedError => e
<ide> $stderr.puts e.backtrace if Homebrew::EnvConfig.developer?
<ide> raise FormulaUnreadableError.new(name, e)
<ide> end | 2 |
Javascript | Javascript | add logic for dynamically resolving script paths | ed501824e229260ef648f67f9e9a28860b2731f2 | <ide><path>lib/runtime/PublicPathRuntimeModule.js
<ide> class PublicPathRuntimeModule extends RuntimeModule {
<ide> * @returns {string} runtime code
<ide> */
<ide> generate() {
<del> return `${RuntimeGlobals.publicPath} = ${JSON.stringify(
<del> this.compilation.getPath(
<del> this.compilation.outputOptions.publicPath || "",
<del> {
<del> hash: this.compilation.hash || "XXXX"
<add> const publicPath = this.compilation.outputOptions.publicPath || "auto";
<add> if (publicPath === "auto") {
<add> return `${RuntimeGlobals.publicPath} = (() => {
<add> if ("currentScript" in document) {
<add> return document.currentScript.src.replace(/[^\\/]+$/, "");
<add> } else if ("_getCurrentScript" in document) {
<add> return document._getCurrentScript().src.replace(/[^\\/]+$/, "");
<add> } else {
<add> return ${JSON.stringify(
<add> this.compilation.getPath(
<add> this.compilation.outputOptions.publicPath || "",
<add> {
<add> hash: this.compilation.hash || "XXXX"
<add> }
<add> )
<add> )};
<ide> }
<del> )
<del> )};`;
<add> })();`;
<add> } else {
<add> return `${RuntimeGlobals.publicPath} = ${JSON.stringify(
<add> this.compilation.getPath(publicPath || "", {
<add> hash: this.compilation.hash || "XXXX"
<add> })
<add> )};`;
<add> }
<ide> }
<ide> }
<ide> | 1 |
PHP | PHP | use constructor chaining to reduce code | cc8b94715fcc153fcc6a295e38d2383ae445afbc | <ide><path>App/Config/app.php
<ide> * support is being used.
<ide> */
<ide> if (!class_exists('App\Controller\AppController')) {
<del> $loader = new \Cake\Core\ClassLoader($namespace, dirname(APP));
<del> $loader->register();
<del> unset($loader);
<add> (new \Cake\Core\ClassLoader($namespace, dirname(APP)))->register();
<ide> }
<ide>
<ide> /** | 1 |
Python | Python | add support for xlm-roberta (__init__) | d3549b66af6f225cace48f8462ba715508f51b0d | <ide><path>transformers/__init__.py
<ide> from .tokenization_albert import AlbertTokenizer
<ide> from .tokenization_camembert import CamembertTokenizer
<ide> from .tokenization_t5 import T5Tokenizer
<add>from .tokenization_xlm_roberta import XLMRobertaTokenizer
<ide>
<ide> # Configurations
<ide> from .configuration_utils import PretrainedConfig
<ide> from .configuration_albert import AlbertConfig, ALBERT_PRETRAINED_CONFIG_ARCHIVE_MAP
<ide> from .configuration_camembert import CamembertConfig, CAMEMBERT_PRETRAINED_CONFIG_ARCHIVE_MAP
<ide> from .configuration_t5 import T5Config, T5_PRETRAINED_CONFIG_ARCHIVE_MAP
<add>from .configuration_xlm_roberta import XLMRobertaConfig, XLM_ROBERTA_PRETRAINED_CONFIG_ARCHIVE_MAP
<ide>
<ide> # Modeling
<ide> if is_torch_available():
<ide> AlbertForQuestionAnswering,
<ide> load_tf_weights_in_albert, ALBERT_PRETRAINED_MODEL_ARCHIVE_MAP)
<ide>
<add> from .modeling_xlm_roberta import (XLMRobertaForMaskedLM, XLMRobertaModel, XLMRobertaForMultipleChoice,
<add> XLMRobertaForSequenceClassification, XLMRobertaForTokenClassification)
<add>
<ide> # Optimization
<ide> from .optimization import (AdamW, get_constant_schedule, get_constant_schedule_with_warmup, get_cosine_schedule_with_warmup,
<ide> get_cosine_with_hard_restarts_schedule_with_warmup, get_linear_schedule_with_warmup) | 1 |
Ruby | Ruby | show permission changes in debug mode | 12d2900231a53f1f886736eb038e63e72822ef5d | <ide><path>Library/Homebrew/cleaner.rb
<ide> def clean_file_permissions path
<ide> else
<ide> 0444
<ide> end
<del> # Uncomment this block to show permission changes using brew install -v
<del> # if ARGV.verbose?
<del> # old_perms = path.stat.mode
<del> # if perms != old_perms
<del> # puts "Fixing #{path} permissions from #{old_perms.to_s(8)} to #{perms.to_s(8)}"
<del> # end
<del> # end
<add> if ARGV.debug?
<add> old_perms = path.stat.mode
<add> if perms != old_perms
<add> puts "Fixing #{path} permissions from #{old_perms.to_s(8)} to #{perms.to_s(8)}"
<add> end
<add> end
<ide> path.chmod perms
<ide> end
<ide> | 1 |
Python | Python | improve readability for cntk tests | 94dbc3042f5a85b399f5ce2859d4e8fbafd235b9 | <ide><path>tests/keras/backend/backend_test.py
<ide> from keras.backend import cntk_backend as KC
<ide>
<ide> BACKENDS = [KTH, KTF, KC]
<add># for special test cases of CNTK which treat dynamic axis
<add>KCSD = 'CNTK_single_tensor_dynamicity'
<add>KCTD = 'CNTK_two_tensor_dynamicity'
<ide>
<ide>
<ide> def check_dtype(var, dtype):
<ide> def check_dtype(var, dtype):
<ide> assert var.dtype.name == '%s_ref' % dtype
<ide>
<ide>
<add>def cntk_func_single_tensor(function_name, x_shape, **kwargs):
<add> xc = KC.placeholder(x_shape)
<add> output_cntk = getattr(KC, function_name)(xc, **kwargs)
<add> return KC.function([xc], [output_cntk])
<add>
<add>
<add>def cntk_func_two_tensor(function_name, x_shape, y, **kwargs):
<add> if type(y).__name__ == 'ndarray':
<add> xc = KC.placeholder(x_shape)
<add> output_cntk = getattr(KC, function_name)(xc, KC.variable(y), **kwargs)
<add> return KC.function([xc], [output_cntk])
<add> else:
<add> xc = KC.placeholder(ndim=len(x_shape))
<add> yc = KC.placeholder(y)
<add> output_cntk = getattr(KC, function_name)(xc, yc, **kwargs)
<add> return KC.function([xc, yc], [output_cntk])
<add>
<add>
<ide> def check_single_tensor_operation(function_name, input_shape, backend_list, **kwargs):
<ide> val = np.random.random(input_shape) - 0.5
<del> x_list = [k.variable(val) for k in backend_list]
<ide>
<ide> z_list = []
<del> for x, k in zip(x_list, backend_list):
<del> z_list.append(k.eval(getattr(k, function_name)(x, **kwargs)))
<add> for k in backend_list:
<add> if k == KCSD:
<add> z = cntk_func_single_tensor(function_name, input_shape,
<add> **kwargs)([val])[0]
<add> else:
<add> z = k.eval(getattr(k, function_name)(k.variable(val), **kwargs))
<add> if hasattr(z, '_keras_shape'):
<add> assert z._keras_shape == z.shape
<add> z_list += [z]
<ide>
<del> for i in range(len(z_list) - 1):
<del> assert z_list[i].shape == z_list[i + 1].shape
<del> assert_allclose(z_list[i], z_list[i + 1], atol=1e-05)
<del> if hasattr(z_list[i], '_keras_shape'):
<del> assert z_list[i]._keras_shape == z_list[i].shape
<add> for (z1, z2) in zip(z_list[1:], z_list[:-1]):
<add> assert z1.shape == z2.shape
<add> assert_allclose(z1, z2, atol=1e-05)
<ide>
<ide>
<ide> def check_two_tensor_operation(function_name, x_input_shape,
<ide> y_input_shape, backend_list, **kwargs):
<ide> xval = np.random.random(x_input_shape) - 0.5
<del> x_list = [k.variable(xval) for k in backend_list]
<del>
<ide> yval = np.random.random(y_input_shape) - 0.5
<ide>
<del> y_list = [k.variable(yval) for k in backend_list]
<del>
<ide> z_list = []
<del> for x, y, k in zip(x_list, y_list, backend_list):
<del> z_list.append(k.eval(getattr(k, function_name)(x, y, **kwargs)))
<del>
<del> for i in range(len(z_list) - 1):
<del> assert z_list[i].shape == z_list[i + 1].shape
<del> assert_allclose(z_list[i], z_list[i + 1], atol=1e-05)
<del> if hasattr(z_list[i], '_keras_shape'):
<del> assert z_list[i]._keras_shape == z_list[i].shape
<del>
<del>
<del>def cntk_check_single_tensor_operation(function_name, input_shape, **kwargs):
<del> val = np.random.random(input_shape) - 0.5
<del> xtf = KTF.variable(val)
<del> xc = KC.placeholder(input_shape)
<del>
<del> ztf = KTF.eval(getattr(KTF, function_name)(xtf, **kwargs))
<del>
<del> output_cntk = getattr(KC, function_name)(xc, **kwargs)
<del> func_cntk = KC.function([xc], [output_cntk, ])
<del> zc = func_cntk([val])
<del> # Keras function return a list, take the first output
<del> assert len(zc) == 1
<del> zc = zc[0]
<del>
<del> assert ztf.shape == zc.shape
<del> assert_allclose(ztf, zc, atol=1e-05)
<del>
<del>
<del>def cntk_check_two_tensor_operation_with_batch(function_name, x_input_shape,
<del> y_input_shape, **kwargs):
<del> xval = np.random.random(x_input_shape) - 0.5
<del> xtf = KTF.variable(xval)
<del> xc = KC.placeholder(ndim=len(x_input_shape))
<del>
<del> yval = np.random.random(y_input_shape) - 0.5
<del> ytf = KTF.variable(yval)
<del> yc = KC.placeholder(y_input_shape)
<del>
<del> ztf = KTF.eval(getattr(KTF, function_name)(xtf, ytf, **kwargs))
<del>
<del> output_cntk = getattr(KC, function_name)(xc, yc, **kwargs)
<del> func_cntk = KC.function([xc, yc], [output_cntk, ])
<del> zc = func_cntk([xval, yval])
<del> # Keras function return a list, take the first output
<del> assert len(zc) == 1
<del> zc = zc[0]
<del>
<del> assert ztf.shape == zc.shape
<del> assert_allclose(ztf, zc, atol=1e-05)
<del>
<del>
<del>def cntk_check_two_tensor_operation_with_single_batch(function_name, x_input_shape,
<del> y_input_shape, **kwargs):
<del> xval = np.random.random(x_input_shape) - 0.5
<del> xtf = KTF.variable(xval)
<del> xc = KC.placeholder(x_input_shape)
<del>
<del> yval = np.random.random(y_input_shape) - 0.5
<del> ytf = KTF.variable(yval)
<del> yc = KC.variable(yval)
<del>
<del> ztf = KTF.eval(getattr(KTF, function_name)(xtf, ytf, **kwargs))
<del>
<del> output_cntk = getattr(KC, function_name)(xc, yc, **kwargs)
<del> func_cntk = KC.function([xc, ], [output_cntk, ])
<del> zc = func_cntk([xval])
<del> # Keras function return a list, take the first output
<del> assert len(zc) == 1
<del> zc = zc[0]
<del>
<del> assert ztf.shape == zc.shape
<del> assert_allclose(ztf, zc, atol=1e-05)
<add> for k in backend_list:
<add> if k == KCSD:
<add> z = cntk_func_two_tensor(function_name, x_input_shape,
<add> y=yval, **kwargs)([xval])[0]
<add> elif k == KCTD:
<add> z = cntk_func_two_tensor(function_name, x_input_shape,
<add> y=y_input_shape, **kwargs)([xval, yval])[0]
<add> else:
<add> z = k.eval(getattr(k, function_name)(k.variable(xval), k.variable(yval), **kwargs))
<add> if hasattr(z, '_keras_shape'):
<add> assert z._keras_shape == z.shape
<add> z_list += [z]
<add>
<add> for (z1, z2) in zip(z_list[1:], z_list[:-1]):
<add> assert z1.shape == z2.shape
<add> assert_allclose(z1, z2, atol=1e-05)
<ide>
<ide>
<ide> def check_cross_entropy_with_valid_probability_distribution():
<ide> def test_eye(self):
<ide> def test_linear_operations(self):
<ide> check_two_tensor_operation('dot', (4, 2), (2, 4), BACKENDS)
<ide> check_two_tensor_operation('dot', (4, 2), (5, 2, 3), BACKENDS)
<del> # cntk doesn't support batch_dot with static axis as batch axis
<del> check_two_tensor_operation('batch_dot', (4, 2, 3), (4, 5, 3), [KTF, KTH], axes=(2, 2))
<del> check_two_tensor_operation('batch_dot', (4, 2, 3), (4, 3), [KTF, KTH], axes=(2, 1))
<del> check_two_tensor_operation('batch_dot', (4, 2), (4, 2, 3), [KTF, KTH], axes=(1, 1))
<del> check_two_tensor_operation('batch_dot', (32, 20), (32, 20), [KTF, KTH], axes=1)
<del> check_two_tensor_operation('batch_dot', (32, 20), (32, 20), [KTF, KTH], axes=(1, 1))
<del> # create special test case for CNTK which treat the first axis as dynamic axis
<del> cntk_check_two_tensor_operation_with_batch('batch_dot', (4, 2, 3), (4, 5, 3), axes=(2, 2))
<del> cntk_check_two_tensor_operation_with_batch('batch_dot', (4, 2, 3), (4, 3), axes=(2, 1))
<del> cntk_check_two_tensor_operation_with_batch('batch_dot', (4, 2), (4, 2, 3), axes=(1, 1))
<del> cntk_check_two_tensor_operation_with_batch('batch_dot', (32, 20), (32, 20), axes=1)
<del> cntk_check_two_tensor_operation_with_batch('batch_dot', (32, 20), (32, 20), axes=(1, 1))
<del> cntk_check_two_tensor_operation_with_single_batch('bias_add',
<del> (20, 10, 6),
<del> (6,),
<del> data_format='channels_last')
<del> cntk_check_two_tensor_operation_with_single_batch('bias_add',
<del> (20, 6, 10),
<del> (6,),
<del> data_format='channels_first')
<del> cntk_check_two_tensor_operation_with_single_batch('bias_add',
<del> (20, 10, 20, 5),
<del> (5,),
<del> data_format='channels_last')
<del> cntk_check_two_tensor_operation_with_single_batch('bias_add',
<del> (20, 5, 10, 20),
<del> (5,),
<del> data_format='channels_first')
<del> cntk_check_two_tensor_operation_with_single_batch('bias_add',
<del> (40, 10, 30, 20, 8),
<del> (8,),
<del> data_format='channels_last')
<del> cntk_check_two_tensor_operation_with_single_batch('bias_add',
<del> (40, 8, 10, 30, 20),
<del> (8,),
<del> data_format='channels_first')
<del> cntk_check_two_tensor_operation_with_single_batch('bias_add',
<del> (40, 8),
<del> (8,),
<del> data_format='channels_last')
<del> cntk_check_two_tensor_operation_with_single_batch('bias_add',
<del> (40, 8),
<del> (8,),
<del> data_format='channels_first')
<del> cntk_check_two_tensor_operation_with_single_batch('bias_add',
<del> (20, 10, 6),
<del> (10, 6),
<del> data_format='channels_last')
<del> cntk_check_two_tensor_operation_with_single_batch('bias_add',
<del> (20, 6, 10),
<del> (10, 6),
<del> data_format='channels_first')
<add>
<add> check_two_tensor_operation('batch_dot', (4, 2, 3), (4, 5, 3), [KTF, KTH, KCTD], axes=(2, 2))
<add> check_two_tensor_operation('batch_dot', (4, 2, 3), (4, 3), [KTF, KTH, KCTD], axes=(2, 1))
<add> check_two_tensor_operation('batch_dot', (4, 2), (4, 2, 3), [KTF, KTH, KCTD], axes=(1, 1))
<add> check_two_tensor_operation('batch_dot', (32, 20), (32, 20), [KTF, KTH, KCTD], axes=1)
<add> check_two_tensor_operation('batch_dot', (32, 20), (32, 20), [KTF, KTH, KCTD], axes=(1, 1))
<ide>
<ide> check_single_tensor_operation('transpose', (4, 2), BACKENDS)
<ide> # cntk doesn't support reverse yet
<ide> def test_shape_operations(self):
<ide> pattern=(2, 0, 1))
<ide> check_single_tensor_operation('repeat', (4, 1), BACKENDS, n=3)
<ide> check_single_tensor_operation('flatten', (4, 1), BACKENDS)
<del> # cntk need create batch as dynamic axis, so can't test in this way
<del> check_single_tensor_operation('batch_flatten', (20, 2, 5), [KTH, KTF])
<del> # create special test case for CNTK which treat the first axis as dynamic axis
<del> cntk_check_single_tensor_operation('batch_flatten', (20, 2, 5))
<add> check_single_tensor_operation('batch_flatten', (20, 2, 5), [KTH, KTF, KCSD])
<ide> check_single_tensor_operation('expand_dims', (4, 3), BACKENDS, axis=-1)
<ide> check_single_tensor_operation('expand_dims', (4, 3, 2), BACKENDS, axis=1)
<ide> check_single_tensor_operation('squeeze', (4, 3, 1), BACKENDS, axis=2)
<ide> check_single_tensor_operation('squeeze', (4, 1, 1), BACKENDS, axis=1)
<ide> check_composed_tensor_operations('reshape', {'shape': (4, 3, 1, 1)},
<ide> 'squeeze', {'axis': 2},
<ide> (4, 3, 1, 1), BACKENDS)
<del> cntk_check_single_tensor_operation('resize_images', (20, 3, 40, 40),
<del> height_factor=2,
<del> width_factor=3,
<del> data_format='channels_first')
<del> cntk_check_single_tensor_operation('resize_images', (20, 40, 40, 3),
<del> height_factor=3,
<del> width_factor=2,
<del> data_format='channels_last')
<ide> check_single_tensor_operation('temporal_padding',
<ide> (4, 3, 3),
<ide> BACKENDS)
<ide> def test_conv3d(self):
<ide> assert_allclose(ztf, zc, atol=1e-05)
<ide>
<ide> def test_pool2d(self):
<del> # cntk need pooling on dynamic axes, can't test in this way, is coverred in a seperate case
<del> check_single_tensor_operation('pool2d', (5, 10, 12, 3), [KTH, KTF], pool_size=(2, 2),
<add> check_single_tensor_operation('pool2d', (5, 10, 12, 3), [KTH, KTF, KCSD], pool_size=(2, 2),
<ide> strides=(1, 1), padding='valid')
<ide>
<del> cntk_check_single_tensor_operation('pool2d', (5, 10, 12, 3), pool_size=(2, 2),
<del> strides=(1, 1), padding='valid')
<del>
<del> check_single_tensor_operation('pool2d', (5, 9, 11, 3), [KTH, KTF], pool_size=(2, 2),
<add> check_single_tensor_operation('pool2d', (5, 9, 11, 3), [KTH, KTF, KCSD], pool_size=(2, 2),
<ide> strides=(1, 1), padding='valid')
<ide>
<del> check_single_tensor_operation('pool2d', (5, 9, 11, 3), [KTH, KTF], pool_size=(2, 2),
<add> check_single_tensor_operation('pool2d', (5, 9, 11, 3), [KTH, KTF, KCSD], pool_size=(2, 2),
<ide> strides=(1, 1), pool_mode='avg')
<ide>
<del> cntk_check_single_tensor_operation('pool2d', (5, 9, 11, 3), pool_size=(2, 2),
<del> strides=(1, 1), padding='valid')
<del>
<del> check_single_tensor_operation('pool2d', (5, 9, 11, 3), [KTH, KTF], pool_size=(2, 3),
<add> check_single_tensor_operation('pool2d', (5, 9, 11, 3), [KTH, KTF, KCSD], pool_size=(2, 3),
<ide> strides=(1, 1), padding='valid')
<ide>
<del> cntk_check_single_tensor_operation('pool2d', (5, 9, 11, 3), pool_size=(2, 3),
<del> strides=(1, 1), padding='valid')
<del>
<del> cntk_check_single_tensor_operation('pool2d', (5, 9, 11, 3), pool_size=(2, 3),
<del> strides=(1, 1), pool_mode='avg')
<del>
<ide> def test_pool3d(self):
<del> # cntk need pooling on dynamic axes, can't test in this way, is coverred in a seperate case
<del> check_single_tensor_operation('pool3d', (5, 10, 12, 5, 3), [KTH, KTF], pool_size=(2, 2, 2),
<add> check_single_tensor_operation('pool3d', (5, 10, 12, 5, 3), [KTH, KTF, KCSD], pool_size=(2, 2, 2),
<ide> strides=(1, 1, 1), padding='valid')
<ide>
<del> cntk_check_single_tensor_operation('pool3d', (5, 10, 12, 5, 3), pool_size=(2, 2, 2),
<del> strides=(1, 1, 1), padding='valid')
<del>
<del> check_single_tensor_operation('pool3d', (5, 9, 11, 5, 3), [KTH, KTF], pool_size=(2, 2, 2),
<add> check_single_tensor_operation('pool3d', (5, 9, 11, 5, 3), [KTH, KTF, KCSD], pool_size=(2, 2, 2),
<ide> strides=(1, 1, 1), padding='valid')
<ide>
<del> check_single_tensor_operation('pool3d', (5, 9, 11, 5, 3), [KTH, KTF], pool_size=(2, 2, 2),
<add> check_single_tensor_operation('pool3d', (5, 9, 11, 5, 3), [KTH, KTF, KCSD], pool_size=(2, 2, 2),
<ide> strides=(1, 1, 1), pool_mode='avg')
<ide>
<del> cntk_check_single_tensor_operation('pool3d', (5, 9, 11, 5, 3), pool_size=(2, 2, 2),
<del> strides=(1, 1, 1), padding='valid')
<del>
<del> check_single_tensor_operation('pool3d', (5, 9, 11, 5, 3), [KTH, KTF], pool_size=(2, 3, 2),
<add> check_single_tensor_operation('pool3d', (5, 9, 11, 5, 3), [KTH, KTF, KCSD], pool_size=(2, 3, 2),
<ide> strides=(1, 1, 1), padding='valid')
<ide>
<del> cntk_check_single_tensor_operation('pool3d', (5, 9, 11, 5, 3), pool_size=(2, 3, 2),
<del> strides=(1, 1, 1), padding='valid')
<del>
<del> cntk_check_single_tensor_operation('pool3d', (5, 9, 11, 5, 3), pool_size=(2, 3, 2),
<del> strides=(1, 1, 1), pool_mode='avg')
<del>
<ide> check_single_tensor_operation('pool3d', (2, 6, 6, 6, 3), [KTH, KTF], pool_size=(3, 3, 3),
<ide> strides=(1, 1, 1), padding='same', pool_mode='avg')
<ide>
<ide> def test_resize_images(self):
<ide> elif data_format == 'channels_last':
<ide> x_shape = (2,) + shape + (3,)
<ide> check_single_tensor_operation('resize_images', x_shape,
<del> BACKENDS,
<add> [KTH, KTF, KCSD],
<ide> height_factor=2,
<ide> width_factor=2,
<ide> data_format=data_format)
<ide> def test_spatial_3d_padding(self):
<ide>
<ide> def test_bias_add(self):
<ide> for data_format in ['channels_first', 'channels_last']:
<del> for shape in [(3,), (2, 3), (5, 3, 2)]:
<add> for shape in [(), (3,), (2, 3), (5, 3, 2)]:
<ide> if data_format == 'channels_first':
<ide> x_shape = (1, 4) + shape
<ide> else:
<ide> x_shape = (1,) + shape + (4,)
<ide> bias_shape = (4,)
<ide> check_two_tensor_operation('bias_add', x_shape, bias_shape,
<del> [KTH, KTF],
<add> [KTH, KTF, KCSD],
<ide> data_format=data_format)
<ide>
<add> if data_format == 'channels_first':
<add> x_shape = (20, 6, 10)
<add> else:
<add> x_shape = (20, 10, 6)
<add> check_two_tensor_operation('bias_add', x_shape, (10, 6),
<add> [KTH, KTF, KCSD],
<add> data_format=data_format)
<add>
<ide> # Test invalid use casess
<ide> for backend in (KTH, KTF):
<ide> x = backend.variable(np.random.random(x_shape)) | 1 |
PHP | PHP | fix styleci errors | 9c61a908a1813c9508f4f88134e03f301f8b6293 | <ide><path>src/Illuminate/Database/Console/Migrations/MigrateCommand.php
<ide> use Illuminate\Contracts\Events\Dispatcher;
<ide> use Illuminate\Database\Events\SchemaLoaded;
<ide> use Illuminate\Database\Migrations\Migrator;
<del>use Illuminate\Database\SQLiteConnection;
<ide> use Illuminate\Database\SqlServerConnection;
<ide>
<ide> class MigrateCommand extends BaseCommand
<ide><path>src/Illuminate/Database/SQLiteConnection.php
<ide> use Illuminate\Database\Schema\SQLiteBuilder;
<ide> use Illuminate\Database\Schema\SqliteSchemaState;
<ide> use Illuminate\Filesystem\Filesystem;
<del>use RuntimeException;
<ide>
<ide> class SQLiteConnection extends Connection
<ide> {
<ide><path>src/Illuminate/Database/Schema/SqliteSchemaState.php
<ide>
<ide> namespace Illuminate\Database\Schema;
<ide>
<del>use Exception;
<del>use Illuminate\Support\Str;
<del>use Symfony\Component\Process\Process;
<del>
<ide> class SqliteSchemaState extends SchemaState
<ide> {
<ide> /** | 3 |
Python | Python | add space between words across lines | b8c885d097bf83bce05a11164c9f939905a3c219 | <ide><path>numpy/lib/format.py
<ide> def _wrap_header_guess_version(header):
<ide> return ret
<ide>
<ide> header = _wrap_header(header, (3, 0))
<del> warnings.warn("Stored array in format 3.0. It can only be"
<add> warnings.warn("Stored array in format 3.0. It can only be "
<ide> "read by NumPy >= 1.17", UserWarning, stacklevel=2)
<ide> return header
<ide> | 1 |
Mixed | Text | add inputmode to html dom property whitelist | 3b2df5fd9c824849edaad8368ae18820f2f50e47 | <ide><path>docs/docs/ref-04-tags-and-attributes.ko-KR.md
<ide> async autoComplete autoFocus autoPlay cellPadding cellSpacing charSet challenge
<ide> checked classID className colSpan cols content contentEditable contextMenu controls
<ide> coords crossOrigin data dateTime defer dir disabled download draggable encType
<ide> form formAction formEncType formMethod formNoValidate formTarget frameBorder
<del>headers height hidden high href hrefLang htmlFor httpEquiv icon id keyParams keyType
<del>label lang list loop low manifest marginHeight marginWidth max maxLength media
<del>mediaGroup method min multiple muted name noValidate open optimum pattern placeholder
<del>poster preload radioGroup readOnly rel required role rowSpan rows sandbox scope
<del>scoped scrolling seamless selected shape size sizes span spellCheck src srcDoc
<del>srcSet start step style tabIndex target title type useMap value width wmode
<add>headers height hidden high href hrefLang htmlFor httpEquiv icon id inputMode
<add>keyParams keyType label lang list loop low manifest marginHeight marginWidth max
<add>maxLength media mediaGroup method min multiple muted name noValidate open
<add>optimum pattern placeholder poster preload radioGroup readOnly rel required role
<add>rowSpan rows sandbox scope scoped scrolling seamless selected shape size sizes
<add>span spellCheck src srcDoc srcSet start step style tabIndex target title type
<add>useMap value width wmode
<ide> ```
<ide>
<ide> 덧붙여, 이런 비표준 어트리뷰트도 지원됩니다.
<ide><path>docs/docs/ref-04-tags-and-attributes.md
<ide> async autoComplete autoFocus autoPlay cellPadding cellSpacing charSet challenge
<ide> checked classID className colSpan cols content contentEditable contextMenu controls
<ide> coords crossOrigin data dateTime defer dir disabled download draggable encType
<ide> form formAction formEncType formMethod formNoValidate formTarget frameBorder
<del>headers height hidden high href hrefLang htmlFor httpEquiv icon id keyParams keyType
<del>label lang list loop low manifest marginHeight marginWidth max maxLength media
<del>mediaGroup method min multiple muted name noValidate open optimum pattern placeholder
<del>poster preload radioGroup readOnly rel required role rowSpan rows sandbox scope
<del>scoped scrolling seamless selected shape size sizes span spellCheck src srcDoc
<del>srcSet start step style tabIndex target title type useMap value width wmode
<add>headers height hidden high href hrefLang htmlFor httpEquiv icon id inputMode
<add>keyParams keyType label lang list loop low manifest marginHeight marginWidth max
<add>maxLength media mediaGroup method min multiple muted name noValidate open
<add>optimum pattern placeholder poster preload radioGroup readOnly rel required role
<add>rowSpan rows sandbox scope scoped scrolling seamless selected shape size sizes
<add>span spellCheck src srcDoc srcSet start step style tabIndex target title type
<add>useMap value width wmode
<ide> ```
<ide>
<ide> In addition, the following non-standard attributes are supported:
<ide><path>src/renderers/dom/shared/HTMLDOMPropertyConfig.js
<ide> var HTMLDOMPropertyConfig = {
<ide> httpEquiv: null,
<ide> icon: null,
<ide> id: MUST_USE_PROPERTY,
<add> inputMode: MUST_USE_ATTRIBUTE,
<ide> is: MUST_USE_ATTRIBUTE,
<ide> keyParams: MUST_USE_ATTRIBUTE,
<ide> keyType: MUST_USE_ATTRIBUTE, | 3 |
Text | Text | release notes for 1.0.0rc11 promise-resolution | 2d48733723d87439775412247ce1558ed444eb33 | <ide><path>CHANGELOG.md
<add><a name="1.0.0rc11"></a>
<add># 1.0.0rc11 promise-resolution (2012-06-10)
<add>
<add>## Features
<add>
<add>- **$route:**
<add> - allow defining route async dependencies as promises and defer route change until all promises
<add> are resolved
<add> ([885fb0dd](https://github.com/angular/angular.js/commit/885fb0dd0743859a8985c23e4d0c1855a2be711e))
<add> - rename template -> tempalteUrl and add support for inline templates
<add> ([0a6e464a](https://github.com/angular/angular.js/commit/0a6e464a93d9a1e76a624b356054ce9ca4015f55))
<add>- **$compile:** simplify isolate scope bindings and introduce true two-way data-binding between
<add> parent scope and isolate scope
<add> ([c3a41ff9](https://github.com/angular/angular.js/commit/c3a41ff9fefe894663c4d4f40a83794521deb14f))
<add>- **$injector:** provide API for retrieving function annotations
<add> ([4361efb0](https://github.com/angular/angular.js/commit/4361efb03b79e71bf0cea92b94ff377ed718bad4))
<add>- **$location:** add $locatonChange[start|success] event - since events are cancelable, it's now
<add> possible to cancel route and location changes.
<add> ([92a2e180](https://github.com/angular/angular.js/commit/92a2e1807657c69e1372106b0727675a30f4cbd7))
<add>- **$rootElement:** expose application root element as $rootElement service
<add> ([85632cb4](https://github.com/angular/angular.js/commit/85632cb44c95617d73c369f3a03fb476a4d5c8a2))
<add>
<add>
<add>## Bug Fixes
<add>
<add>- **$compile:** correctly merge class attr for replace directives (contributed by Max Martinsson,
<add> [fb99b539](https://github.com/angular/angular.js/commit/fb99b539b4d851773b43f1564f7032adb157c0db),
<add> [#1006](https://github.com/angular/angular.js/issues/1006))
<add>- **$http:** add utf-8 to default Content-Type header (post/put)
<add> ([10f80d7d](https://github.com/angular/angular.js/commit/10f80d7d2918f98262090b425ecc294d9518aa7e))
<add>- **$timeout:** allow calling $timeout.cancel() with undefined (contributed by Ali Mills,
<add> [1904596e](https://github.com/angular/angular.js/commit/1904596e0c2330299e92f092bd7a6ceca8e97c30))
<add>- **jqLite:** don't eat event exceptions
<add> ([416a7830](https://github.com/angular/angular.js/commit/416a7830403a579cc57cf3a0198193790dcd0bc6))
<add>
<add>
<add>## Breaking Changes
<add>
<add>- **$beforeRouteChange and $routeChangeStart events were renamed to $afterRouteChange and
<add> $routeChangeSuccess**
<add>
<add> This was done to make the naming consistent with $location events and also get events to
<add> categorize and order nicely just by alphabetical sorting.
<add>
<add> ([7c242821](https://github.com/angular/angular.js/commit/7c2428218893f59c6a4499667488009ca67f3385))
<add>
<add>
<add>- **`template` option in $route definition was renamed to `templateUrl`**
<add>
<add> The `template` options in $route definition now represents the actual template string. To provide
<add> the template url use `templateUrl` option instead. This was done to unify the directive and $route
<add> definitions.
<add>
<add> To migrate just rename `template` to `templateUrl`.
<add> ([0a6e464a](https://github.com/angular/angular.js/commit/0a6e464a93d9a1e76a624b356054ce9ca4015f55))
<add>
<add>
<add>- **isolate scope bindings definition has changed**
<add>
<add> To migrate the code follow the example below:
<add>
<add> Before:
<add>
<add> scope: {
<add> myAttr: 'attribute',
<add> myBind: 'bind',
<add> myExpression: 'expression',
<add> myEval: 'evaluate',
<add> myAccessor: 'accessor'
<add> }
<add>
<add> After:
<add>
<add> scope: {
<add> myAttr: '@',
<add> myBind: '@',
<add> myExpression: '&',
<add> // myEval - usually not useful, but in cases where the expression is assignable, you can use '='
<add> myAccessor: '=' // in directive's template change myAccessor() to myAccessor
<add> }
<add>
<add>
<add>- **the inject option for the directive controller injection was removed**
<add>
<add> The removed `inject` wasn't generally useful for directives so there should be no code using it.
<add> ([c3a41ff9](https://github.com/angular/angular.js/commit/c3a41ff9fefe894663c4d4f40a83794521deb14f))
<add>
<add>
<add>
<ide> <a name="1.0.0rc10"></a>
<ide> # 1.0.0rc10 tesseract-giftwrapping (2012-05-23)
<ide> | 1 |
Text | Text | remove changelog entry | 86100a1ebf3dc440dd193e0b24118c09cca6f01a | <ide><path>activerecord/CHANGELOG.md
<del>* Move database and shard selection config options to a generator.
<del>
<del> Rather than generating the config options in the production.rb when applications are created, applications can now run a generator to create an initializer and uncomment / update options as needed. All multi-db configuration can be imlpemented in this initializer.
<del>
<del> *Eileen M. Uchitelle*
<del>
<ide> Please check [7-0-stable](https://github.com/rails/rails/blob/7-0-stable/activerecord/CHANGELOG.md) for previous changes. | 1 |
Javascript | Javascript | implement mipmap support in basistextureloader | 274b5ddbc46367803e54e706950bb8ad9ea7097b | <ide><path>examples/js/loaders/BasisTextureLoader.js
<ide> THREE.BasisTextureLoader = class BasisTextureLoader {
<ide>
<ide> var config = this.workerConfig;
<ide>
<del> var { data, width, height } = message;
<del>
<del> var mipmaps = [ { data, width, height } ];
<add> var { width, height, mipmaps } = message;
<ide>
<ide> var texture;
<ide>
<ide> THREE.BasisTextureLoader.BasisWorker = function () {
<ide> case 'transcode':
<ide> transcoderPending.then( () => {
<ide>
<del> var { data, width, height } = transcode( message.buffer );
<add> var { width, height, mipmaps } = transcode( message.buffer );
<add>
<add> var buffers = [];
<add>
<add> for ( var i = 0; i < mipmaps.length; ++i ) {
<add>
<add> buffers.push( mipmaps[i].data.buffer );
<add>
<add> }
<ide>
<del> self.postMessage( { type: 'transcode', id: message.id, data, width, height }, [ data.buffer ] );
<add> self.postMessage( { type: 'transcode', id: message.id, width, height, mipmaps }, buffers );
<ide>
<ide> } );
<ide> break;
<ide> THREE.BasisTextureLoader.BasisWorker = function () {
<ide>
<ide> var width = basisFile.getImageWidth( 0, 0 );
<ide> var height = basisFile.getImageHeight( 0, 0 );
<del> var images = basisFile.getNumImages();
<ide> var levels = basisFile.getNumLevels( 0 );
<ide>
<ide> function cleanup () {
<ide> THREE.BasisTextureLoader.BasisWorker = function () {
<ide>
<ide> }
<ide>
<del> if ( ! width || ! height || ! images || ! levels ) {
<add> if ( ! width || ! height || ! levels ) {
<ide>
<ide> cleanup();
<ide> throw new Error( 'THREE.BasisTextureLoader: Invalid .basis file' );
<ide> THREE.BasisTextureLoader.BasisWorker = function () {
<ide>
<ide> }
<ide>
<del> var dst = new Uint8Array( basisFile.getImageTranscodedSizeInBytes( 0, 0, config.format ) );
<add> var mipmaps = [];
<ide>
<del> var startTime = performance.now();
<add> for ( var mip = 0; mip < levels; mip++ ) {
<ide>
<del> var status = basisFile.transcodeImage(
<del> dst,
<del> 0,
<del> 0,
<del> config.format,
<del> config.etcSupported ? 0 : ( config.dxtSupported ? 1 : 0 ),
<del> 0
<del> );
<add> var mipWidth = basisFile.getImageWidth( 0, mip );
<add> var mipHeight = basisFile.getImageHeight( 0, mip );
<add> var dst = new Uint8Array( basisFile.getImageTranscodedSizeInBytes( 0, mip, config.format ) );
<ide>
<del> cleanup();
<add> var status = basisFile.transcodeImage(
<add> dst,
<add> 0,
<add> mip,
<add> config.format,
<add> config.etcSupported ? 0 : ( config.dxtSupported ? 1 : 0 ),
<add> 0
<add> );
<add>
<add> if ( ! status ) {
<add>
<add> cleanup();
<add> throw new Error( 'THREE.BasisTextureLoader: .transcodeImage failed.' );
<ide>
<del> if ( ! status ) {
<add> }
<ide>
<del> throw new Error( 'THREE.BasisTextureLoader: .transcodeImage failed.' );
<add> mipmaps.push( { data: dst, width: mipWidth, height: mipHeight } );
<ide>
<ide> }
<ide>
<del> return { data: dst, width, height };
<add> cleanup();
<add>
<add> return { width, height, mipmaps };
<ide>
<ide> }
<ide> | 1 |
PHP | PHP | remove unused imports | fc3a5a9aefc9747c7921364a63a5e838ea174723 | <ide><path>tests/Integration/Database/MigrateWithRealpathTest.php
<ide>
<ide> namespace Illuminate\Tests\Integration\Database;
<ide>
<del>use Illuminate\Database\Events\MigrationEnded;
<del>use Illuminate\Database\Events\MigrationsEnded;
<del>use Illuminate\Database\Events\MigrationsStarted;
<del>use Illuminate\Database\Events\MigrationStarted;
<del>use Illuminate\Support\Facades\Event;
<ide> use Illuminate\Support\Facades\Schema;
<ide>
<ide> class MigrateWithRealpathTest extends DatabaseTestCase | 1 |
PHP | PHP | remove ties to dispatcherfactory | 1037777dcbfef64abb3dd520a7d9410fcd3bb47b | <ide><path>src/Error/ExceptionRenderer.php
<ide> use Cake\Http\Exception\HttpException;
<ide> use Cake\Http\Response;
<ide> use Cake\Http\ServerRequestFactory;
<del>use Cake\Routing\DispatcherFactory;
<ide> use Cake\Routing\Router;
<ide> use Cake\Utility\Inflector;
<ide> use Cake\View\Exception\MissingTemplateException;
<ide> protected function _outputMessageSafe($template)
<ide> protected function _shutdown()
<ide> {
<ide> $this->controller->dispatchEvent('Controller.shutdown');
<del> $dispatcher = DispatcherFactory::create();
<del> $eventManager = $dispatcher->getEventManager();
<del> foreach ($dispatcher->filters() as $filter) {
<del> $eventManager->on($filter);
<del> }
<del> $args = [
<del> 'request' => $this->controller->getRequest(),
<del> 'response' => $this->controller->getResponse(),
<del> ];
<del> $result = $dispatcher->dispatchEvent('Dispatcher.afterDispatch', $args);
<ide>
<del> return $result->getData('response');
<add> return $this->controller->getResponse();
<ide> }
<ide> }
<ide><path>tests/TestCase/Error/ExceptionRendererTest.php
<ide> public function testRenderShutdownEvents()
<ide> };
<ide> $events = EventManager::instance();
<ide> $events->on('Controller.shutdown', $listener);
<del> $events->on('Dispatcher.afterDispatch', $listener);
<ide>
<ide> $exception = new Exception('Terrible');
<ide> $renderer = new ExceptionRenderer($exception);
<ide> $renderer->render();
<ide>
<del> $expected = ['Controller.shutdown', 'Dispatcher.afterDispatch'];
<add> $expected = ['Controller.shutdown'];
<ide> $this->assertEquals($expected, $fired);
<ide> }
<ide>
<del> /**
<del> * Test that rendering exceptions triggers events
<del> * on filters attached to dispatcherfactory
<del> *
<del> * @return void
<del> */
<del> public function testRenderShutdownEventsOnDispatcherFactory()
<del> {
<del> $filter = $this->getMockBuilder('Cake\Routing\DispatcherFilter')
<del> ->setMethods(['afterDispatch'])
<del> ->getMock();
<del>
<del> $filter->expects($this->at(0))
<del> ->method('afterDispatch');
<del>
<del> DispatcherFactory::add($filter);
<del>
<del> $exception = new Exception('Terrible');
<del> $renderer = new ExceptionRenderer($exception);
<del> $renderer->render();
<del> }
<del>
<ide> /**
<ide> * test that subclass methods fire shutdown events.
<ide> *
<ide> public function testSubclassTriggerShutdownEvents()
<ide> };
<ide> $events = EventManager::instance();
<ide> $events->on('Controller.shutdown', $listener);
<del> $events->on('Dispatcher.afterDispatch', $listener);
<ide>
<ide> $exception = new MissingWidgetThingException('Widget not found');
<ide> $renderer = new MyCustomExceptionRenderer($exception);
<ide> $renderer->render();
<ide>
<del> $expected = ['Controller.shutdown', 'Dispatcher.afterDispatch'];
<add> $expected = ['Controller.shutdown'];
<ide> $this->assertEquals($expected, $fired);
<ide> }
<ide>
<ide><path>tests/TestCase/TestSuite/IntegrationTestCaseTest.php
<ide> use Cake\Core\Configure;
<ide> use Cake\Event\EventManager;
<ide> use Cake\Http\Response;
<del>use Cake\Routing\DispatcherFactory;
<ide> use Cake\Routing\RouteBuilder;
<ide> use Cake\Routing\Router;
<ide> use Cake\Routing\Route\InflectedRoute;
<ide> public function setUp()
<ide> $routes->connect('/:controller/:action/*', []);
<ide> });
<ide> Router::$initialized = true;
<del>
<del> $this->useHttpServer(true);
<del> DispatcherFactory::clear();
<del> }
<del>
<del> /**
<del> * Helper for enabling the legacy stack for backwards compatibility testing.
<del> *
<del> * @return void
<del> */
<del> protected function useLegacyDispatcher()
<del> {
<del> DispatcherFactory::add('Routing');
<del> DispatcherFactory::add('ControllerFactory');
<del>
<del> $this->useHttpServer(false);
<ide> }
<ide>
<ide> /**
<ide> public function testWithExpectedException()
<ide> */
<ide> public function testWithExpectedExceptionHttpServer()
<ide> {
<del> DispatcherFactory::clear();
<del>
<ide> $this->get('/tests_apps/throw_exception');
<ide> $this->assertResponseCode(500);
<ide> }
<ide> public function testRedirect()
<ide> */
<ide> public function testRedirectHttpServer()
<ide> {
<del> DispatcherFactory::clear();
<del>
<ide> $this->post('/tests_apps/redirect_to');
<ide> $this->assertResponseCode(302);
<ide> $this->assertHeader('X-Middleware', 'true'); | 3 |
PHP | PHP | add support for specific tls versions | 5b6b990c1506849d6b20e82c22bcac012e1436f2 | <ide><path>src/Network/Socket.php
<ide> class Socket
<ide> 'sslv3_client' => STREAM_CRYPTO_METHOD_SSLv3_CLIENT,
<ide> 'sslv23_client' => STREAM_CRYPTO_METHOD_SSLv23_CLIENT,
<ide> 'tls_client' => STREAM_CRYPTO_METHOD_TLS_CLIENT,
<add> 'tlsv10_client' => STREAM_CRYPTO_METHOD_TLSv1_0_CLIENT,
<add> 'tlsv11_client' => STREAM_CRYPTO_METHOD_TLSv1_1_CLIENT,
<add> 'tlsv12_client' => STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT,
<ide> 'sslv2_server' => STREAM_CRYPTO_METHOD_SSLv2_SERVER,
<ide> 'sslv3_server' => STREAM_CRYPTO_METHOD_SSLv3_SERVER,
<ide> 'sslv23_server' => STREAM_CRYPTO_METHOD_SSLv23_SERVER,
<del> 'tls_server' => STREAM_CRYPTO_METHOD_TLS_SERVER
<add> 'tls_server' => STREAM_CRYPTO_METHOD_TLS_SERVER,
<add> 'tlsv10_server' => STREAM_CRYPTO_METHOD_TLSv1_0_SERVER,
<add> 'tlsv11_server' => STREAM_CRYPTO_METHOD_TLSv1_1_SERVER,
<add> 'tlsv12_server' => STREAM_CRYPTO_METHOD_TLSv1_2_SERVER
<ide> // @codingStandardsIgnoreEnd
<ide> ];
<ide>
<ide> public function enableCrypto($type, $clientOrServer = 'client', $enable = true)
<ide> if (!array_key_exists($type . '_' . $clientOrServer, $this->_encryptMethods)) {
<ide> throw new InvalidArgumentException('Invalid encryption scheme chosen');
<ide> }
<add> $method = $this->_encryptMethods[$type . '_' . $clientOrServer];
<add>
<add> // Prior to PHP 5.6.7 TLS_CLIENT was any version of TLS. This was changed in 5.6.7
<add> // to fix backwards compatibility issues, and now only resolves to TLS1.0
<add> //
<add> // See https://github.com/php/php-src/commit/10bc5fd4c4c8e1dd57bd911b086e9872a56300a0
<add> if (version_compare(PHP_VERSION, '5.6.7', '>=')) {
<add> if ($method == STREAM_CRYPTO_METHOD_TLS_CLIENT) {
<add> $method |= STREAM_CRYPTO_METHOD_TLSv1_1_CLIENT | STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT;
<add> }
<add> if ($method == STREAM_CRYPTO_METHOD_TLS_SERVER) {
<add> $method |= STREAM_CRYPTO_METHOD_TLSv1_1_SERVER | STREAM_CRYPTO_METHOD_TLSv1_2_SERVER;
<add> }
<add> }
<add>
<ide> try {
<del> $enableCryptoResult = stream_socket_enable_crypto($this->connection, $enable, $this->_encryptMethods[$type . '_' . $clientOrServer]);
<add> $enableCryptoResult = stream_socket_enable_crypto($this->connection, $enable, $method);
<ide> } catch (Exception $e) {
<ide> $this->setLastError(null, $e->getMessage());
<ide> throw new SocketException($e->getMessage());
<ide><path>tests/TestCase/Network/SocketTest.php
<ide> public function testEnableCryptoExceptionEnableTwice()
<ide> */
<ide> public function testEnableCryptoExceptionDisableTwice()
<ide> {
<del> // testing on tls server
<ide> $this->_connectSocketToSslTls();
<ide> $this->Socket->enableCrypto('tls', 'client', false);
<ide> }
<ide>
<add> /**
<add> * testEnableCryptoEnableStatus
<add> *
<add> * @return void
<add> */
<add> public function testEnableCryptoEnableTls12()
<add> {
<add> $this->_connectSocketToSslTls();
<add> $this->assertFalse($this->Socket->encrypted);
<add> $this->Socket->enableCrypto('tlsv12', 'client', true);
<add> $this->assertTrue($this->Socket->encrypted);
<add> }
<add>
<ide> /**
<ide> * testEnableCryptoEnableStatus
<ide> *
<ide> * @return void
<ide> */
<ide> public function testEnableCryptoEnableStatus()
<ide> {
<del> // testing on tls server
<ide> $this->_connectSocketToSslTls();
<ide> $this->assertFalse($this->Socket->encrypted);
<ide> $this->Socket->enableCrypto('tls', 'client', true); | 2 |
Ruby | Ruby | add actioncable require statement to plugin | e270bb586eda3ff65ce47039c043570e5ab3e8a4 | <ide><path>railties/lib/rails/generators/rails/plugin/templates/rails/application.rb
<ide> # Pick the frameworks you want:
<ide> <%= comment_if :skip_active_record %>require "active_record/railtie"
<ide> require "action_controller/railtie"
<del><%= comment_if :skip_action_mailer %>require "action_mailer/railtie"
<ide> require "action_view/railtie"
<del><%= comment_if :skip_sprockets %>require "sprockets/railtie"
<add><%= comment_if :skip_action_mailer %>require "action_mailer/railtie"
<add>require "active_job/railtie"
<add><%= comment_if :skip_action_cable %>require "action_cable/engine"
<ide> <%= comment_if :skip_test %>require "rails/test_unit/railtie"
<add><%= comment_if :skip_sprockets %>require "sprockets/railtie"
<ide> <% end -%>
<ide>
<ide> Bundler.require(*Rails.groups) | 1 |
Javascript | Javascript | fix style bugs | fe4b89a167b69037305d55c7b5b310e10daf993a | <ide><path>src/math/Matrix4.js
<ide> Object.assign( Matrix4.prototype, {
<ide> return this.compose( zero, q, one );
<ide>
<ide> };
<add>
<ide> }(),
<ide>
<ide> lookAt: function () {
<ide> Object.assign( Matrix4.prototype, {
<ide> var te = this.elements;
<ide>
<ide> var x = quaternion._x, y = quaternion._y, z = quaternion._z, w = quaternion._w;
<del> var x2 = x + x, y2 = y + y, z2 = z + z;
<add> var x2 = x + x, y2 = y + y, z2 = z + z;
<ide> var xx = x * x2, xy = x * y2, xz = x * z2;
<ide> var yy = y * y2, yz = y * z2, zz = z * z2;
<ide> var wx = w * x2, wy = w * y2, wz = w * z2;
<ide>
<ide> var sx = scale.x, sy = scale.y, sz = scale.z;
<ide>
<del> te[ 0 ] = (1 - ( yy + zz )) * sx;
<del> te[ 4 ] = (xy - wz) * sy;
<del> te[ 8 ] = (xz + wy) * sz;
<add> te[ 0 ] = ( 1 - ( yy + zz ) ) * sx;
<add> te[ 4 ] = ( xy - wz ) * sy;
<add> te[ 8 ] = ( xz + wy ) * sz;
<ide>
<del> te[ 1 ] = (xy + wz) * sx;
<del> te[ 5 ] = (1 - ( xx + zz )) * sy;
<del> te[ 9 ] = (yz - wx) * sz;
<add> te[ 1 ] = ( xy + wz ) * sx;
<add> te[ 5 ] = ( 1 - ( xx + zz ) ) * sy;
<add> te[ 9 ] = ( yz - wx ) * sz;
<ide>
<del> te[ 2 ] = (xz - wy) * sx;
<del> te[ 6 ] = (yz + wx) * sy;
<del> te[ 10 ] = (1 - ( xx + yy )) * sz;
<add> te[ 2 ] = ( xz - wy ) * sx;
<add> te[ 6 ] = ( yz + wx ) * sy;
<add> te[ 10 ] = ( 1 - ( xx + yy ) ) * sz;
<ide>
<ide> // last column
<ide> te[ 3 ] = 0;
<ide> Object.assign( Matrix4.prototype, {
<ide> te[ 15 ] = 1;
<ide>
<ide> return this;
<add>
<ide> },
<ide>
<ide> decompose: function () { | 1 |
Text | Text | fix typo in "isomorphic" and switches to universal | fd89143f539bb50b5354620cafe5f566441a0a22 | <ide><path>README.md
<ide> Read **[The Evolution of Flux Frameworks](https://medium.com/@dan_abramov/the-ev
<ide> * Everything (Stores, Action Creators, configuration) is hot reloadable.
<ide> * Preserves the benefits of Flux, but adds other nice properties thanks to its functional nature.
<ide> * Prevents some of the anti-patterns common in Flux code.
<del>* Works great in isomoprhic apps because it doesn't use singletons and the data can be rehydrated.
<add>* Works great in [universal (aka “isomorphic”)](https://medium.com/@mjackson/universal-javascript-4761051b7ae9) apps because it doesn't use singletons and the data can be rehydrated.
<ide> * Doesn't care how you store your data: you may use JS objects, arrays, ImmutableJS, etc.
<ide> * Under the hood, it keeps all your data in a tree, but you don't need to think about it.
<ide> * Lets you efficiently subscribe to finer-grained updates than individual Stores. | 1 |
Javascript | Javascript | fix bug with presslegacy blur | dbc7b9f50c9f4ff005c8ba6431adea9bec3d318a | <ide><path>packages/react-interactions/events/src/dom/PressLegacy.js
<ide> const pressResponderImpl = {
<ide> break;
<ide> }
<ide> case 'blur': {
<del> // If we encounter a blur event that moves focus to
<del> // the window, then the relatedTarget will be null.
<del> // In this case, we should cancel the active press.
<del> // Alternatively, if the blur target matches the
<del> // current pressed target, we should also cancel
<del> // the active press.
<del> if (
<del> isPressed &&
<del> (nativeEvent.relatedTarget === null || target === state.pressTarget)
<del> ) {
<add> // If we encounter a blur that happens on the pressed target
<add> // then disengage the blur.
<add> if (isPressed && target === state.pressTarget) {
<ide> dispatchCancel(event, context, props, state);
<ide> }
<ide> }
<ide><path>packages/react-interactions/events/src/dom/Tap.js
<ide> const rootEventTypes = hasPointerEvents
<ide> 'pointermove',
<ide> 'pointercancel',
<ide> 'scroll',
<add> 'blur',
<ide> ]
<ide> : [
<ide> 'click_active',
<ide> const rootEventTypes = hasPointerEvents
<ide> 'touchmove',
<ide> 'touchcancel',
<ide> 'scroll',
<add> 'blur',
<ide> ];
<ide>
<ide> /**
<ide> const responderImpl = {
<ide> removeRootEventTypes(context, state);
<ide> break;
<ide> }
<add> case 'blur': {
<add> // If we encounter a blur that happens on the pressed target
<add> // then disengage the blur.
<add> if (state.isActive && nativeEvent.target === state.responderTarget) {
<add> dispatchCancel(context, props, state);
<add> }
<add> }
<ide> }
<ide> },
<ide> onUnmount(
<ide><path>packages/react-interactions/events/src/dom/__tests__/Press-test.internal.js
<ide> describeWithPointerEvent('Press responder', hasPointerEvents => {
<ide> target.pointerup();
<ide> target.pointerdown();
<ide> });
<add>
<add> it('when blur occurs on a pressed target, we should disengage press', () => {
<add> const onPress = jest.fn();
<add> const onPressStart = jest.fn();
<add> const onPressEnd = jest.fn();
<add> const buttonRef = React.createRef();
<add>
<add> const Component = () => {
<add> const listener = usePress({onPress, onPressStart, onPressEnd});
<add> return <button ref={buttonRef} DEPRECATED_flareListeners={listener} />;
<add> };
<add> ReactDOM.render(<Component />, container);
<add>
<add> const target = createEventTarget(buttonRef.current);
<add> target.pointerdown();
<add> expect(onPressStart).toBeCalled();
<add> target.blur();
<add> expect(onPressEnd).toBeCalled();
<add> target.pointerup();
<add> expect(onPress).not.toBeCalled();
<add> });
<ide> });
<ide><path>packages/react-interactions/events/src/dom/__tests__/PressLegacy-test.internal.js
<ide> describe.each(environmentTable)('Press responder', hasPointerEvents => {
<ide> expect(onPressEnd).toBeCalled();
<ide> });
<ide>
<del> it('focus moving to the window should stop the press', () => {
<del> const onPress = jest.fn(e => e.preventDefault());
<del> const onPressStart = jest.fn(e => e.preventDefault());
<del> const onPressEnd = jest.fn(e => e.preventDefault());
<add> it('when blur occurs on a pressed target, we should disengage press', () => {
<add> const onPress = jest.fn();
<add> const onPressStart = jest.fn();
<add> const onPressEnd = jest.fn();
<ide> const buttonRef = React.createRef();
<ide>
<ide> const Component = () => {
<ide> describe.each(environmentTable)('Press responder', hasPointerEvents => {
<ide>
<ide> const target = createEventTarget(buttonRef.current);
<ide> target.pointerdown();
<del> const secondTarget = createEventTarget(document);
<del> // relatedTarget is null when moving focus to window
<ide> expect(onPressStart).toBeCalled();
<del> secondTarget.blur({relatedTarget: null});
<add> target.blur();
<ide> expect(onPressEnd).toBeCalled();
<ide> target.pointerup();
<ide> expect(onPress).not.toBeCalled(); | 4 |
Text | Text | fix incorrect alias and url | 9c0b3e1650ffe6f85376e1399a304204539d2495 | <ide><path>man/src/login.md
<ide> do not specify a `SERVER`, the command uses Docker's public registry located at
<ide> `docker login` requires user to use `sudo` or be `root`, except when:
<ide>
<ide> 1. connecting to a remote daemon, such as a `docker-machine` provisioned `docker engine`.
<del>2. user is added to the `docker` group. This will impact the security of your system; the `docker` group is `root` equivalent. See [Docker Daemon Attack Surface](https://docs.docker.com/engine/articles/security/#docker-daemon-attack-surface) for details.
<add>2. user is added to the `docker` group. This will impact the security of your system; the `docker` group is `root` equivalent. See [Docker Daemon Attack Surface](https://docs.docker.com/engine/security/security/#/docker-daemon-attack-surface) for details.
<ide>
<ide> You can log into any public or private repository for which you have
<ide> credentials. When you log in, the command stores encoded credentials in
<ide><path>man/src/unpause.md
<del>Alias for `docker container pause`.
<add>Alias for `docker container unpause`. | 2 |
Go | Go | remove redundant doupdatehostsfile() function | 350e303c7f0af8b3fd2d377faf56485862a7e8c3 | <ide><path>libnetwork/endpoint.go
<ide> func (ep *endpoint) sbJoin(sb *sandbox, options ...EndpointOption) (err error) {
<ide> n.getController().watchSvcRecord(ep)
<ide> }
<ide>
<del> if doUpdateHostsFile(n, sb) {
<add> // Do not update hosts file with internal networks endpoint IP
<add> if !n.ingress && n.Name() != libnGWNetwork {
<ide> var addresses []string
<ide> if ip := ep.getFirstInterfaceIPv4Address(); ip != nil {
<ide> addresses = append(addresses, ip.String())
<ide> func (ep *endpoint) sbJoin(sb *sandbox, options ...EndpointOption) (err error) {
<ide> return nil
<ide> }
<ide>
<del>func doUpdateHostsFile(n *network, sb *sandbox) bool {
<del> return !n.ingress && n.Name() != libnGWNetwork
<del>}
<del>
<ide> func (ep *endpoint) rename(name string) error {
<ide> var (
<ide> err error
<ide> func (ep *endpoint) rename(name string) error {
<ide> // benign error. Besides there is no meaningful recovery that
<ide> // we can do. When the cluster recovers subsequent EpCnt update
<ide> // will force the peers to get the correct EP name.
<del> n.getEpCnt().updateStore() // nolint:errcheck
<add> _ = n.getEpCnt().updateStore()
<ide>
<ide> return err
<ide> } | 1 |
Python | Python | add oauthauthentication class | 1aed9c1604be3db8f3f2d2de748eb6f7c574637a | <ide><path>rest_framework/authentication.py
<ide> from rest_framework.authtoken.models import Token
<ide> import base64
<ide>
<add>from django.core.exceptions import ImproperlyConfigured
<add>try:
<add> import oauth2
<add>except ImportError:
<add> oauth2 = None
<add>
<add>try:
<add> import oauth_provider
<add> from oauth_provider.store import store
<add>except ImportError:
<add> oauth_provider = None
<add>
<ide>
<ide> class BaseAuthentication(object):
<ide> """
<ide> def authenticate_header(self, request):
<ide> return 'Token'
<ide>
<ide>
<del># TODO: OAuthAuthentication
<add>class OAuthAuthentication(BaseAuthentication):
<add> """rest_framework OAuth authentication backend using
<add> django-oath-plus"""
<add> www_authenticate_realm = 'api'
<add> require_active = True
<add>
<add> def __init__(self, **kwargs):
<add> super(OAuthAuthentication, self).__init__(**kwargs)
<add>
<add> if oauth2 is None:
<add> raise ImproperlyConfigured("The 'python-oauth2' package could not be imported. It is required for use with the 'OAuthAuthentication' class.")
<add>
<add> if oauth_provider is None:
<add> raise ImproperlyConfigured("The 'django-oauth-plus' package could not be imported. It is required for use with the 'OAuthAuthentication' class.")
<add>
<add>
<add> def authenticate(self, request):
<add> """
<add> :returns: two-tuple of (user, auth) if authentication succeeds, or None otherwise.
<add> """
<add> from oauth_provider.store import store
<add> if self.is_valid_request(request):
<add> oauth_request = oauth_provider.utils.get_oauth_request(request)
<add>
<add> if not self.check_nonce(request, oauth_request):
<add> raise exceptions.AuthenticationFailed("Nonce check failed")
<add>
<add> try:
<add> consumer = store.get_consumer(request, oauth_request,
<add> oauth_request.get_parameter('oauth_consumer_key'))
<add> except oauth_provider.store.InvalidConsumerError, e:
<add> raise exceptions.AuthenticationFailed(e)
<add>
<add> if consumer.status != oauth_provider.consts.ACCEPTED:
<add> raise exceptions.AuthenticationFailed('Invalid consumer key status: %s' % consumer.get_status_display())
<add>
<add> try:
<add> token = store.get_access_token(request, oauth_request,
<add> consumer, oauth_request.get_parameter('oauth_token'))
<add>
<add> except oauth_provider.store.InvalidTokenError:
<add> raise exceptions.AuthenticationFailed(
<add> 'Invalid access token: %s' % oauth_request.get_parameter('oauth_token'))
<add>
<add> try:
<add> self.validate_token(request, consumer, token)
<add> except oauth2.Error, e:
<add> print "got e"
<add> raise exceptions.AuthenticationFailed(e.message)
<add>
<add> if not self.check_active(token.user):
<add> raise exceptions.AuthenticationFailed('User not active: %s' % token.user.username)
<add>
<add> if consumer and token:
<add> request.user = token.user
<add> return (request.user, None)
<add>
<add> raise exceptions.AuthenticationFailed(
<add> 'You are not allowed to access this resource.')
<add>
<add> return None
<add>
<add> def authenticate_header(self, request):
<add> return 'OAuth realm="%s"' % self.www_authenticate_realm
<add>
<add> def is_in(self, params):
<add> """
<add> Checks to ensure that all the OAuth parameter names are in the
<add> provided ``params``.
<add> """
<add> from oauth_provider.consts import OAUTH_PARAMETERS_NAMES
<add>
<add> for param_name in OAUTH_PARAMETERS_NAMES:
<add> if param_name not in params:
<add> return False
<add>
<add> return True
<add>
<add> def is_valid_request(self, request):
<add> """
<add> Checks whether the required parameters are either in the HTTP
<add> ``Authorization`` header sent by some clients (the preferred method
<add> according to OAuth spec) or fall back to ``GET/POST``.
<add> """
<add> auth_params = request.META.get("HTTP_AUTHORIZATION", [])
<add> return self.is_in(auth_params) or self.is_in(request.REQUEST)
<add>
<add> def validate_token(self, request, consumer, token):
<add> oauth_server, oauth_request = oauth_provider.utils.initialize_server_request(request)
<add> return oauth_server.verify_request(oauth_request, consumer, token)
<add>
<add> def check_active(self, user):
<add> """
<add> Ensures the user has an active account.
<add>
<add> Optimized for the ``django.contrib.auth.models.User`` case.
<add> """
<add> if not self.require_active:
<add> # Ignore & move on.
<add> return True
<add>
<add> return user.is_active
<add>
<add> def check_nonce(self, request, oauth_request):
<add> """Checks nonce of request"""
<add> return store.check_nonce(request, oauth_request, oauth_request['oauth_nonce']) | 1 |
PHP | PHP | apply fixes from styleci | 972538f7071e73dcff429c1cb0ec143d66d82dc1 | <ide><path>tests/Integration/Support/Fixtures/MultipleInstanceManager.php
<ide> class MultipleInstanceManager extends BaseMultipleInstanceManager
<ide>
<ide> protected function createFooDriver(array $config)
<ide> {
<del> return new class($config) {
<add> return new class($config)
<add> {
<ide> public $config;
<ide>
<ide> public function __construct($config)
<ide> public function __construct($config)
<ide>
<ide> protected function createBarDriver(array $config)
<ide> {
<del> return new class($config) {
<add> return new class($config)
<add> {
<ide> public $config;
<ide>
<ide> public function __construct($config)
<ide> public function getInstanceConfig($name)
<ide> case 'foo':
<ide> return [
<ide> 'driver' => 'foo',
<del> 'foo-option' => 'option-value'
<add> 'foo-option' => 'option-value',
<ide> ];
<ide> case 'bar':
<ide> return [
<ide> 'driver' => 'bar',
<del> 'bar-option' => 'option-value'
<add> 'bar-option' => 'option-value',
<ide> ];
<ide> default:
<ide> return []; | 1 |
Javascript | Javascript | remove links to web archive from source | e24f2dcf3f6bda1a672502e0233c732065cbbe89 | <ide><path>src/attributes/prop.js
<ide> jQuery.extend( {
<ide> // Support: IE <=9 - 11+
<ide> // elem.tabIndex doesn't always return the
<ide> // correct value when it hasn't been explicitly set
<del> // https://web.archive.org/web/20141116233347/http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
<ide> // Use proper attribute retrieval (trac-12072)
<ide> var tabindex = elem.getAttribute( "tabindex" );
<ide>
<ide><path>src/queue/delay.js
<ide> import "../queue.js";
<ide> import "../effects.js"; // Delay is optional because of this dependency
<ide>
<ide> // Based off of the plugin by Clint Helfers, with permission.
<del>// https://web.archive.org/web/20100324014747/http://blindsignals.com/index.php/2009/07/jquery-delay/
<ide> jQuery.fn.delay = function( time, type ) {
<ide> time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time;
<ide> type = type || "fx"; | 2 |
Python | Python | allow hyphens in pod id used by k8s executor | 0438628ffd231adc73b633d6cfb28344c984d194 | <ide><path>airflow/kubernetes/kubernetes_helper_functions.py
<ide> log = logging.getLogger(__name__)
<ide>
<ide>
<del>def _strip_unsafe_kubernetes_special_chars(string: str) -> str:
<del> """
<del> Kubernetes only supports lowercase alphanumeric characters, "-" and "." in
<del> the pod name.
<del> However, there are special rules about how "-" and "." can be used so let's
<del> only keep
<del> alphanumeric chars see here for detail:
<del> https://kubernetes.io/docs/concepts/overview/working-with-objects/names/
<del>
<del> :param string: The requested Pod name
<del> :return: Pod name stripped of any unsafe characters
<del> """
<del> return slugify(string, separator="", lowercase=True)
<del>
<del>
<del>def create_pod_id(dag_id: str, task_id: str) -> str:
<add>def create_pod_id(dag_id: str | None = None, task_id: str | None = None) -> str:
<ide> """
<ide> Generates the kubernetes safe pod_id. Note that this is
<ide> NOT the full ID that will be launched to k8s. We will add a uuid
<ide> def create_pod_id(dag_id: str, task_id: str) -> str:
<ide> :param task_id: Task ID
<ide> :return: The non-unique pod_id for this task/DAG pairing
<ide> """
<del> safe_dag_id = _strip_unsafe_kubernetes_special_chars(dag_id)
<del> safe_task_id = _strip_unsafe_kubernetes_special_chars(task_id)
<del> return safe_dag_id + safe_task_id
<add> name = ""
<add> if dag_id:
<add> name += dag_id
<add> if task_id:
<add> if name:
<add> name += "-"
<add> name += task_id
<add> return slugify(name, lowercase=True)[:253].strip("-.")
<ide>
<ide>
<ide> def annotations_to_key(annotations: dict[str, str]) -> TaskInstanceKey:
<ide><path>tests/kubernetes/test_kubernetes_helper_functions.py
<add># Licensed to the Apache Software Foundation (ASF) under one
<add># or more contributor license agreements. See the NOTICE file
<add># distributed with this work for additional information
<add># regarding copyright ownership. The ASF licenses this file
<add># to you under the Apache License, Version 2.0 (the
<add># "License"); you may not use this file except in compliance
<add># with the License. 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,
<add># software distributed under the License is distributed on an
<add># "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
<add># KIND, either express or implied. See the License for the
<add># specific language governing permissions and limitations
<add># under the License.
<add>
<add>from __future__ import annotations
<add>
<add>import re
<add>
<add>import pytest
<add>
<add>from airflow.kubernetes.kubernetes_helper_functions import create_pod_id
<add>
<add>pod_name_regex = r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$"
<add>
<add>
<add>@pytest.mark.parametrize(
<add> "val, expected",
<add> [
<add> ("task-id", "task-id"), # no problem
<add> ("task_id", "task-id"), # underscores
<add> ("---task.id---", "task-id"), # dots
<add> (".task.id", "task-id"), # leading dot invalid
<add> ("**task.id", "task-id"), # leading dot invalid
<add> ("-90Abc*&", "90abc"), # invalid ends
<add> ("90AçLbˆˆç˙ßߘ˜˙c*a", "90aclb-c-ssss-c-a"), # weird unicode
<add> ],
<add>)
<add>def test_create_pod_id_task_only(val, expected):
<add> actual = create_pod_id(task_id=val)
<add> assert actual == expected
<add> assert re.match(pod_name_regex, actual)
<add>
<add>
<add>@pytest.mark.parametrize(
<add> "val, expected",
<add> [
<add> ("dag-id", "dag-id"), # no problem
<add> ("dag_id", "dag-id"), # underscores
<add> ("---dag.id---", "dag-id"), # dots
<add> (".dag.id", "dag-id"), # leading dot invalid
<add> ("**dag.id", "dag-id"), # leading dot invalid
<add> ("-90Abc*&", "90abc"), # invalid ends
<add> ("90AçLbˆˆç˙ßߘ˜˙c*a", "90aclb-c-ssss-c-a"), # weird unicode
<add> ],
<add>)
<add>def test_create_pod_id_dag_only(val, expected):
<add> actual = create_pod_id(dag_id=val)
<add> assert actual == expected
<add> assert re.match(pod_name_regex, actual)
<add>
<add>
<add>@pytest.mark.parametrize(
<add> "dag_id, task_id, expected",
<add> [
<add> ("dag-id", "task-id", "dag-id-task-id"), # no problem
<add> ("dag_id", "task_id", "dag-id-task-id"), # underscores
<add> ("dag.id", "task.id", "dag-id-task-id"), # dots
<add> (".dag.id", ".---task.id", "dag-id-task-id"), # leading dot invalid
<add> ("**dag.id", "**task.id", "dag-id-task-id"), # leading dot invalid
<add> ("-90Abc*&", "-90Abc*&", "90abc-90abc"), # invalid ends
<add> ("90AçLbˆˆç˙ßߘ˜˙c*a", "90AçLbˆˆç˙ßߘ˜˙c*a", "90aclb-c-ssss-c-a-90aclb-c-ssss-c-a"), # ugly
<add> ],
<add>)
<add>def test_create_pod_id_dag_and_task(dag_id, task_id, expected):
<add> actual = create_pod_id(dag_id=dag_id, task_id=task_id)
<add> assert actual == expected
<add> assert re.match(pod_name_regex, actual)
<add>
<add>
<add>def test_create_pod_id_dag_too_long():
<add> actual = create_pod_id("0" * 254)
<add> assert actual == "0" * 253
<add> assert re.match(pod_name_regex, actual) | 2 |
Ruby | Ruby | use hash like syntax for internalmetadata | de2cb20117af68cef4126d8998cc63e178c58187 | <ide><path>activerecord/lib/active_record/internal_metadata.rb
<ide> module ActiveRecord
<ide> # This class is used to create a table that keeps track of values and keys such
<ide> # as which environment migrations were run in.
<del> class InternalMetadata < ActiveRecord::Base
<add> class InternalMetadata < ActiveRecord::Base # :nodoc:
<ide> class << self
<ide> def primary_key
<ide> "key"
<ide> def index_name
<ide> "#{table_name_prefix}unique_#{ActiveRecord::Base.internal_metadata_table_name}#{table_name_suffix}"
<ide> end
<ide>
<del> def store(hash)
<del> hash.each do |key, value|
<del> first_or_initialize(key: key).update_attributes!(value: value)
<del> end
<add> def []=(key, value)
<add> first_or_initialize(key: key).update_attributes!(value: value)
<ide> end
<ide>
<del> def value_for(key)
<add> def [](key)
<ide> where(key: key).pluck(:value).first
<ide> end
<ide>
<ide><path>activerecord/lib/active_record/migration.rb
<ide> def record_version_state_after_migrating(version)
<ide> else
<ide> migrated << version
<ide> ActiveRecord::SchemaMigration.create!(version: version.to_s)
<del> ActiveRecord::InternalMetadata.store(environment: current_environment)
<add> ActiveRecord::InternalMetadata[:environment] = ActiveRecord::Migrator.current_environment
<ide> end
<ide> end
<ide>
<ide> def self.last_stored_environment
<del> ActiveRecord::InternalMetadata.value_for(:environment)
<add> ActiveRecord::InternalMetadata[:environment]
<ide> end
<ide>
<del> def current_environment
<add> def self.current_environment
<ide> ActiveRecord::ConnectionHandling::DEFAULT_ENV.call
<ide> end
<ide>
<ide><path>activerecord/lib/active_record/schema.rb
<ide> def define(info, &block) # :nodoc:
<ide> end
<ide>
<ide> ActiveRecord::InternalMetadata.create_table
<del> ActiveRecord::InternalMetadata.store("environment" => ActiveRecord::ConnectionHandling::DEFAULT_ENV.call)
<add> ActiveRecord::InternalMetadata[:environment] = ActiveRecord::Migrator.current_environment
<ide> end
<ide>
<ide> private
<ide><path>activerecord/lib/active_record/tasks/database_tasks.rb
<ide> def load_schema(configuration, format = ActiveRecord::Base.schema_format, file =
<ide> raise ArgumentError, "unknown format #{format.inspect}"
<ide> end
<ide> ActiveRecord::InternalMetadata.create_table
<del> ActiveRecord::InternalMetata.store("environment" => ActiveRecord::ConnectionHandling::DEFAULT_ENV.call)
<add> ActiveRecord::InternalMetadata[:environment] = ActiveRecord::Migrator.current_environment
<ide> end
<ide>
<ide> def load_schema_for(*args)
<ide><path>activerecord/test/cases/migration_test.rb
<ide> def test_internal_metadata_stores_environment
<ide> old_path = ActiveRecord::Migrator.migrations_paths
<ide> ActiveRecord::Migrator.migrations_paths = migrations_path
<ide>
<del> assert_equal current_env, ActiveRecord::InternalMetadata.value_for("environment")
<add> assert_equal current_env, ActiveRecord::InternalMetadata[:environment]
<ide>
<ide> original_rails_env = ENV["RAILS_ENV"]
<ide> original_rack_env = ENV["RACK_ENV"]
<ide> def test_internal_metadata_stores_environment
<ide>
<ide> sleep 1 # mysql by default does not store fractional seconds in the database
<ide> ActiveRecord::Migrator.up(migrations_path)
<del> assert_equal new_env, ActiveRecord::InternalMetadata.value_for("environment")
<add> assert_equal new_env, ActiveRecord::InternalMetadata[:environment]
<ide> ensure
<ide> ActiveRecord::Migrator.migrations_paths = old_path
<ide> ENV["RAILS_ENV"] = original_rails_env
<ide><path>activerecord/test/cases/tasks/database_tasks_test.rb
<ide> def test_raises_an_error_when_called_with_protected_environment
<ide> ActiveRecord::Migrator.stubs(:current_version).returns(1)
<ide>
<ide> protected_environments = ActiveRecord::Base.protected_environments.dup
<del> current_env = ActiveRecord::ConnectionHandling::DEFAULT_ENV.call
<add> current_env = ActiveRecord::Migrator.current_environment
<ide> assert !protected_environments.include?(current_env)
<ide> # Assert no error
<ide> ActiveRecord::Tasks::DatabaseTasks.check_protected_environments! | 6 |
Ruby | Ruby | use xml instead already parsed xml | e04d9538ea19e4032f25a3e5818a884b7dd602ea | <ide><path>activesupport/test/xml_mini/nokogiri_engine_test.rb
<ide> def test_children_with_blank_text_and_attribute
<ide> private
<ide> def assert_equal_rexml(xml)
<ide> parsed_xml = XmlMini.parse(xml)
<del> hash = XmlMini.with_backend('REXML') { XmlMini.parse(parsed_xml) }
<add> hash = XmlMini.with_backend('REXML') { XmlMini.parse(xml) }
<ide> assert_equal(hash, parsed_xml)
<ide> end
<ide> end | 1 |
Javascript | Javascript | remove extraneous call to `$parse` in `$evalasync` | 71f437c15a606b542536e70c392808e84d982078 | <ide><path>src/ng/rootScope.js
<ide> function $RootScopeProvider() {
<ide> current = target;
<ide>
<ide> // It's safe for asyncQueuePosition to be a local variable here because this loop can't
<del> // be reentered recursively. Calling $digest from a function passed to $applyAsync would
<add> // be reentered recursively. Calling $digest from a function passed to $evalAsync would
<ide> // lead to a '$digest already in progress' error.
<ide> for (var asyncQueuePosition = 0; asyncQueuePosition < asyncQueue.length; asyncQueuePosition++) {
<ide> try {
<ide> asyncTask = asyncQueue[asyncQueuePosition];
<del> asyncTask.scope.$eval(asyncTask.expression, asyncTask.locals);
<add> fn = asyncTask.fn;
<add> fn(asyncTask.scope, asyncTask.locals);
<ide> } catch (e) {
<ide> $exceptionHandler(e);
<ide> }
<ide> function $RootScopeProvider() {
<ide> });
<ide> }
<ide>
<del> asyncQueue.push({scope: this, expression: $parse(expr), locals: locals});
<add> asyncQueue.push({scope: this, fn: $parse(expr), locals: locals});
<ide> },
<ide>
<ide> $$postDigest: function(fn) {
<ide><path>test/ng/rootScopeSpec.js
<ide> describe('Scope', function() {
<ide> expect(childScope.$$asyncQueue).toBe($rootScope.$$asyncQueue);
<ide> expect(isolateScope.$$asyncQueue).toBeUndefined();
<ide> expect($rootScope.$$asyncQueue).toEqual([
<del> {scope: $rootScope, expression: $parse('rootExpression'), locals: undefined},
<del> {scope: childScope, expression: $parse('childExpression'), locals: undefined},
<del> {scope: isolateScope, expression: $parse('isolateExpression'), locals: undefined}
<add> {scope: $rootScope, fn: $parse('rootExpression'), locals: undefined},
<add> {scope: childScope, fn: $parse('childExpression'), locals: undefined},
<add> {scope: isolateScope, fn: $parse('isolateExpression'), locals: undefined}
<ide> ]);
<ide> }));
<ide>
<ide> describe('Scope', function() {
<ide> expect(log).toEqual(['eval-ed 1!', 'eval-ed 2!']);
<ide> });
<ide> });
<add>
<add> it('should not pass anything as `this` to scheduled functions', inject(function($rootScope) {
<add> var this1 = {};
<add> var this2 = (function() { return this; })();
<add> $rootScope.$evalAsync(function() { this1 = this; });
<add> $rootScope.$digest();
<add> expect(this1).toEqual(this2);
<add> }));
<ide> });
<ide>
<ide> | 2 |
Javascript | Javascript | add day marker character for japanese.update test | 0bb5c4ea5e7953294a436fb25b1feefe3bf4a69f | <ide><path>src/test/locale/ja.js
<ide> test('format', function (assert) {
<ide> ['ddd, Ah', '日, 午後3'],
<ide> ['M Mo MM MMMM MMM', '2 2 02 2月 2月'],
<ide> ['YYYY YY', '2010 10'],
<del> ['D Do DD', '14 14 14'],
<add> ['D Do DD', '14 14日 14'],
<ide> ['d do dddd ddd dd', '0 0 日曜日 日 日'],
<del> ['DDD DDDo DDDD', '45 45 045'],
<add> ['DDD DDDo DDDD', '45 45日 045'],
<ide> ['w wo ww', '8 8 08'],
<ide> ['h hh', '3 03'],
<ide> ['H HH', '15 15'], | 1 |
Javascript | Javascript | fix remaining issues in the browsing history | a4343436c7993b93ad626d184b06c5b3de3b2e06 | <ide><path>web/viewer.js
<ide> var PDFFindBar = {
<ide>
<ide> var PDFHistory = {
<ide> initialized: false,
<del> allowHashChange: true,
<ide> initialDestination: null,
<ide>
<del> initialize: function pdfHistoryInitialize(params, fingerprint) {
<add> initialize: function pdfHistoryInitialize(fingerprint) {
<ide> if (HISTORY_DISABLED || window.parent !== window) {
<ide> // The browsing history is only enabled when the viewer is standalone,
<ide> // i.e. not when it is embedded in a page.
<ide> return;
<ide> }
<ide> this.initialized = true;
<ide> this.reInitialized = false;
<add> this.allowHashChange = true;
<ide> this.historyUnlocked = true;
<ide>
<del> this.previousHash = '';
<add> this.previousHash = window.location.hash.substring(1);
<ide> this.currentBookmark = '';
<del> this.currentPage = 1;
<add> this.currentPage = 0;
<add> this.updatePreviousBookmark = false;
<add> this.previousBookmark = '';
<add> this.nextHashParam = '';
<ide>
<ide> this.fingerprint = fingerprint;
<ide> this.currentUid = this.uid = 0;
<ide> var PDFHistory = {
<ide> // is opened in the web viewer.
<ide> this.reInitialized = true;
<ide> }
<del> this._pushToHistory(params, false, true);
<add> window.history.replaceState({ fingerprint: this.fingerprint }, '', '');
<ide> }
<ide>
<ide> var self = this;
<ide> window.addEventListener('popstate', function pdfHistoryPopstate(evt) {
<ide> evt.preventDefault();
<ide> evt.stopPropagation();
<ide>
<add> if (!self.historyUnlocked) {
<add> return;
<add> }
<ide> if (evt.state) {
<add> // Move back/forward in the history.
<ide> self._goTo(evt.state);
<ide> } else {
<add> // Handle the user modifying the hash of a loaded document.
<ide> self.previousHash = window.location.hash.substring(1);
<add> if (self.uid === 0) {
<add> var previousParams = (self.previousHash && self.currentBookmark &&
<add> self.previousHash !== self.currentBookmark) ?
<add> { hash: self.currentBookmark } : { page: 1 };
<add> self.historyUnlocked = false;
<add> self.allowHashChange = false;
<add> window.history.back();
<add> self._pushToHistory(previousParams, false, true);
<add> window.history.forward();
<add> self.historyUnlocked = true;
<add> }
<ide> self._pushToHistory({ hash: self.previousHash }, false, true);
<add> if (self.currentBookmark) {
<add> self.previousBookmark = self.currentBookmark;
<add> }
<ide> }
<ide> }, false);
<ide>
<ide> window.addEventListener('beforeunload',
<ide> function pdfHistoryBeforeunload(evt) {
<del> if (self._shouldPreviousPositionBeAddedToHistory(true)) {
<del> var previousParams = self._getPreviousParams();
<del> if (previousParams) {
<del> self._pushToHistory(previousParams, false);
<del> }
<add> var previousParams = self._getPreviousParams(null, true);
<add> if (previousParams) {
<add> self._pushToHistory(previousParams, false);
<ide> }
<ide> if (PDFView.isPresentationMode) {
<ide> // Prevent the user from accidentally navigating away from
<ide> var PDFHistory = {
<ide> },
<ide>
<ide> get isHashChangeUnlocked() {
<add> if (!this.initialized) {
<add> return true;
<add> }
<ide> // If the current hash changes when moving back/forward in the history,
<ide> // this will trigger a 'popstate' event *as well* as a 'hashchange' event.
<ide> // Since the hash generally won't correspond to the exact the position
<ide> // stored in the history's state object, triggering the 'hashchange' event
<del> // would corrupt the browser history.
<add> // can thus corrupt the browser history.
<ide> //
<ide> // When the hash changes during a 'popstate' event, we *only* prevent the
<ide> // first 'hashchange' event and immediately reset allowHashChange.
<ide> var PDFHistory = {
<ide> if (this.initialized) {
<ide> this.currentBookmark = bookmark.substring(1);
<ide> this.currentPage = pageNum | 0;
<add> if (this.updatePreviousBookmark) {
<add> this.previousBookmark = this.currentBookmark;
<add> this.updatePreviousBookmark = false;
<add> }
<add> }
<add> },
<add>
<add> updateNextHashParam: function pdfHistoryUpdateNextHashParam(param) {
<add> if (this.initialized) {
<add> this.nextHashParam = param;
<ide> }
<ide> },
<ide>
<del> push: function pdfHistoryPush(params) {
<add> push: function pdfHistoryPush(params, isInitialBookmark) {
<ide> if (!(this.initialized && this.historyUnlocked)) {
<ide> return;
<ide> }
<ide> if (params.dest && !params.hash) {
<del> params.hash = (this.current.dest === params.dest && this.current.hash) ?
<add> params.hash = (this.current.hash && this.current.dest &&
<add> this.current.dest === params.dest) ?
<ide> this.current.hash :
<ide> PDFView.getDestinationHash(params.dest).split('#')[1];
<ide> }
<ide> if (params.page) {
<ide> params.page |= 0;
<ide> }
<add> if (isInitialBookmark && this.uid === 0) {
<add> this._pushToHistory(params, false);
<add> this.previousHash = window.location.hash.substring(1);
<add> this.updatePreviousBookmark = this.nextHashParam ? false : true;
<add> return;
<add> }
<add> if (this.nextHashParam && this.nextHashParam === params.hash) {
<add> this.nextHashParam = null;
<add> this.updatePreviousBookmark = true;
<add> return;
<add> }
<add>
<ide> if (params.hash) {
<ide> if (this.current.hash) {
<ide> if (this.current.hash !== params.hash) {
<ide> this._pushToHistory(params, true);
<ide> } else if (!this.current.page && params.page) {
<del> this._pushToHistory(params, false, true, true);
<add> this._pushToHistory(params, false, true);
<ide> }
<ide> } else {
<ide> this._pushToHistory(params, true);
<ide> }
<del> } else if (this.current.page && this.current.page !== params.page) {
<add> } else if (this.current.page && params.page &&
<add> this.current.page !== params.page) {
<ide> this._pushToHistory(params, true);
<ide> }
<ide> },
<ide>
<del> _stateObj: function pdfHistory_stateObj(params) {
<del> return { fingerprint: this.fingerprint, uid: this.uid, target: params };
<del> },
<del>
<del> _shouldPreviousPositionBeAddedToHistory:
<del> function pdfHistory_shouldPreviousPositionBeAddedToHistory(onUnload) {
<add> _getPreviousParams: function pdfHistory_getPreviousParams(onlyCheckPage,
<add> beforeUnload) {
<ide> if (!(this.currentBookmark && this.currentPage)) {
<del> return false;
<del> }
<del> if (this.previousHash && this.previousHash === this.current.hash) {
<del> return false;
<add> return null;
<ide> }
<del> if (!this.current.dest) {
<del> if (this.current.hash === this.currentBookmark) {
<del> return false;
<del> } else if (onUnload) {
<del> return true;
<add> if ((!this.current.dest && !onlyCheckPage) || beforeUnload) {
<add> if (this.previousBookmark === this.currentBookmark) {
<add> return null;
<ide> }
<del> } else if (this.current.page && this.current.page === this.currentPage) {
<del> return false;
<add> } else if (this.current.page) {
<add> if (this.current.page === this.currentPage) {
<add> return null;
<add> }
<add> } else {
<add> return null;
<ide> }
<del> return true;
<del> },
<del>
<del> _getPreviousParams: function pdfHistory_getPreviousParams() {
<del> var previousParams = { hash: this.currentBookmark,
<del> page: this.currentPage };
<add> var params = { hash: this.currentBookmark, page: this.currentPage };
<ide> if (PDFView.isPresentationMode) {
<del> if (this.current.page && this.current.page !== this.currentPage) {
<del> previousParams.hash = null;
<del> } else {
<del> previousParams = null;
<del> }
<add> params.hash = null;
<ide> }
<del> return previousParams;
<add> return params;
<add> },
<add>
<add> _stateObj: function pdfHistory_stateObj(params) {
<add> return { fingerprint: this.fingerprint, uid: this.uid, target: params };
<ide> },
<ide>
<ide> _pushToHistory: function pdfHistory_pushToHistory(params,
<ide> var PDFHistory = {
<ide> if (!params.hash && params.page) {
<ide> params.hash = ('page=' + params.page);
<ide> }
<del> if (overwrite) {
<add> if (addPrevious && !overwrite) {
<add> var previousParams = this._getPreviousParams();
<add> if (previousParams) {
<add> this._pushToHistory(previousParams, false);
<add> }
<add> }
<add> if (overwrite || this.uid === 0) {
<ide> window.history.replaceState(this._stateObj(params), '', '');
<ide> } else {
<del> if (addPrevious && this._shouldPreviousPositionBeAddedToHistory()) {
<del> var previousParams = this._getPreviousParams();
<del> if (previousParams) {
<del> this._pushToHistory(previousParams, false);
<del> }
<del> }
<ide> window.history.pushState(this._stateObj(params), '', '');
<ide> }
<ide> this.currentUid = this.uid++;
<ide> this.current = params;
<add> this.updatePreviousBookmark = true;
<ide> },
<ide>
<ide> _goTo: function pdfHistory_goTo(state) {
<ide> if (!(this.initialized && this.historyUnlocked &&
<ide> this._isStateObjectDefined(state))) {
<ide> return;
<ide> }
<del> if (!this.reInitialized && state.uid < this.currentUid &&
<del> this.currentBookmark && this.currentPage &&
<del> this.current.page && this.current.page !== this.currentPage) {
<del> var previousParams = this._getPreviousParams();
<add> if (!this.reInitialized && state.uid < this.currentUid) {
<add> var previousParams = this._getPreviousParams(true);
<ide> if (previousParams) {
<del> this._pushToHistory(this.current, false, false);
<add> this._pushToHistory(this.current, false);
<ide> this._pushToHistory(previousParams, false);
<del>
<add> this.currentUid = state.uid;
<ide> window.history.back();
<ide> return;
<ide> }
<ide> var PDFHistory = {
<ide> this.uid = state.uid;
<ide> }
<ide> this.current = state.target;
<add> this.updatePreviousBookmark = true;
<ide>
<ide> var currentHash = window.location.hash.substring(1);
<ide> if (this.previousHash !== currentHash) {
<ide> var PDFView = {
<ide>
<ide> var storePromise = store.initializedPromise;
<ide> PDFJS.Promise.all([firstPagePromise, storePromise]).then(function() {
<del> var storedHash = null, pageNum;
<add> var storedHash = null;
<ide> if (store.get('exists', false)) {
<del> pageNum = store.get('page', '1');
<add> var pageNum = store.get('page', '1');
<ide> var zoom = store.get('zoom', PDFView.currentScale);
<ide> var left = store.get('scrollLeft', '0');
<ide> var top = store.get('scrollTop', '0');
<ide> var PDFView = {
<ide> left + ',' + top;
<ide> }
<ide> // Initialize the browsing history.
<del> PDFHistory.initialize({ hash: storedHash, page: (pageNum || 1) },
<del> PDFView.documentFingerprint);
<add> PDFHistory.initialize(self.documentFingerprint);
<ide>
<ide> self.setInitialView(storedHash, scale);
<ide>
<ide> var PDFView = {
<ide> PDFHistory.initialDestination = null;
<ide> } else if (this.initialBookmark) {
<ide> this.setHash(this.initialBookmark);
<add> PDFHistory.push({ hash: this.initialBookmark }, !!this.initialBookmark);
<ide> this.initialBookmark = null;
<ide> } else if (storedHash) {
<ide> this.setHash(storedHash);
<ide> var PDFView = {
<ide> if (!hash)
<ide> return;
<ide>
<del> var pageNumber;
<ide> if (hash.indexOf('=') >= 0) {
<ide> var params = PDFView.parseQueryString(hash);
<ide> // borrowing syntax from "Parameters for Opening PDF Files"
<ide> if ('nameddest' in params) {
<add> PDFHistory.updateNextHashParam(params.nameddest);
<ide> PDFView.navigateTo(params.nameddest);
<ide> return;
<ide> }
<ide> if ('page' in params) {
<del> pageNumber = (params.page | 0) || 1;
<add> var pageNumber = (params.page | 0) || 1;
<ide> if ('zoom' in params) {
<ide> var zoomArgs = params.zoom.split(','); // scale,left,top
<ide> // building destination array
<ide> var PDFView = {
<ide> }
<ide> }
<ide> } else if (/^\d+$/.test(hash)) { // page number
<del> this.page = pageNumber = hash;
<del> } else // named destination
<add> this.page = hash;
<add> } else { // named destination
<add> PDFHistory.updateNextHashParam(unescape(hash));
<ide> PDFView.navigateTo(unescape(hash));
<del>
<del> // Update the browsing history.
<del> PDFHistory.push({ hash: hash, page: pageNumber });
<add> }
<ide> },
<ide>
<ide> switchSidebarView: function pdfViewSwitchSidebarView(view) { | 1 |
Text | Text | add guide for seo with gatsby.js | 6f65ba62d8d5c3868c88a5b382aa717506f5c9af | <ide><path>guide/english/gatsbyjs/gatsbyjs-seo/index.md
<add>---
<add>title: Gatsby.js SEO
<add>---
<add>
<add>## SEO with Gatsby
<add>
<add>Gatsby helps your site place better in search engines. Some advantages come out of the box and some require configuration.
<add>
<add>### Server rendering
<add>
<add>Because Gatsby pages are server-rendered, all the page content is available to Google and other search engines or crawlers.
<add>
<add>### Speed boost
<add>
<add>Gatsby’s many built-in performance optimizations, such as rendering to static files, progressive image loading, and the PRPL pattern—all help your site be lightning-fast by default.
<add>
<add>### Page metadata
<add>
<add>Metadata to pages, such as page title and description, helps search engines understand your content and when to show your pages in search results. With Gatsby, a common way to add metadata pages is to add [react-helmet](https://github.com/nfl/react-helmet) together with [Gatsby React Helmet plugin](https://www.gatsbyjs.org/docs/seo/) for Server side rending (SSR) support.
<add>
<add>### More Information:
<add>Check out the Gatsby.js official docs for SEO at [Gatsby Search Engine Optimization](https://www.gatsbyjs.org/docs/seo). For more information and learn more, visit: [Gatsby.js official site](https://www.gatsbyjs.org/tutorial/) | 1 |
Javascript | Javascript | remove unnecessary linter comment | 0fdd23fa3fc794a64718e1b761b2ef5efa864ecd | <ide><path>test/parallel/test-fs-utimes.js
<ide> fs.writeFileSync(path, '');
<ide>
<ide> // Test Y2K38 for all platforms [except 'arm', 'OpenBSD' and 'SunOS']
<ide> if (!process.arch.includes('arm') && !common.isOpenBSD && !common.isSunOS) {
<del> // because 2 ** 31 doesn't look right
<del> // eslint-disable-next-line space-infix-ops
<del> const Y2K38_mtime = 2**31;
<add> const Y2K38_mtime = 2 ** 31;
<ide> fs.utimesSync(path, Y2K38_mtime, Y2K38_mtime);
<ide> const Y2K38_stats = fs.statSync(path);
<ide> assert.strictEqual(Y2K38_mtime, Y2K38_stats.mtime.getTime() / 1000); | 1 |
PHP | PHP | apply fixes from styleci | 9165096f4458f8ab3cfbd4d6bd32479594a2161c | <ide><path>src/Illuminate/Container/Container.php
<ide> use ArrayAccess;
<ide> use LogicException;
<ide> use ReflectionClass;
<del>use ReflectionMethod;
<ide> use ReflectionFunction;
<ide> use ReflectionParameter;
<del>use InvalidArgumentException;
<ide> use Illuminate\Contracts\Container\BindingResolutionException;
<ide> use Illuminate\Contracts\Container\Container as ContainerContract;
<ide>
<ide><path>src/Illuminate/Container/MethodCaller.php
<ide>
<ide> namespace Illuminate\Container;
<ide>
<del>use LogicException;
<del>use ReflectionClass;
<ide> use ReflectionMethod;
<ide> use ReflectionFunction;
<del>use ReflectionParameter;
<ide> use InvalidArgumentException;
<ide>
<ide> class MethodCaller | 2 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.