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 |
|---|---|---|---|---|---|
Text | Text | add model card for berteus | 47e1334c0b56007c9d222e029db27fd2fdfccbb2 | <ide><path>model_cards/ixa-ehu/berteus-base-cased/README.md
<add>---
<add>language:
<add>- basque
<add>---
<add>
<add># BERTeus base cased
<add>
<add>This is the Basque language pretrained model presented in [Give your Text Representation Models some Love: the Case for Basque](https://arxiv.org/pdf/2004.00033.pdf). This model has been trained on a Basque corpus comprising Basque crawled news articles from online newspapers and the Basque Wikipedia. The training corpus contains 224.6 million tokens, of which 35 million come from the Wikipedia.
<add>
<add>BERTeus has been tested on four different downstream tasks for Basque: part-of-speech (POS) tagging, named entity recognition (NER), sentiment analysis and topic classification; improving the state of the art for all tasks. See summary of results below:
<add>
<add>
<add>| Downstream task | BERTeus | mBERT | Previous SOTA |
<add>| --------------- | ------- | ------| ------------- |
<add>| Topic Classification | **76.77** | 68.42 | 63.00 |
<add>| Sentiment | **78.10** | 71.02 | 74.02 |
<add>| POS | **97.76** | 96.37 | 96.10 |
<add>| NER | **87.06** | 81.52 | 76.72 |
<add>
<add>
<add>If using this model, please cite the following paper:
<add>```
<add>@inproceedings{agerri2020give,
<add> title={Give your Text Representation Models some Love: the Case for Basque},
<add> author={Rodrigo Agerri and I{\~n}aki San Vicente and Jon Ander Campos and Ander Barrena and Xabier Saralegi and Aitor Soroa and Eneko Agirre},
<add> booktitle={Proceedings of the 12th International Conference on Language Resources and Evaluation},
<add> year={2020}
<add>}
<add>``` | 1 |
Python | Python | add weight deduping before updates computation | ebfde534c04d10d1fd414cdafac0697721f0c000 | <ide><path>keras/engine/training.py
<ide> def compile(self, optimizer, loss, metrics=[], loss_weights=None,
<ide>
<ide> # prepare gradient updates and state updates
<ide> self.optimizer = optimizers.get(optimizer)
<del> train_updates = self.optimizer.get_updates(self.trainable_weights,
<add> # dedupe trainable weights
<add> trainable_weights_set = set()
<add> trainable_weights = []
<add> for w in self.trainable_weights:
<add> if w not in trainable_weights_set:
<add> trainable_weights_set.add(w)
<add> trainable_weights.append(w)
<add> # compute weight updates
<add> train_updates = self.optimizer.get_updates(trainable_weights,
<ide> self.constraints,
<ide> total_loss)
<ide> train_updates += self.updates | 1 |
Text | Text | fix changelog date | dff2a0ac126c15f1d141126c33bda0f92ab9b0da | <ide><path>CHANGELOG.md
<ide> information on the list of deprecated flags and APIs please have a look at
<ide> https://docs.docker.com/engine/deprecated/ where target removal dates can also
<ide> be found.
<ide>
<del>## 17.03.0-ce (2017-02-01)
<add>## 17.03.0-ce (2017-03-01)
<ide>
<ide> ### Client
<ide> | 1 |
Text | Text | fix animated blog lists | 7f9876c0498b23cadc232bdaf3e108144cfaf485 | <ide><path>blog/2017-02-14-using-native-driver-for-animated.md
<ide> First, let's check out how animations currently work using Animated with the JS
<ide> 
<ide>
<ide> Here's a breakdown of the steps for an animation and where it happens:
<add>
<ide> - JS: The animation driver uses `requestAnimationFrame` to execute on every frame and update the value it drives using the new value it calculates based on the animation curve.
<ide> - JS: Intermediate values are calculated and passed to a props node that is attached to a `View`.
<ide> - JS: The `View` is updated using `setNativeProps`.
<ide> NativeAnimatedModule.startAnimation({
<ide> ```
<ide>
<ide> And now here's the breakdown of what happens when the animation runs:
<add>
<ide> - Native: The native animation driver uses `CADisplayLink` or `android.view.Choreographer` to execute on every frame and update the value it drives using the new value it calculates based on the animation curve.
<ide> - Native: Intermediate values are calculated and passed to a props node that is attached to a native view.
<ide> - Native: The `UIView` or `android.View` is updated. | 1 |
Go | Go | simplify the crashtest | 76a1a7cf5ba2d2db2c7e5873df529f3f956a2156 | <ide><path>contrib/crashTest.go
<ide> package main
<ide>
<ide> import (
<add> "bufio"
<ide> "fmt"
<ide> "io"
<ide> "log"
<ide> import (
<ide>
<ide> var DOCKER_PATH string = path.Join(os.Getenv("DOCKERPATH"), "docker")
<ide>
<add>// WARNING: this crashTest will 1) crash your host, 2) remove all containers
<ide> func runDaemon() (*exec.Cmd, error) {
<ide> os.Remove("/var/run/docker.pid")
<add> exec.Command("rm", "-rf", "/var/lib/docker/containers")
<ide> cmd := exec.Command(DOCKER_PATH, "-d")
<ide> outPipe, err := cmd.StdoutPipe()
<ide> if err != nil {
<ide> func crashTest() error {
<ide> } else {
<ide> endpoint = ep
<ide> }
<del> conn, _ := net.Dial("tcp", endpoint)
<add>
<add> c := make(chan bool)
<add> var conn io.Writer
<add>
<add> go func() {
<add> conn, _ = net.Dial("tcp", endpoint)
<add> c <- false
<add> }()
<add> go func() {
<add> time.Sleep(2 * time.Second)
<add> c <- true
<add> }()
<add> <-c
<ide>
<ide> restartCount := 0
<ide> totalTestCount := 1
<ide> func crashTest() error {
<ide> if err != nil {
<ide> return err
<ide> }
<del> if conn != nil {
<del> fmt.Fprintf(conn, "RESTART: %d\n", restartCount)
<del> }
<ide> restartCount++
<ide> // time.Sleep(5000 * time.Millisecond)
<ide> var stop bool
<ide> go func() error {
<ide> stop = false
<del> for i := 0; i < 100 && !stop; i++ {
<add> for i := 0; i < 100 && !stop; {
<ide> func() error {
<ide> if conn != nil {
<del> fmt.Fprintf(conn, "TEST: %d\n", totalTestCount)
<add> fmt.Fprintf(conn, "%d\n", totalTestCount)
<ide> }
<del> totalTestCount++
<ide> cmd := exec.Command(DOCKER_PATH, "run", "base", "echo", "hello", "world")
<del> log.Printf("%d", i)
<ide> outPipe, err := cmd.StdoutPipe()
<ide> if err != nil {
<ide> return err
<ide> func crashTest() error {
<ide> go inPipe.Write([]byte("hello world!!!!!\n"))
<ide> inPipe.Close()
<ide>
<add> go func() error {
<add> r := bufio.NewReader(outPipe)
<add> if out, err := r.ReadString('\n'); err != nil {
<add> return err
<add> } else if out == "hello world\n" {
<add> log.Printf("%d", i)
<add> if conn != nil {
<add> fmt.Fprintf(conn, "%d\n", totalTestCount)
<add> }
<add> i++
<add> totalTestCount++
<add> }
<add> return nil
<add> }()
<ide> if err := cmd.Wait(); err != nil {
<ide> return err
<ide> } | 1 |
Text | Text | add pnpm link to docs | 3e178bb8018e4cc9899ec85de49e114af740ef11 | <ide><path>contributing.md
<ide> Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_mediu
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example DIRECTORY_NAME DIRECTORY_NAME-app
<ide><path>examples/active-class-name/README.md
<ide> Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_mediu
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example active-class-name active-class-name-app
<ide><path>examples/amp-first/README.md
<ide> Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_mediu
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example amp-first amp-first-app
<ide><path>examples/amp-story/README.md
<ide> Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_mediu
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example amp-story amp-story-app
<ide><path>examples/amp/README.md
<ide> Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_mediu
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example amp amp-app
<ide><path>examples/analyze-bundles/README.md
<ide> Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_mediu
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example analyze-bundles analyze-bundles-app
<ide><path>examples/api-routes-apollo-server-and-client/README.md
<ide> Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_mediu
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example api-routes-apollo-server-and-client api-routes-apollo-server-and-client-app
<ide><path>examples/api-routes-apollo-server/README.md
<ide> Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_mediu
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example api-routes-apollo-server api-routes-apollo-server-app
<ide><path>examples/api-routes-cors/README.md
<ide> Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_mediu
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example api-routes-cors api-routes-cors-app
<ide><path>examples/api-routes-graphql/README.md
<ide> Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_mediu
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example api-routes-graphql api-routes-graphql-app
<ide><path>examples/api-routes-middleware/README.md
<ide> Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_mediu
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example api-routes-middleware api-routes-middleware-app
<ide><path>examples/api-routes-rate-limit/README.md
<ide> Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_mediu
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example api-routes-rate-limit api-routes-rate-limit-app
<ide><path>examples/api-routes-rest/README.md
<ide> Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_mediu
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example api-routes-rest api-routes-rest-app
<ide><path>examples/api-routes/README.md
<ide> Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_mediu
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example api-routes api-routes-app
<ide><path>examples/auth0/README.md
<ide> Read more: [https://auth0.com/blog/ultimate-guide-nextjs-authentication-auth0/](
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example auth0 auth0-app
<ide><path>examples/basic-css/README.md
<ide> Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_mediu
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example basic-css basic-css-app
<ide><path>examples/basic-export/README.md
<ide> Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_mediu
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example basic-export basic-export-app
<ide><path>examples/blog-starter-typescript/README.md
<ide> Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_mediu
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example blog-starter-typescript blog-starter-typescript-app
<ide><path>examples/blog-starter/README.md
<ide> Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_mediu
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```
<ide> npx create-next-app --example blog-starter blog-starter-app
<ide><path>examples/blog/README.md
<ide> Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_mediu
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example blog my-blog
<ide><path>examples/catch-all-routes/README.md
<ide> Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_mediu
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example catch-all-routes catch-all-routes-app
<ide><path>examples/cms-agilitycms/README.md
<ide> Once you have access to [the environment variables you'll need](#step-15-set-up-
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example cms-agilitycms cms-agilitycms-app
<ide><path>examples/cms-builder-io/README.md
<ide> This example showcases Next.js's [Static Generation](https://nextjs.org/docs/bas
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example cms-builder-io cms-builder-io-app
<ide><path>examples/cms-buttercms/README.md
<ide> npm install # or yarn install
<ide>
<ide> ### Option 2. Install via Create-Next-App
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example cms-buttercms cms-buttercms-app
<ide><path>examples/cms-contentful/README.md
<ide> Using the Deploy Button below, you'll deploy the Next.js project as well as conn
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example cms-contentful cms-contentful-app
<ide><path>examples/cms-cosmic/README.md
<ide> Once you have access to [the environment variables you'll need](#step-3-set-up-e
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example cms-cosmic cms-cosmic-app
<ide><path>examples/cms-datocms/README.md
<ide> Once you have access to [the environment variables you'll need](#step-5-set-up-e
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example cms-datocms cms-datocms-app
<ide><path>examples/cms-drupal/README.md
<ide> Once you have [configured the Next.js module for Drupal](https://next-drupal.org
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example cms-drupal cms-drupal-app
<ide><path>examples/cms-ghost/README.md
<ide> Once you have access to [the environment variables you'll need](#step-2-set-up-e
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example cms-ghost cms-ghost-app
<ide><path>examples/cms-graphcms/README.md
<ide> Once you have access to [the environment variables you'll need](#step-3-set-up-e
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example cms-graphcms cms-graphcms-app
<ide><path>examples/cms-kontent/README.md
<ide> Once you have access to [the environment variables you'll need](#step-3-set-up-e
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example cms-kontent cms-kontent-app
<ide><path>examples/cms-prepr/README.md
<ide> Once you have access to [the environment variables you'll need](#step-3-set-up-e
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example cms-prepr cms-prepr-app
<ide><path>examples/cms-prismic/README.md
<ide> Once you have access to [the environment variables you'll need](#step-5-set-up-e
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example cms-prismic cms-prismic-app
<ide><path>examples/cms-sanity/README.md
<ide> Once you have access to [the environment variables you'll need](#step-4-set-up-e
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example cms-sanity cms-sanity-app
<ide><path>examples/cms-storyblok/README.md
<ide> Once you have access to [the environment variables you'll need](#step-6-set-up-e
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example cms-storyblok cms-storyblok-app
<ide><path>examples/cms-strapi/README.md
<ide> Once you have access to [the environment variables you'll need](#step-7-set-up-e
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example cms-strapi cms-strapi-app
<ide><path>examples/cms-takeshape/README.md
<ide> Once you have access to [the environment variables you'll need](#step-5-set-up-e
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example cms-takeshape cms-takeshape-app
<ide><path>examples/cms-tina/README.md
<ide> This example showcases Next.js's [Static Generation](https://nextjs.org/docs/bas
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example cms-tina cms-tina-app
<ide><path>examples/cms-umbraco-heartcore/README.md
<ide> Once you have access to [the environment variables you'll need](#step-3-set-up-e
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example cms-umbraco-heartcore cms-umbraco-heartcore-app
<ide><path>examples/cms-wordpress/README.md
<ide> Once you have access to [the environment variables you'll need](#step-3-set-up-e
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example cms-wordpress cms-wordpress-app
<ide><path>examples/custom-routes-proxying/README.md
<ide> Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_mediu
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example custom-routes-proxying custom-routes-proxying-app
<ide><path>examples/custom-server-actionhero/README.md
<ide> A more detailed example showcasing how to use fetch and web sockets to interact
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example custom-server-actionhero custom-server-actionhero-app
<ide><path>examples/custom-server-express/README.md
<ide> Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_mediu
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example custom-server-express custom-server-express-app
<ide><path>examples/custom-server-fastify/README.md
<ide> Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_mediu
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example custom-server-fastify custom-server-fastify-app
<ide><path>examples/custom-server-hapi/README.md
<ide> Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_mediu
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example custom-server-hapi custom-server-hapi-app
<ide><path>examples/custom-server-koa/README.md
<ide> Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_mediu
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example custom-server-koa custom-server-koa-app
<ide><path>examples/custom-server-polka/README.md
<ide> Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_mediu
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example custom-server-polka custom-server-polka-app
<ide><path>examples/custom-server-typescript/README.md
<ide> Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_mediu
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example custom-server-typescript custom-server-typescript-app
<ide><path>examples/data-fetch/README.md
<ide> Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_mediu
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example data-fetch data-fetch-app
<ide><path>examples/dynamic-routing/README.md
<ide> Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_mediu
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example dynamic-routing dynamic-routing-app
<ide><path>examples/environment-variables/readme.md
<ide> Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_mediu
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example environment-variables environment-variables-app
<ide><path>examples/fast-refresh-demo/README.md
<ide> Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_mediu
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example fast-refresh-demo fast-refresh-demo-app
<ide><path>examples/gh-pages/README.md
<ide> This example shows the most basic idea behind Next. We have 2 pages: `pages/inde
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example gh-pages gh-pages-app
<ide><path>examples/head-elements/README.md
<ide> Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_mediu
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example head-elements head-elements-app
<ide><path>examples/headers/README.md
<ide> Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_mediu
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example headers headers-app
<ide><path>examples/hello-world-esm/README.md
<ide> Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_mediu
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example hello-world-esm hello-world-esm-app
<ide><path>examples/hello-world/README.md
<ide> Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_mediu
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example hello-world hello-world-app
<ide><path>examples/i18n-routing/README.md
<ide> Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_mediu
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example i18n-routing i18n-app
<ide><path>examples/image-component/README.md
<ide> Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_mediu
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example image-component image-app
<ide><path>examples/layout-component/README.md
<ide> Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_mediu
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example layout-component layout-component-app
<ide><path>examples/markdoc/README.md
<ide> Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_mediu
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example markdoc markdoc-app
<ide><path>examples/modularize-imports/README.md
<ide> Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_mediu
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example modularize-imports modularize-imports-app
<ide><path>examples/nested-components/README.md
<ide> Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_mediu
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example nested-components nested-components-app
<ide><path>examples/next-forms/README.md
<ide> Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_mediu
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example next-forms next-forms-app
<ide><path>examples/progressive-render/README.md
<ide> Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_mediu
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example progressive-render progressive-render-app
<ide><path>examples/progressive-web-app/README.md
<ide> Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_mediu
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example progressive-web-app progressive-web-app
<ide><path>examples/react-remove-properties/README.md
<ide> Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_mediu
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example react-remove-properties react-remove-properties-app
<ide><path>examples/redirects/README.md
<ide> Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_mediu
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example redirects redirects-app
<ide><path>examples/remove-console/README.md
<ide> Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_mediu
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example remove-console remove-console-app
<ide><path>examples/rewrites/README.md
<ide> Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_mediu
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example rewrites rewrites-app
<ide><path>examples/script-component/README.md
<ide> Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_mediu
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example script-component script-component-app
<ide><path>examples/ssr-caching/README.md
<ide> Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_mediu
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example ssr-caching ssr-caching-app
<ide><path>examples/styled-jsx-with-csp/README.md
<ide> Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_mediu
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example styled-jsx-with-csp styled-jsx-with-csp-app
<ide><path>examples/svg-components/README.md
<ide> Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_mediu
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example svg-components svg-components-app
<ide><path>examples/using-preact/README.md
<ide> Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_mediu
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example using-preact using-preact-app
<ide><path>examples/using-router/README.md
<ide> Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_mediu
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example using-router using-router-app
<ide><path>examples/with-absolute-imports/README.md
<ide> Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_mediu
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example with-absolute-imports with-absolute-imports-app
<ide><path>examples/with-algolia-react-instantsearch/README.md
<ide> The goal of this example is to illustrate how you can use [Algolia React Instant
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example with-algolia-react-instantsearch with-algolia-react-instantsearch-app
<ide><path>examples/with-ant-design/README.md
<ide> Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_mediu
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example with-ant-design with-ant-design-app
<ide><path>examples/with-aphrodite/README.md
<ide> Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_mediu
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example with-aphrodite with-aphrodite-app
<ide><path>examples/with-apollo-and-redux/README.md
<ide> Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_mediu
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example with-apollo-and-redux with-apollo-and-redux-app
<ide><path>examples/with-apollo-neo4j-graphql/README.md
<ide> Once you have access to [the environment variables you'll need](#step-3-set-up-e
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example with-apollo-neo4j-graphql with-apollo-neo4j-graphql-app
<ide><path>examples/with-apollo/README.md
<ide> Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_mediu
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example with-apollo with-apollo-app
<ide><path>examples/with-app-layout/README.md
<ide> Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_mediu
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example with-app-layout with-app-layout-app
<ide><path>examples/with-atlaskit/README.md
<ide> Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_mediu
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npm install
<ide><path>examples/with-aws-amplify-typescript/README.md
<ide> Two routes are implemented :
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example with-aws-amplify-typescript nextjs-aws-amplify-typescript-app
<ide><path>examples/with-aws-amplify/README.md
<ide> Two routes are implemented :
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example with-aws-amplify nextjs-aws-amplify-app
<ide><path>examples/with-babel-macros/README.md
<ide> Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_mediu
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example with-babel-macros with-babel-macros-app
<ide><path>examples/with-carbon-components/README.md
<ide> Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_mediu
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example with-carbon-components with-carbon-components-app
<ide><path>examples/with-cerebral/README.md
<ide> Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_mediu
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example with-cerebral with-cerebral-app
<ide><path>examples/with-chakra-ui/README.md
<ide> Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_mediu
<ide>
<ide> ### Using `create-next-app`
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example with-chakra-ui with-chakra-ui-app
<ide><path>examples/with-clerk/README.md
<ide> Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_mediu
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example with-clerk with-clerk-app
<ide><path>examples/with-compiled-css/README.md
<ide> Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_mediu
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example with-compiled-css with-compiled-css-app
<ide><path>examples/with-contentlayer/README.md
<ide> Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_mediu
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example with-contentlayer with-contentlayer-app
<ide><path>examples/with-context-api/README.md
<ide> Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_mediu
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example with-context-api with-context-api-app
<ide><path>examples/with-cookie-auth-fauna/README.md
<ide> The helper function `auth` helps to retrieve the token across pages and redirect
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example with-cookie-auth-fauna with-cookie-auth-fauna-app
<ide><path>examples/with-couchbase/README.md
<ide> Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_mediu
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example with-couchbase with-couchbase-app
<ide><path>examples/with-cssed/README.md
<ide> Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_mediu
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example with-cssed with-cssed-app
<ide><path>examples/with-custom-babel-config/README.md
<ide> Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_mediu
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example with-custom-babel-config with-custom-babel-config-app
<ide><path>examples/with-cxs/README.md
<ide> Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_mediu
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example with-cxs with-cxs-app
<ide><path>examples/with-cypress/README.md
<ide> Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_mediu
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example with-cypress with-cypress-app
<ide><path>examples/with-deta-base/README.md
<ide> Once you have access to [the environment variables you'll need](#step-2-setting-
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example with-deta-base with-deta-base-app
<ide><path>examples/with-docker-multi-env/README.md
<ide> This examples shows how to use Docker with Next.js and deploy to multiple enviro
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example with-docker-multi-env nextjs-docker-multi-env
<ide><path>examples/with-docker/README.md
<ide> This examples shows how to use Docker with Next.js based on the [deployment docu
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example with-docker nextjs-docker
<ide><path>examples/with-draft-js/README.md
<ide> Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_mediu
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example with-draft-js with-draft-js-app
<ide><path>examples/with-dynamic-import/README.md
<ide> Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_mediu
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example with-dynamic-import with-dynamic-import-app
<ide><path>examples/with-edgedb/README.md
<ide> Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_mediu
<ide>
<ide> ### Download the example project
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example with-edgedb with-edgedb-app
<ide><path>examples/with-elasticsearch/README.md
<ide> Once you have access to the environment variables you'll need, deploy the exampl
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example with-elasticsearch with-elasticsearch-app
<ide><path>examples/with-electron-typescript/README.md
<ide> For development it's going to run a HTTP server and let Next.js handle routing.
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example with-electron-typescript with-electron-typescript-app
<ide><path>examples/with-electron/README.md
<ide> For development it's going to run an HTTP server and let Next.js handle routing.
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example with-electron with-electron-app
<ide><path>examples/with-emotion-swc/README.md
<ide> Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_mediu
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example with-emotion-swc with-emotion-swc-app
<ide><path>examples/with-emotion-vanilla/README.md
<ide> Deploy the example using [Vercel](https://vercel.com) or preview live with [Stac
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example with-emotion-vanilla with-emotion-vanilla-app
<ide><path>examples/with-emotion/README.md
<ide> Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_mediu
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example with-emotion with-emotion-app
<ide><path>examples/with-env-from-next-config-js/README.md
<ide> Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_mediu
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example with-env-from-next-config-js with-env-from-next-config-js-app
<ide><path>examples/with-eslint/README.md
<ide> Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_mediu
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example with-eslint with-eslint-app
<ide><path>examples/with-expo-typescript/README.md
<ide> Deploy the native app to the App store and Play store using [Expo deployment](ht
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example with-expo-typescript with-expo-typescript-app
<ide><path>examples/with-expo/README.md
<ide> Deploy the native app to the App store and Play store using [Expo deployment](ht
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example with-expo with-expo-app
<ide><path>examples/with-facebook-pixel/README.md
<ide> Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_mediu
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example with-facebook-pixel with-facebook-pixel-app
<ide><path>examples/with-fauna/README.md
<ide> By importing a `.gql` or `.graphql` schema into Fauna ([see our sample schema fi
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```
<ide> npx create-next-app --example with-fauna with-fauna-app
<ide><path>examples/with-fela/README.md
<ide> Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_mediu
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example with-fela with-fela-app
<ide><path>examples/with-filbert/README.md
<ide> Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_mediu
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example with-filbert with-filbert-app
<ide><path>examples/with-firebase-cloud-messaging/README.md
<ide> To demo how to implement firebase cloud messaging to send web push notification
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example with-firebase-cloud-messaging with-firebase-cloud-messaging-app
<ide><path>examples/with-firebase-hosting/README.md
<ide> If you are having issues, feel free to tag @jthegedus in the [issue you create o
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example with-firebase-hosting with-firebase-hosting-app
<ide><path>examples/with-firebase/README.md
<ide> Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_mediu
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example with-firebase with-firebase-app
<ide><path>examples/with-flow/README.md
<ide> Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_mediu
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example with-flow with-flow-app
<ide><path>examples/with-framer-motion/README.md
<ide> Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_mediu
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example with-framer-motion with-framer-motion-app
<ide><path>examples/with-geist-ui/README.md
<ide> Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_mediu
<ide>
<ide> [](https://vercel.com/new/git/external?repository-url=https://github.com/vercel/next.js/tree/canary/examples/with-geist-ui&project-name=with-geist-ui&repository-name=with-geist-ui)
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example with-geist-ui with-geist-ui-app
<ide><path>examples/with-goober/README.md
<ide> Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_mediu
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example with-goober with-goober-app
<ide><path>examples/with-google-analytics-amp/README.md
<ide> Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_mediu
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example::
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example::
<ide>
<ide> ```bash
<ide> npx create-next-app --example with-google-analytics-amp with-google-analytics-amp-app
<ide><path>examples/with-google-analytics/README.md
<ide> Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_mediu
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example with-google-analytics with-google-analytics-app
<ide><path>examples/with-google-tag-manager/README.md
<ide> Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_mediu
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example with-google-tag-manager with-google-tag-manager-app
<ide><path>examples/with-graphql-gateway/README.md
<ide> Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_mediu
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example with-graphql-gateway with-graphql-gateway-app
<ide><path>examples/with-graphql-hooks/README.md
<ide> Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_mediu
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example with-graphql-hooks with-graphql-hooks-app
<ide><path>examples/with-graphql-react/README.md
<ide> Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_mediu
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example with-graphql-react with-graphql-react-app
<ide><path>examples/with-grommet/README.md
<ide> Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_mediu
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example with-grommet with-grommet-app
<ide><path>examples/with-gsap/README.md
<ide> Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_mediu
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example with-gsap with-gsap-app
<ide><path>examples/with-hls-js/README.md
<ide> Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_mediu
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example with-hls-js with-hls-js-app
<ide><path>examples/with-http2/README.md
<ide> This example shows the most basic example using an HTTP2 server. We have 2 pages
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example with-http2 with-http2-app
<ide><path>examples/with-i18n-next-intl/README.md
<ide> Deploy the example using [Vercel](https://vercel.com) or preview live with [Stac
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example with-i18n-next-intl
<ide><path>examples/with-i18n-rosetta/README.md
<ide> Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_mediu
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example with-i18n-rosetta with-i18n-rosetta-app
<ide><path>examples/with-iron-session/README.md
<ide> Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_mediu
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example with-iron-session with-iron-session-app
<ide><path>examples/with-joi/README.md
<ide> Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_mediu
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example with-joi with-joi-app
<ide><path>examples/with-jotai/README.md
<ide> Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_mediu
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example with-jotai with-jotai-app
<ide><path>examples/with-kea/README.md
<ide> Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_mediu
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example with-kea with-kea-app
<ide><path>examples/with-knex/README.md
<ide> Once you have access to the environment variables you'll need, deploy the exampl
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example with-knex with-knex-app
<ide><path>examples/with-linaria/README.md
<ide> Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_mediu
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example with-linaria with-linaria-app
<ide><path>examples/with-lingui/README.md
<ide> Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_mediu
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example with-lingui with-lingui-app
<ide><path>examples/with-loading/README.md
<ide> Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_mediu
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example with-loading with-loading-app
<ide><path>examples/with-magic/README.md
<ide> Once you have access to [the environment variables you'll need](#configuration),
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example with-magic with-magic-app
<ide><path>examples/with-mantine/README.md
<ide> Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_mediu
<ide>
<ide> ## How to use it?
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example with-mantine with-mantine-app
<ide><path>examples/with-mdbreact/README.md
<ide> Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_mediu
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example with-mdbreact with-mdbreact-app
<ide><path>examples/with-mdx-remote/README.md
<ide> Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_mediu
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example with-mdx-remote with-mdx-remote-app
<ide><path>examples/with-mdx/README.md
<ide> Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_mediu
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example with-mdx with-mdx-app
<ide><path>examples/with-mobx-react-lite/README.md
<ide> Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_mediu
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example with-mobx-react-lite with-mobx-react-lite-app
<ide><path>examples/with-mobx-state-tree-typescript/README.md
<ide> Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_mediu
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example with-mobx-state-tree-typescript with-mobx-state-tree-typescript-app
<ide><path>examples/with-mobx-state-tree/README.md
<ide> Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_mediu
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example with-mobx-state-tree with-mobx-state-tree-app
<ide><path>examples/with-mobx/README.md
<ide> Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_mediu
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example with-mobx with-mobx-app
<ide><path>examples/with-mocha/README.md
<ide> Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_mediu
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example with-mocha with-mocha-app
<ide><path>examples/with-mongodb-mongoose/README.md
<ide> Once you have access to [the environment variables you'll need](#step-2-set-up-e
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example with-mongodb-mongoose with-mongodb-mongoose-app
<ide><path>examples/with-mongodb/README.md
<ide> Once you have access to the environment variables you'll need, deploy the exampl
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example with-mongodb with-mongodb-app
<ide><path>examples/with-mqtt-js/README.md
<ide> Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_mediu
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example with-mqtt-js with-mqtt-js-app
<ide><path>examples/with-msw/README.md
<ide> Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_mediu
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example with-msw with-msw-app
<ide><path>examples/with-mux-video/README.md
<ide> Deploy the example using [Vercel](https://vercel.com/home):
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example with-mux-video with-mux-video-app
<ide><path>examples/with-mysql/README.md
<ide> pscale database create <DATABASE_NAME>
<ide>
<ide> ## Set up the starter Next.js app
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example with-mysql nextjs-mysql
<ide><path>examples/with-neo4j/README.md
<ide> Once you have access to [the environment variables you'll need](#step-3-set-up-e
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example with-neo4j with-neo4j-app
<ide><path>examples/with-netlify-cms/README.md
<ide> Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_mediu
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example with-netlify-cms with-netlify-cms-app
<ide><path>examples/with-next-css/README.md
<ide> Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_mediu
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example with-next-css with-next-css-app
<ide><path>examples/with-next-offline/README.md
<ide> This example demonstrates how to use the [next-offline plugin](https://github.co
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example with-next-offline with-next-offline-app
<ide><path>examples/with-next-page-transitions/README.md
<ide> Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_mediu
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example with-next-page-transitions with-next-page-transitions-app
<ide><path>examples/with-next-sass/README.md
<ide> Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_mediu
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example with-next-sass with-next-sass-app
<ide><path>examples/with-next-seo/README.md
<ide> Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_mediu
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example with-next-seo next-seo-app
<ide><path>examples/with-next-sitemap/README.md
<ide> Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_mediu
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example with-next-sitemap with-next-sitemap-app
<ide><path>examples/with-next-translate/README.md
<ide> Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_mediu
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example with-next-translate with-next-translate-app
<ide><path>examples/with-nhost-auth-realtime-graphql/README.md
<ide> Once you have created a Nhost project and have access to [the environment variab
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example with-nhost-auth-realtime-graphql nhost-app
<ide><path>examples/with-orbit-components/README.md
<ide> Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_mediu
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example with-orbit-components with-orbit-components-app
<ide><path>examples/with-overmind/README.md
<ide> Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_mediu
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example with-overmind with-overmind-app
<ide><path>examples/with-passport-and-next-connect/README.md
<ide> Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_mediu
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example with-passport-and-next-connect with-passport-and-next-connect-app
<ide><path>examples/with-passport/README.md
<ide> Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_mediu
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example with-passport with-passport-app
<ide><path>examples/with-paste-typescript/README.md
<ide> Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_mediu
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example with-paste-typescript with-paste-typescript-app
<ide><path>examples/with-patternfly/README.md
<ide> Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_mediu
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example with-patternfly with-patternfly-app
<ide><path>examples/with-plausible/README.md
<ide> Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_mediu
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example::
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example::
<ide>
<ide> ```bash
<ide> npx create-next-app --example with-plausible with-plausible-app
<ide><path>examples/with-playwright/README.md
<ide> Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_mediu
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example with-playwright with-playwright-app
<ide><path>examples/with-polyfills/README.md
<ide> Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_mediu
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example with-polyfills with-polyfills-app
<ide><path>examples/with-portals-ssr/README.md
<ide> Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_mediu
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example with-portals-ssr with-portals-ssr-app
<ide><path>examples/with-portals/README.md
<ide> Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_mediu
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example with-portals with-portals-app
<ide><path>examples/with-prefetching/README.md
<ide> Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_mediu
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example with-prefetching with-prefetching-app
<ide><path>examples/with-quill-js/README.md
<ide> Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_mediu
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example with-quill-js with-quill-js-app
<ide><path>examples/with-rbx-bulma-pro/README.md
<ide> Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_mediu
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example with-rbx-bulma-pro with-rbx-bulma-pro-app
<ide><path>examples/with-react-bootstrap/README.md
<ide> Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_mediu
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example with-react-bootstrap with-react-bootstrap-app
<ide><path>examples/with-react-foundation/README.md
<ide> Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_mediu
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example with-react-foundation with-react-foundation-app
<ide><path>examples/with-react-ga/README.md
<ide> Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_mediu
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example with-react-ga with-react-ga-app
<ide><path>examples/with-react-helmet/README.md
<ide> Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_mediu
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example with-react-helmet with-react-helmet-app
<ide><path>examples/with-react-hook-form/README.md
<ide> Deploy the example using [Vercel](https://vercel.com/now) or preview live with [
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example with-react-hook-form with-react-hook-form-app
<ide><path>examples/with-react-intl/README.md
<ide> This example app shows how to integrate [React Intl][] with Next.js.
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example with-react-intl with-react-intl-app
<ide><path>examples/with-react-jss/README.md
<ide> Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_mediu
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example with-react-jss with-react-jss-app
<ide><path>examples/with-react-md-typescript/README.md
<ide> Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_mediu
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example with-react-md-typescript with-react-md-typescript-app
<ide><path>examples/with-react-md/README.md
<ide> Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_mediu
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example with-react-md with-react-md-app
<ide><path>examples/with-react-multi-carousel/README.md
<ide> _Live Example: https://react-multi-carousel.vercel.app_
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example with-react-multi-carousel with-react-multi-carousel-app
<ide><path>examples/with-react-native-web/README.md
<ide> Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_mediu
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example with-react-native-web with-react-native-web-app
<ide><path>examples/with-react-toolbox/README.md
<ide> Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_mediu
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example with-react-toolbox with-react-toolbox-app
<ide><path>examples/with-react-with-styles/README.md
<ide> Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_mediu
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example with-react-with-styles with-react-with-styles-app
<ide><path>examples/with-reactstrap/README.md
<ide> Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_mediu
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example with-reactstrap with-reactstrap-app
<ide><path>examples/with-realm-web/README.md
<ide> Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_mediu
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example with-realm-web with-realm-web-app
<ide><path>examples/with-reason-relay/README.md
<ide> Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_mediu
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example with-reason-relay with-reason-relay-app
<ide><path>examples/with-reasonml-todo/README.md
<ide> Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_mediu
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example with-reasonml-todo with-reasonml-app
<ide><path>examples/with-reasonml/README.md
<ide> Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_mediu
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example with-reasonml with-reasonml-app
<ide><path>examples/with-rebass/README.md
<ide> Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_mediu
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example with-rebass with-rebass-app
<ide><path>examples/with-recoil/README.md
<ide> Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_mediu
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example with-recoil with-recoil-app
<ide><path>examples/with-redis/README.md
<ide> you will be asked to connect with Upstash. The integration will help you create
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example with-redis roadmap
<ide><path>examples/with-redux-observable/README.md
<ide> Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_mediu
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example with-redux-observable with-redux-observable-app
<ide><path>examples/with-redux-persist/README.md
<ide> Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_mediu
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example with-redux-persist with-redux-persist-app
<ide><path>examples/with-redux-saga/README.md
<ide> Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_mediu
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example with-redux-saga with-redux-saga-app
<ide><path>examples/with-redux-thunk/README.md
<ide> Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_mediu
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example with-redux-thunk with-redux-thunk-app
<ide><path>examples/with-redux-wrapper/README.md
<ide> Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_mediu
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example with-redux-wrapper with-redux-wrapper-app
<ide><path>examples/with-redux/README.md
<ide> Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_mediu
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example with-redux with-redux-app
<ide><path>examples/with-reflexjs/README.md
<ide> Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_mediu
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example with-reflexjs with-reflexjs-app
<ide><path>examples/with-reflux/README.md
<ide> Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_mediu
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example with-reflux with-reflux-app
<ide><path>examples/with-relay-modern/README.md
<ide> Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_mediu
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example with-relay-modern with-relay-modern-app
<ide><path>examples/with-rematch/README.md
<ide> Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_mediu
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example::
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example::
<ide>
<ide> ```bash
<ide> npx create-next-app --example with-rematch with-rematch-app
<ide><path>examples/with-route-as-modal/README.md
<ide> Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_mediu
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example with-route-as-modal with-route-as-modal-app
<ide><path>examples/with-segment-analytics/README.md
<ide> Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_mediu
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example with-segment-analytics with-segment-analytics-app
<ide><path>examples/with-semantic-ui/README.md
<ide> Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_mediu
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example with-semantic-ui with-semantic-ui-app
<ide><path>examples/with-service-worker/README.md
<ide> Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_mediu
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example with-service-worker with-service-worker-app
<ide><path>examples/with-shallow-routing/README.md
<ide> Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_mediu
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example with-shallow-routing with-shallow-routing-app
<ide><path>examples/with-sitemap/README.md
<ide> Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_mediu
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example with-sitemap with-sitemap-app
<ide><path>examples/with-skynexui-components/README.md
<ide> Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_mediu
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example with-skynexui-components with-skynexui-components-app
<ide><path>examples/with-slate/README.md
<ide> Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_mediu
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example::
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example::
<ide>
<ide> ```bash
<ide> npx create-next-app --example with-slate with-slate-app
<ide><path>examples/with-static-export/README.md
<ide> Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_mediu
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example with-static-export with-static-export-app
<ide><path>examples/with-stomp/README.md
<ide> Read more about [STOMP](http://jmesnil.net/stomp-websocket/doc/) protocol.
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example with-stomp with-stomp-app
<ide><path>examples/with-storybook-styled-jsx-scss/README.md
<ide> Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_mediu
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example with-storybook-styled-jsx-scss with-storybook-styled-jsx-scss-app
<ide><path>examples/with-storybook/README.md
<ide> Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_mediu
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example with-storybook with-storybook-app
<ide><path>examples/with-strict-csp/README.md
<ide> Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_mediu
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example with-strict-csp with-strict-csp-app
<ide><path>examples/with-stripe-typescript/README.md
<ide> Once you have access to [the environment variables you'll need](#required-config
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example with-stripe-typescript with-stripe-typescript-app
<ide><path>examples/with-styled-components-babel/README.md
<ide> Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_mediu
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example with-styled-components-babel with-styled-components-babel-app
<ide><path>examples/with-styled-components-rtl/README.md
<ide> Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_mediu
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example with-styled-components-rtl with-styled-components-rtl-app
<ide><path>examples/with-styled-components/README.md
<ide> Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_mediu
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example with-styled-components with-styled-components-app
<ide><path>examples/with-styled-jsx-plugins/README.md
<ide> Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_mediu
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example with-styled-jsx-plugins with-styled-jsx-plugins-app
<ide><path>examples/with-styled-jsx-scss/README.md
<ide> Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_mediu
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example with-styled-jsx-scss with-styled-jsx-scss-app
<ide><path>examples/with-styled-jsx/README.md
<ide> Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_mediu
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example with-styled-jsx with-styled-jsx-app
<ide><path>examples/with-styletron/README.md
<ide> Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_mediu
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example with-styletron with-styletron-app
<ide><path>examples/with-supertokens/README.md
<ide> This is a simple set up for applications protected by SuperTokens.
<ide>
<ide> ## How to use
<ide>
<del>- Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>- Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example with-supertokens with-supertokens-app
<ide><path>examples/with-tailwindcss-emotion/README.md
<ide> Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_mediu
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example with-tailwindcss-emotion with-tailwindcss-emotion-app
<ide><path>examples/with-tailwindcss/README.md
<ide> Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_mediu
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example with-tailwindcss with-tailwindcss-app
<ide><path>examples/with-temporal/README.md
<ide> Temporal Server is a cluster of internal services, a database of record, and a s
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example with-temporal next-temporal-app
<ide><path>examples/with-tesfy/README.md
<ide> Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_mediu
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example with-tesfy with-tesfy-app
<ide><path>examples/with-three-js/README.md
<ide> Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_mediu
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example with-three-js with-three-js-app
<ide><path>examples/with-typescript-graphql/README.md
<ide> Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_mediu
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example with-typescript-graphql with-typescript-graphql-app
<ide><path>examples/with-typescript/README.md
<ide> Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_mediu
<ide>
<ide> ## How to use it?
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example with-typescript with-typescript-app
<ide><path>examples/with-typestyle/README.md
<ide> Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_mediu
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example with-typestyle with-typestyle-app
<ide><path>examples/with-unsplash/README.md
<ide> Once you have access to [the environment variables you'll need](#step-2-set-up-e
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example with-unsplash with-unsplash-app
<ide><path>examples/with-unstated/README.md
<ide> Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_mediu
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example with-unstated with-unstated-app
<ide><path>examples/with-urql/README.md
<ide> Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_mediu
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example with-urql with-urql-app
<ide><path>examples/with-userbase/README.md
<ide> Once you have access to [the environment variables you'll need](#step-2-setting-
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example with-userbase next-userbase-app
<ide><path>examples/with-vercel-fetch/README.md
<ide> Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_mediu
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example with-vercel-fetch with-vercel-fetch-app
<ide><path>examples/with-videojs/README.md
<ide> Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_mediu
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example::
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example::
<ide>
<ide> ```bash
<ide> npx create-next-app --example with-videojs with-videojs-app
<ide><path>examples/with-vitest/README.md
<ide> Deploy the example using [Vercel](https://vercel.com/) or preview live with [Sta
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example with-vitest with-vitest-app
<ide><path>examples/with-web-worker/README.md
<ide> Deploy the example using [Vercel](https://vercel.com/) or preview live with [Sta
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example with-web-worker with-web-worker-app
<ide><path>examples/with-webassembly/README.md
<ide> Preview the example live on [StackBlitz](http://stackblitz.com/):
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example with-webassembly with-webassembly-app
<ide><path>examples/with-why-did-you-render/README.md
<ide> Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_mediu
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example with-why-did-you-render with-why-did-you-render-app
<ide><path>examples/with-xstate/README.md
<ide> Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_mediu
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example with-xstate with-xstate-app
<ide><path>examples/with-yarn-workspaces/README.md
<ide> Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_mediu
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example with-yarn-workspaces with-yarn-workspaces-app
<ide><path>examples/with-yoga/README.md
<ide> Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_mediu
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example with-yoga with-yoga-app
<ide><path>examples/with-zones/README.md
<ide> With Next.js you can use multiple apps as a single app using its [multi-zones fe
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example with-zones with-zones-app
<ide><path>examples/with-zustand/README.md
<ide> Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_mediu
<ide>
<ide> ## How to use
<ide>
<del>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
<add>Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
<ide>
<ide> ```bash
<ide> npx create-next-app --example with-zustand with-zustand-app | 264 |
Text | Text | add fundamentals translation | ae864f9071aa67d640c8d43b82ed94241f32baa4 | <ide><path>threejs/lessons/tr/threejs-fundamentals.md
<add>Title: Three.js Temelleri
<add>Description: Temeller ile birlikte ilk Three.js dersiniz
<add>TOC: Temel Bilgiler
<add>
<add>Bu three.js ile alakalı makale serisindeki ilk makaledir. [Three.js](https://threejs.org) bir web sayfasına 3D içerik sağlamayı mümkün olduğunca kolaylaştırmaya çalışan bir 3D kütüphanedir.
<add>
<add>Three.js sıklıkla WebGL ile karıştırılır fakat her zaman değil, three.js 3D çizim için WebGL kullanır.
<add>[WebGL yalnızca noktalar, çizgiler ve üçgenler çizen çok düşük seviyeli bir sistemdir](https://webglfundamentals.org).
<add>WebGL ile herhangi yararlı bir şey yapmak birazcık kod gerektirir ve three.js burada devreye girer.
<add>Sahneler, ışıklar, gölgeler, malzemeler, dokular, 3d matematik gibi şeyleri halleder, eğer direkt olarak WebGL kullansaydınız bunların hepsini kendiniz yazmak zorunda kalırdınız.
<add>
<add>These tutorials assume you already know JavaScript and, for the
<add>most part they will use ES6 style. [See here for a
<add>terse list of things you're expected to already know](threejs-prerequisites.html).
<add>Most browsers that support three.js are auto-updated so most users should
<add>be able to run this code. If you'd like to make this code run
<add>on really old browsers look into a transpiler like [Babel](https://babeljs.io).
<add>Of course users running really old browsers probably have machines
<add>that can't run three.js.
<add>
<add>When learning most programming languages the first thing people
<add>do is make the computer print `"Hello World!"`. For 3D one
<add>of the most common first things to do is to make a 3D cube.
<add>So let's start with "Hello Cube!"
<add>
<add>Before we get started let's try to give you an idea of the structure
<add>of a three.js app. A three.js app requires you to create a bunch of
<add>objects and connect them together. Here's a diagram that represents
<add>a small three.js app
<add>
<add><div class="threejs_center"><img src="resources/images/threejs-structure.svg" style="width: 768px;"></div>
<add>
<add>Things to notice about the diagram above.
<add>
<add>* There is a `Renderer`. This is arguably the main object of three.js. You pass a
<add> `Scene` and a `Camera` to a `Renderer` and it renders (draws) the portion of
<add> the 3D scene that is inside the *frustum* of the camera as a 2D image to a
<add> canvas.
<add>
<add>* There is a [scenegraph](threejs-scenegraph.html) which is a tree like
<add> structure, consisting of various objects like a `Scene` object, multiple
<add> `Mesh` objects, `Light` objects, `Group`, `Object3D`, and `Camera` objects. A
<add> `Scene` object defines the root of the scenegraph and contains properties like
<add> the background color and fog. These objects define a hierarchical parent/child
<add> tree like structure and represent where objects appear and how they are
<add> oriented. Children are positioned and oriented relative to their parent. For
<add> example the wheels on a car might be children of the car so that moving and
<add> orienting the car's object automatically moves the wheels. You can read more
<add> about this in [the article on scenegraphs](threejs-scenegraph.html).
<add>
<add> Note in the diagram `Camera` is half in half out of the scenegraph. This is to
<add> represent that in three.js, unlike the other objects, a `Camera` does not have
<add> to be in the scenegraph to function. Just like other objects, a `Camera`, as a
<add> child of some other object, will move and orient relative to its parent object.
<add> There is an example of putting multiple `Camera` objects in a scenegraph at
<add> the end of [the article on scenegraphs](threejs-scenegraph.html).
<add>
<add>* `Mesh` objects represent drawing a specific `Geometry` with a specific
<add> `Material`. Both `Material` objects and `Geometry` objects can be used by
<add> multiple `Mesh` objects. For example to draw two blue cubes in different
<add> locations we could need two `Mesh` objects to represent the position and
<add> orientation of each cube. We would only need one `Geometry` to hold the vertex
<add> data for a cube and we would only need one `Material` to specify the color
<add> blue. Both `Mesh` objects could reference the same `Geometry` object and the
<add> same `Material` object.
<add>
<add>* `Geometry` objects represent the vertex data of some piece of geometry like
<add> a sphere, cube, plane, dog, cat, human, tree, building, etc...
<add> Three.js provides many kinds of built in
<add> [geometry primitives](threejs-primitives.html). You can also
<add> [create custom geometry](threejs-custom-buffergeometry.html) as well as
<add> [load geometry from files](threejs-load-obj.html).
<add>
<add>* `Material` objects represent
<add> [the surface properties used to draw geometry](threejs-materials.html)
<add> including things like the color to use and how shiny it is. A `Material` can also
<add> reference one or more `Texture` objects which can be used, for example,
<add> to wrap an image onto the surface of a geometry.
<add>
<add>* `Texture` objects generally represent images either [loaded from image files](threejs-textures.html),
<add> [generated from a canvas](threejs-canvas-textures.html) or [rendered from another scene](threejs-rendertargets.html).
<add>
<add>* `Light` objects represent [different kinds of lights](threejs-lights.html).
<add>
<add>Given all of that we're going to make the smallest *"Hello Cube"* setup
<add>that looks like this
<add>
<add><div class="threejs_center"><img src="resources/images/threejs-1cube-no-light-scene.svg" style="width: 500px;"></div>
<add>
<add>First let's load three.js
<add>
<add>```html
<add><script type="module">
<add>import * as THREE from './resources/threejs/r125/build/three.module.js';
<add></script>
<add>```
<add>
<add>It's important you put `type="module"` in the script tag. This enables
<add>us to use the `import` keyword to load three.js. There are other ways
<add>to load three.js but as of r106 using modules is the recommended way.
<add>Modules have the advantage that they can easily import other modules
<add>they need. That saves us from having to manually load extra scripts
<add>they are dependent on.
<add>
<add>Next we need is a `<canvas>` tag so...
<add>
<add>```html
<add><body>
<add> <canvas id="c"></canvas>
<add></body>
<add>```
<add>
<add>We will ask three.js to draw into that canvas so we need to look it up.
<add>
<add>```html
<add><script type="module">
<add>import * as THREE from './resources/threejs/r125/build/three.module.js';
<add>
<add>+function main() {
<add>+ const canvas = document.querySelector('#c');
<add>+ const renderer = new THREE.WebGLRenderer({canvas});
<add>+ ...
<add></script>
<add>```
<add>
<add>After we look up the canvas we create a `WebGLRenderer`. The renderer
<add>is the thing responsible for actually taking all the data you provide
<add>and rendering it to the canvas. In the past there have been other renderers
<add>like `CSSRenderer`, a `CanvasRenderer` and in the future there may be a
<add>`WebGL2Renderer` or `WebGPURenderer`. For now there's the `WebGLRenderer`
<add>that uses WebGL to render 3D to the canvas.
<add>
<add>Note there are some esoteric details here. If you don't pass a canvas
<add>into three.js it will create one for you but then you have to add it
<add>to your document. Where to add it may change depending on your use case
<add>and you'll have to change your code so I find that passing a canvas
<add>to three.js feels a little more flexible. I can put the canvas anywhere
<add>and the code will find it whereas if I had code to insert the canvas
<add>into to the document I'd likely have to change that code if my use case
<add>changed.
<add>
<add>Next up we need a camera. We'll create a `PerspectiveCamera`.
<add>
<add>```js
<add>const fov = 75;
<add>const aspect = 2; // the canvas default
<add>const near = 0.1;
<add>const far = 5;
<add>const camera = new THREE.PerspectiveCamera(fov, aspect, near, far);
<add>```
<add>
<add>`fov` is short for `field of view`. In this case 75 degrees in the vertical
<add>dimension. Note that most angles in three.js are in radians but for some
<add>reason the perspective camera takes degrees.
<add>
<add>`aspect` is the display aspect of the canvas. We'll go over the details
<add>[in another article](threejs-responsive.html) but by default a canvas is
<add> 300x150 pixels which makes the aspect 300/150 or 2.
<add>
<add>`near` and `far` represent the space in front of the camera
<add>that will be rendered. Anything before that range or after that range
<add>will be clipped (not drawn).
<add>
<add>Those four settings define a *"frustum"*. A *frustum* is the name of
<add>a 3d shape that is like a pyramid with the tip sliced off. In other
<add>words think of the word "frustum" as another 3D shape like sphere,
<add>cube, prism, frustum.
<add>
<add><img src="resources/frustum-3d.svg" width="500" class="threejs_center"/>
<add>
<add>The height of the near and far planes are determined by the field of view.
<add>The width of both planes is determined by the field of view and the aspect.
<add>
<add>Anything inside the defined frustum will be be drawn. Anything outside
<add>will not.
<add>
<add>The camera defaults to looking down the -Z axis with +Y up. We'll put our cube
<add>at the origin so we need to move the camera back a little from the origin
<add>in order to see anything.
<add>
<add>```js
<add>camera.position.z = 2;
<add>```
<add>
<add>Here's what we're aiming for.
<add>
<add><img src="resources/scene-down.svg" width="500" class="threejs_center"/>
<add>
<add>In the diagram above we can see our camera is at `z = 2`. It's looking
<add>down the -Z axis. Our frustum starts 0.1 units from the front of the camera
<add>and goes to 5 units in front of the camera. Because in this diagram we are looking down,
<add>the field of view is affected by the aspect. Our canvas is twice as wide
<add>as it is tall so across the canvas the field of view will be much wider than
<add>our specified 75 degrees which is the vertical field of view.
<add>
<add>Next we make a `Scene`. A `Scene` in three.js is the root of a form of scene graph.
<add>Anything you want three.js to draw needs to be added to the scene. We'll
<add>cover more details of [how scenes work in a future article](threejs-scenegraph.html).
<add>
<add>```js
<add>const scene = new THREE.Scene();
<add>```
<add>
<add>Next up we create a `BoxGeometry` which contains the data for a box.
<add>Almost anything we want to display in Three.js needs geometry which defines
<add>the vertices that make up our 3D object.
<add>
<add>```js
<add>const boxWidth = 1;
<add>const boxHeight = 1;
<add>const boxDepth = 1;
<add>const geometry = new THREE.BoxGeometry(boxWidth, boxHeight, boxDepth);
<add>```
<add>
<add>We then create a basic material and set its color. Colors can
<add>be specified using standard CSS style 6 digit hex color values.
<add>
<add>```js
<add>const material = new THREE.MeshBasicMaterial({color: 0x44aa88});
<add>```
<add>
<add>We then create a `Mesh`. A `Mesh` in three represents the combination
<add>of a three things
<add>
<add>1. A `Geometry` (the shape of the object)
<add>2. A `Material` (how to draw the object, shiny or flat, what color, what texture(s) to apply. Etc.)
<add>3. The position, orientation, and scale of that object in the scene relative to its parent. In the code below that parent is the scene.
<add>
<add>```js
<add>const cube = new THREE.Mesh(geometry, material);
<add>```
<add>
<add>And finally we add that mesh to the scene
<add>
<add>```js
<add>scene.add(cube);
<add>```
<add>
<add>We can then render the scene by calling the renderer's render function
<add>and passing it the scene and the camera
<add>
<add>```js
<add>renderer.render(scene, camera);
<add>```
<add>
<add>Here's a working example
<add>
<add>{{{example url="../threejs-fundamentals.html" }}}
<add>
<add>It's kind of hard to tell that is a 3D cube since we're viewing
<add>it directly down the -Z axis and the cube itself is axis aligned
<add>so we're only seeing a single face.
<add>
<add>Let's animate it spinning and hopefully that will make
<add>it clear it's being drawn in 3D. To animate it we'll render inside a render loop using
<add>[`requestAnimationFrame`](https://developer.mozilla.org/en-US/docs/Web/API/window/requestAnimationFrame).
<add>
<add>Here's our loop
<add>
<add>```js
<add>function render(time) {
<add> time *= 0.001; // convert time to seconds
<add>
<add> cube.rotation.x = time;
<add> cube.rotation.y = time;
<add>
<add> renderer.render(scene, camera);
<add>
<add> requestAnimationFrame(render);
<add>}
<add>requestAnimationFrame(render);
<add>```
<add>
<add>`requestAnimationFrame` is a request to the browser that you want to animate something.
<add>You pass it a function to be called. In our case that function is `render`. The browser
<add>will call your function and if you update anything related to the display of the
<add>page the browser will re-render the page. In our case we are calling three's
<add>`renderer.render` function which will draw our scene.
<add>
<add>`requestAnimationFrame` passes the time since the page loaded to
<add>our function. That time is passed in milliseconds. I find it's much
<add>easier to work with seconds so here we're converting that to seconds.
<add>
<add>We then set the cube's X and Y rotation to the current time. These rotations
<add>are in [radians](https://en.wikipedia.org/wiki/Radian). There are 2 pi radians
<add>in a circle so our cube should turn around once on each axis in about 6.28
<add>seconds.
<add>
<add>We then render the scene and request another animation frame to continue
<add>our loop.
<add>
<add>Outside the loop we call `requestAnimationFrame` one time to start the loop.
<add>
<add>{{{example url="../threejs-fundamentals-with-animation.html" }}}
<add>
<add>It's a little better but it's still hard to see the 3d. What would help is to
<add>add some lighting so let's add a light. There are many kinds of lights in
<add>three.js which we'll go over in [a future article](threejs-lights.html). For now let's create a directional light.
<add>
<add>```js
<add>{
<add> const color = 0xFFFFFF;
<add> const intensity = 1;
<add> const light = new THREE.DirectionalLight(color, intensity);
<add> light.position.set(-1, 2, 4);
<add> scene.add(light);
<add>}
<add>```
<add>
<add>Directional lights have a position and a target. Both default to 0, 0, 0. In our
<add>case we're setting the light's position to -1, 2, 4 so it's slightly on the left,
<add>above, and behind our camera. The target is still 0, 0, 0 so it will shine
<add>toward the origin.
<add>
<add>We also need to change the material. The `MeshBasicMaterial` is not affected by
<add>lights. Let's change it to a `MeshPhongMaterial` which is affected by lights.
<add>
<add>```js
<add>-const material = new THREE.MeshBasicMaterial({color: 0x44aa88}); // greenish blue
<add>+const material = new THREE.MeshPhongMaterial({color: 0x44aa88}); // greenish blue
<add>```
<add>
<add>Here is our new program structure
<add>
<add><div class="threejs_center"><img src="resources/images/threejs-1cube-with-directionallight.svg" style="width: 500px;"></div>
<add>
<add>And here it is working.
<add>
<add>{{{example url="../threejs-fundamentals-with-light.html" }}}
<add>
<add>It should now be pretty clearly 3D.
<add>
<add>Just for the fun of it let's add 2 more cubes.
<add>
<add>We'll use the same geometry for each cube but make a different
<add>material so each cube can be a different color.
<add>
<add>First we'll make a function that creates a new material
<add>with the specified color. Then it creates a mesh using
<add>the specified geometry and adds it to the scene and
<add>sets its X position.
<add>
<add>```js
<add>function makeInstance(geometry, color, x) {
<add> const material = new THREE.MeshPhongMaterial({color});
<add>
<add> const cube = new THREE.Mesh(geometry, material);
<add> scene.add(cube);
<add>
<add> cube.position.x = x;
<add>
<add> return cube;
<add>}
<add>```
<add>
<add>Then we'll call it 3 times with 3 different colors and X positions
<add>saving the `Mesh` instances in an array.
<add>
<add>```js
<add>const cubes = [
<add> makeInstance(geometry, 0x44aa88, 0),
<add> makeInstance(geometry, 0x8844aa, -2),
<add> makeInstance(geometry, 0xaa8844, 2),
<add>];
<add>```
<add>
<add>Finally we'll spin all 3 cubes in our render function. We
<add>compute a slightly different rotation for each one.
<add>
<add>```js
<add>function render(time) {
<add> time *= 0.001; // convert time to seconds
<add>
<add> cubes.forEach((cube, ndx) => {
<add> const speed = 1 + ndx * .1;
<add> const rot = time * speed;
<add> cube.rotation.x = rot;
<add> cube.rotation.y = rot;
<add> });
<add>
<add> ...
<add>```
<add>
<add>and here's that.
<add>
<add>{{{example url="../threejs-fundamentals-3-cubes.html" }}}
<add>
<add>If you compare it to the top down diagram above you can see
<add>it matches our expectations. With cubes at X = -2 and X = +2
<add>they are partially outside our frustum. They are also
<add>somewhat exaggeratedly warped since the field of view
<add>across the canvas is so extreme.
<add>
<add>Our program now has this structure
<add>
<add><div class="threejs_center"><img src="resources/images/threejs-3cubes-scene.svg" style="width: 610px;"></div>
<add>
<add>As you can see we have 3 `Mesh` objects each referencing the same `BoxGeometry`.
<add>Each `Mesh` references a unique `MeshPhongMaterial` so that each cube can have
<add>a different color.
<add>
<add>I hope this short intro helps to get things started. [Next up we'll cover
<add>making our code responsive so it is adaptable to multiple situations](threejs-responsive.html).
<add>
<add><div id="es6" class="threejs_bottombar">
<add><h3>es6 modules, three.js, and folder structure</h3>
<add><p>As of version r106 the preferred way to use three.js is via <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/import">es6 modules</a>.</p>
<add><p>
<add>es6 modules can be loaded via the <code>import</code> keyword in a script
<add>or inline via a <code><script type="module"></code> tag. Here's an example of
<add>both
<add></p>
<add><pre class=prettyprint>
<add><script type="module">
<add>import * as THREE from './resources/threejs/r125/build/three.module.js';
<add>
<add>...
<add>
<add></script>
<add></pre>
<add><p>
<add>Paths must be absolute or relative. Relative paths always start with <code>./</code> or <code>../</code>
<add>which is different than other tags like <code><img></code> and <code><a></code>.
<add></p>
<add><p>
<add>References to the same script will only be loaded once as long as their absolute paths
<add>are exactly the same. For three.js this means it's required that you put all the examples
<add>libraries in the correct folder structure
<add></p>
<add><pre class="dos">
<add>someFolder
<add> |
<add> ├-build
<add> | |
<add> | +-three.module.js
<add> |
<add> +-examples
<add> |
<add> +-jsm
<add> |
<add> +-controls
<add> | |
<add> | +-OrbitControls.js
<add> | +-TrackballControls.js
<add> | +-...
<add> |
<add> +-loaders
<add> | |
<add> | +-GLTFLoader.js
<add> | +-...
<add> |
<add> ...
<add></pre>
<add><p>
<add>The reason this folder structure is required is because the scripts in the
<add>examples like <a href="https://github.com/mrdoob/three.js/blob/master/examples/jsm/controls/OrbitControls.js"><code>OrbitControls.js</code></a>
<add>have hard coded relative paths like
<add></p>
<add><pre class="prettyprint">
<add>import * as THREE from '../../../build/three.module.js';
<add></pre>
<add><p>
<add>Using the same structure assures then when you import both three and one of the example
<add>libraries they'll both reference the same <code>three.module.js</code> file.
<add></p>
<add><pre class="prettyprint">
<add>import * as THREE from './someFolder/build/three.module.js';
<add>import {OrbitControls} from './someFolder/examples/jsm/controls/OrbitControls.js';
<add></pre>
<add><p>This includes when using a CDN. Be sure your path to <code>three.module.js</code> ends with
<add><code>/build/three.modules.js</code>. For example</p>
<add><pre class="prettyprint">
<add>import * as THREE from 'https://unpkg.com/three@0.108.0<b>/build/three.module.js</b>';
<add>import {OrbitControls} from 'https://unpkg.com/three@0.108.0/examples/jsm/controls/OrbitControls.js';
<add></pre>
<add><p>If you'd prefer the old <code><script src="path/to/three.js"></script></code> style
<add>you can check out <a href="https://r105.threejsfundamentals.org">an older version of this site</a>.
<add>Three.js has a policy of not worrying about backward compatibility. They expect you to use a specific
<add>version, as in you're expected to download the code and put it in your project. When upgrading to a newer version
<add>you can read the <a href="https://github.com/mrdoob/three.js/wiki/Migration-Guide">migration guide</a> to
<add>see what you need to change. It would be too much work to maintain both an es6 module and a class script
<add>version of this site so going forward this site will only show es6 module style. As stated elsewhere,
<add>to support legacy browsers look into a <a href="https://babeljs.io">transpiler</a>.</p>
<add></div>
<add>
<add><!-- needed in English only to prevent warning from outdated translations -->
<add><a href="threejs-geometry.html"></a>
<add><a href="Geometry"></a>
<ide>\ No newline at end of file | 1 |
Ruby | Ruby | use new routing dsl in tests | 2be5e088d27f17cd7210cbfd227aff2e5be6b800 | <ide><path>actionpack/test/abstract_unit.rb
<ide> class ActiveSupport::TestCase
<ide> # have been loaded.
<ide> setup_once do
<ide> ActionController::Routing::Routes.draw do |map|
<del> map.connect ':controller/:action/:id'
<add> match ':controller(/:action(/:id))'
<ide> end
<ide> end
<ide> end
<ide><path>actionpack/test/activerecord/active_record_store_test.rb
<ide> def test_allows_session_fixation
<ide> def with_test_route_set(options = {})
<ide> with_routing do |set|
<ide> set.draw do |map|
<del> map.connect "/:action", :controller => "active_record_store_test/test"
<add> match ':action', :to => 'active_record_store_test/test'
<ide> end
<ide> @app = ActiveRecord::SessionStore.new(set, options.reverse_merge(:key => '_session_id'))
<ide> yield
<ide><path>actionpack/test/controller/action_pack_assertions_test.rb
<ide> def test_post
<ide> def test_assert_redirect_to_named_route
<ide> with_routing do |set|
<ide> set.draw do |map|
<del> map.route_one 'route_one', :controller => 'action_pack_assertions', :action => 'nothing'
<del> map.connect ':controller/:action/:id'
<add> match 'route_one', :to => 'action_pack_assertions#nothing', :as => :route_one
<add> match ':controller/:action'
<ide> end
<ide> set.install_helpers
<ide>
<ide> def test_assert_redirect_to_named_route
<ide> def test_assert_redirect_to_named_route_failure
<ide> with_routing do |set|
<ide> set.draw do |map|
<del> map.route_one 'route_one', :controller => 'action_pack_assertions', :action => 'nothing', :id => 'one'
<del> map.route_two 'route_two', :controller => 'action_pack_assertions', :action => 'nothing', :id => 'two'
<del> map.connect ':controller/:action/:id'
<add> match 'route_one', :to => 'action_pack_assertions#nothing', :as => :route_one
<add> match 'route_two', :to => 'action_pack_assertions#nothing', :id => 'two', :as => :route_two
<add> match ':controller/:action'
<ide> end
<ide> process :redirect_to_named_route
<ide> assert_raise(ActiveSupport::TestCase::Assertion) do
<ide> def test_assert_redirect_to_named_route_failure
<ide> def test_assert_redirect_to_nested_named_route
<ide> with_routing do |set|
<ide> set.draw do |map|
<del> map.admin_inner_module 'admin/inner_module', :controller => 'admin/inner_module', :action => 'index'
<del> map.connect ':controller/:action/:id'
<add> match 'admin/inner_module', :to => 'admin/inner_module#index', :as => :admin_inner_module
<add> match ':controller/:action'
<ide> end
<ide> @controller = Admin::InnerModuleController.new
<ide> process :redirect_to_index
<ide> def test_assert_redirect_to_nested_named_route
<ide> def test_assert_redirected_to_top_level_named_route_from_nested_controller
<ide> with_routing do |set|
<ide> set.draw do |map|
<del> map.top_level '/action_pack_assertions/:id', :controller => 'action_pack_assertions', :action => 'index'
<del> map.connect ':controller/:action/:id'
<add> match '/action_pack_assertions/:id', :to => 'action_pack_assertions#index', :as => :top_level
<add> match ':controller/:action'
<ide> end
<ide> @controller = Admin::InnerModuleController.new
<ide> process :redirect_to_top_level_named_route
<ide> def test_assert_redirected_to_top_level_named_route_with_same_controller_name_in
<ide> with_routing do |set|
<ide> set.draw do |map|
<ide> # this controller exists in the admin namespace as well which is the only difference from previous test
<del> map.top_level '/user/:id', :controller => 'user', :action => 'index'
<del> map.connect ':controller/:action/:id'
<add> match '/user/:id', :to => 'user#index', :as => :top_level
<add> match ':controller/:action'
<ide> end
<ide> @controller = Admin::InnerModuleController.new
<ide> process :redirect_to_top_level_named_route
<ide><path>actionpack/test/controller/base_test.rb
<ide> def setup
<ide> def test_default_url_options_are_used_if_set
<ide> with_routing do |set|
<ide> set.draw do |map|
<del> map.default_url_options 'default_url_options', :controller => 'default_url_options'
<del> map.connect ':controller/:action/:id'
<add> match 'default_url_options', :to => 'default_url_options#default_url_options_action', :as => :default_url_options
<add> match ':controller/:action'
<ide> end
<ide>
<ide> get :default_url_options_action # Make a dummy request so that the controller is initialized properly.
<ide> class EnsureNamedRoutesWorksTicket22BugTest < ActionController::TestCase
<ide> def test_named_routes_still_work
<ide> with_routing do |set|
<ide> set.draw do |map|
<del> map.resources :things
<add> resources :things
<ide> end
<ide> EmptyController.send :include, ActionController::UrlWriter
<ide>
<ide><path>actionpack/test/controller/mime_responds_test.rb
<ide> def test_not_acceptable
<ide> def with_test_route_set
<ide> with_routing do |set|
<ide> set.draw do |map|
<del> map.resources :customers
<del> map.resources :quiz_stores, :has_many => :customers
<del> map.connect ":controller/:action/:id"
<add> resources :customers
<add> resources :quiz_stores do
<add> resources :customers
<add> end
<add> match ":controller/:action"
<ide> end
<ide> yield
<ide> end
<ide><path>actionpack/test/controller/redirect_test.rb
<ide> def test_redirect_to_back_with_no_referer
<ide> def test_redirect_to_record
<ide> with_routing do |set|
<ide> set.draw do |map|
<del> map.resources :workshops
<del> map.connect ':controller/:action/:id'
<add> resources :workshops
<add> match ':controller/:action'
<ide> end
<ide>
<ide> get :redirect_to_existing_record
<ide><path>actionpack/test/controller/render_test.rb
<ide> def conditional_hello
<ide> render :action => 'hello_world'
<ide> end
<ide> end
<del>
<add>
<ide> def conditional_hello_with_public_header
<ide> if stale?(:last_modified => Time.now.utc.beginning_of_day, :etag => [:foo, 123], :public => true)
<ide> render :action => 'hello_world'
<ide> end
<ide> end
<del>
<add>
<ide> def conditional_hello_with_public_header_and_expires_at
<ide> expires_in 1.minute
<ide> if stale?(:last_modified => Time.now.utc.beginning_of_day, :etag => [:foo, 123], :public => true)
<ide> render :action => 'hello_world'
<ide> end
<ide> end
<del>
<add>
<ide> def conditional_hello_with_expires_in
<ide> expires_in 60.1.seconds
<ide> render :action => 'hello_world'
<ide> end
<del>
<add>
<ide> def conditional_hello_with_expires_in_with_public
<ide> expires_in 1.minute, :public => true
<ide> render :action => 'hello_world'
<ide> end
<del>
<add>
<ide> def conditional_hello_with_expires_in_with_public_with_more_keys
<ide> expires_in 1.minute, :public => true, 'max-stale' => 5.hours
<ide> render :action => 'hello_world'
<ide> end
<del>
<add>
<ide> def conditional_hello_with_expires_in_with_public_with_more_keys_old_syntax
<ide> expires_in 1.minute, :public => true, :private => nil, 'max-stale' => 5.hours
<ide> render :action => 'hello_world'
<ide> def layout_test
<ide> def builder_layout_test
<ide> render :action => "hello", :layout => "layouts/builder"
<ide> end
<del>
<add>
<ide> # :move: test this in ActionView
<ide> def builder_partial_test
<ide> render :action => "hello_world_container"
<ide> def test_head_with_location_header
<ide> def test_head_with_location_object
<ide> with_routing do |set|
<ide> set.draw do |map|
<del> map.resources :customers
<del> map.connect ':controller/:action/:id'
<add> resources :customers
<add> match ':controller/:action'
<ide> end
<ide>
<ide> get :head_with_location_object
<ide> class ExpiresInRenderTest < ActionController::TestCase
<ide> def setup
<ide> @request.host = "www.nextangle.com"
<ide> end
<del>
<add>
<ide> def test_expires_in_header
<ide> get :conditional_hello_with_expires_in
<ide> assert_equal "max-age=60, private", @response.headers["Cache-Control"]
<ide> end
<del>
<add>
<ide> def test_expires_in_header_with_public
<ide> get :conditional_hello_with_expires_in_with_public
<ide> assert_equal "max-age=60, public", @response.headers["Cache-Control"]
<ide> end
<del>
<add>
<ide> def test_expires_in_header_with_additional_headers
<ide> get :conditional_hello_with_expires_in_with_public_with_more_keys
<ide> assert_equal "max-age=60, public, max-stale=18000", @response.headers["Cache-Control"]
<ide> end
<del>
<add>
<ide> def test_expires_in_old_syntax
<ide> get :conditional_hello_with_expires_in_with_public_with_more_keys_old_syntax
<ide> assert_equal "max-age=60, public, max-stale=18000", @response.headers["Cache-Control"]
<ide> def test_etag_with_bang_should_obey_if_none_match
<ide> get :conditional_hello_with_bangs
<ide> assert_response :not_modified
<ide> end
<del>
<add>
<ide> def test_etag_with_public_true_should_set_header
<ide> get :conditional_hello_with_public_header
<ide> assert_equal "public", @response.headers['Cache-Control']
<ide> end
<del>
<add>
<ide> def test_etag_with_public_true_should_set_header_and_retain_other_headers
<ide> get :conditional_hello_with_public_header_and_expires_at
<ide> assert_equal "max-age=60, public", @response.headers['Cache-Control']
<ide><path>actionpack/test/controller/render_xml_test.rb
<ide> def test_rendering_xml_should_call_to_xml_if_possible
<ide> def test_rendering_with_object_location_should_set_header_with_url_for
<ide> with_routing do |set|
<ide> set.draw do |map|
<del> map.resources :customers
<del> map.connect ':controller/:action/:id'
<add> resources :customers
<add> match ':controller/:action'
<ide> end
<ide>
<ide> get :render_with_object_location
<ide><path>actionpack/test/controller/test_test.rb
<ide> def test_binary_content_works_with_send_file
<ide> assert_nothing_raised(NoMethodError) { @response.binary_content }
<ide> end
<ide> end
<del>
<del> protected
<del> def with_foo_routing
<del> with_routing do |set|
<del> set.draw do |map|
<del> map.generate_url 'foo', :controller => 'test'
<del> map.connect ':controller/:action/:id'
<del> end
<del> yield set
<del> end
<del> end
<ide> end
<ide>
<ide> class InferringClassNameTest < ActionController::TestCase
<ide><path>actionpack/test/controller/url_rewriter_test.rb
<ide> def test_relative_url_root_is_respected_for_named_routes
<ide>
<ide> with_routing do |set|
<ide> set.draw do |map|
<del> map.home '/home/sweet/home/:user', :controller => 'home', :action => 'index'
<add> match '/home/sweet/home/:user', :to => 'home#index', :as => :home
<ide> end
<ide>
<ide> kls = Class.new { include ActionController::UrlWriter }
<ide> def test_only_path
<ide> with_routing do |set|
<ide> set.draw do |map|
<ide> match 'home/sweet/home/:user', :to => 'home#index', :as => :home
<del> map.connect ':controller/:action/:id'
<add> match ':controller/:action/:id'
<ide> end
<ide>
<ide> # We need to create a new class in order to install the new named route.
<ide><path>actionpack/test/controller/webservice_test.rb
<ide> def with_params_parsers(parsers = {})
<ide> def with_test_route_set
<ide> with_routing do |set|
<ide> set.draw do |map|
<del> map.with_options :controller => "web_service_test/test" do |c|
<del> c.connect "/", :action => "assign_parameters"
<del> end
<add> match '/', :to => 'web_service_test/test#assign_parameters'
<ide> end
<ide> yield
<ide> end
<ide><path>actionpack/test/dispatch/request/multipart_params_parsing_test.rb
<ide> def parse_multipart(name)
<ide> def with_test_routing
<ide> with_routing do |set|
<ide> set.draw do |map|
<del> map.connect ':action', :controller => "multipart_params_parsing_test/test"
<add> match ':action', :to => 'multipart_params_parsing_test/test'
<ide> end
<ide> yield
<ide> end
<ide><path>actionpack/test/template/atom_feed_helper_test.rb
<ide> def index
<ide> end
<ide>
<ide> protected
<del>
<del> def rescue_action(e)
<del> raise(e)
<del> end
<add> def rescue_action(e)
<add> raise(e)
<add> end
<ide> end
<ide>
<ide> class AtomFeedTest < ActionController::TestCase
<ide> def test_feed_xhtml
<ide> assert_select "summary div p", :text => "after 2"
<ide> end
<ide> end
<del>private
<add>
<add> private
<ide> def with_restful_routing(resources)
<ide> with_routing do |set|
<ide> set.draw do |map|
<del> map.resources(resources)
<add> resources(resources)
<ide> end
<ide> yield
<ide> end
<ide><path>actionpack/test/template/test_case_test.rb
<ide> def render_from_helper
<ide>
<ide> test "is able to use named routes" do
<ide> with_routing do |set|
<del> set.draw { |map| map.resources :contents }
<add> set.draw { |map| resources :contents }
<ide> assert_equal 'http://test.host/contents/new', new_content_url
<ide> assert_equal 'http://test.host/contents/1', content_url(:id => 1)
<ide> end
<ide> end
<ide>
<ide> test "named routes can be used from helper included in view" do
<ide> with_routing do |set|
<del> set.draw { |map| map.resources :contents }
<add> set.draw { |map| resources :contents }
<ide> _helpers.module_eval do
<ide> def render_from_helper
<ide> new_content_url
<ide><path>actionpack/test/template/url_helper_test.rb
<ide> def default_url_options(options = nil)
<ide> def with_url_helper_routing
<ide> with_routing do |set|
<ide> set.draw do |map|
<del> map.show_named_route 'url_helper_controller_test/url_helper/show_named_route', :controller => 'url_helper_controller_test/url_helper', :action => 'show_named_route'
<add> match 'url_helper_controller_test/url_helper/show_named_route', :to => 'url_helper_controller_test/url_helper#show_named_route', :as => :show_named_route
<ide> end
<ide> yield
<ide> end
<ide> def test_link_to_unless_current_shows_link
<ide> def with_restful_routing
<ide> with_routing do |set|
<ide> set.draw do |map|
<del> map.resources :tasks
<add> resources :tasks
<ide> end
<ide> yield
<ide> end
<ide> def test_existing_nested_resource
<ide> def with_restful_routing
<ide> with_routing do |set|
<ide> set.draw do |map|
<del> map.resources :workshops do |w|
<del> w.resources :sessions
<add> resources :workshops do
<add> resources :sessions
<ide> end
<ide> end
<ide> yield | 15 |
Javascript | Javascript | add test to show evalscripts/find problem | 41f62e13643462a88fa7d9015346196f3d37b966 | <ide><path>src/jquery/coreTest.js
<ide> test("removeClass(String) - add three classes and remove again", function() {
<ide> test("removeAttr(String", function() {
<ide> ok( $('#mark').removeAttr("class")[0].className == "", "remove class" );
<ide> });
<add>
<add>test("evalScripts() with no script elements", function() {
<add> expect(2);
<add> stop();
<add> $.ajax({
<add> url: 'data/text.php?' + new Date().getTime(),
<add> success: function(data, status) {
<add> ok ( true, 'before evalScripts()');
<add> jQuery('#output').html(data).evalScripts();
<add> ok ( true, 'after evalScripts()');
<add> start();
<add> }
<add> });
<add>}); | 1 |
PHP | PHP | add some coverage to fixtureschemaextension | 1754dc52a7836ce29f7045eaeef0ebcca4682820 | <ide><path>tests/TestCase/TestSuite/FixtureSchemaExtensionTest.php
<add><?php
<add>declare(strict_types=1);
<add>
<add>/**
<add> * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
<add> * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<add> *
<add> * Licensed under The MIT License
<add> * For full copyright and license information, please see the LICENSE.txt
<add> * Redistributions of files must retain the above copyright notice.
<add> *
<add> * @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
<add> * @link https://cakephp.org CakePHP(tm) Project
<add> * @since 4.3.0
<add> * @license https://opensource.org/licenses/mit-license.php MIT License
<add> */
<add>namespace Cake\Test\TestCase\TestSuite;
<add>
<add>use Cake\Database\Connection;
<add>use Cake\Database\Driver\Sqlite;
<add>use Cake\Datasource\ConnectionManager;
<add>use Cake\TestSuite\FixtureSchemaExtension;
<add>use Cake\TestSuite\TestCase;
<add>
<add>class FixtureSchemaExtensionTest extends TestCase
<add>{
<add> /**
<add> * Test connection aliasing during construction.
<add> *
<add> * @return void
<add> */
<add> public function testConnectionAliasing()
<add> {
<add> $this->skipIf(!extension_loaded('pdo_sqlite'), 'Requires SQLite extension');
<add> ConnectionManager::setConfig('test_fixture_schema', [
<add> 'className' => Connection::class,
<add> 'driver' => Sqlite::class,
<add> 'database' => TMP . 'fixture_schema.sqlite',
<add> ]);
<add> $this->assertNotContains('fixture_schema', ConnectionManager::configured());
<add> $extension = new FixtureSchemaExtension();
<add>
<add> $this->assertContains('test_fixture_schema', ConnectionManager::configured());
<add> $this->assertSame(
<add> ConnectionManager::get('test_fixture_schema'),
<add> ConnectionManager::get('fixture_schema')
<add> );
<add> $this->assertSame(
<add> ConnectionManager::get('test'),
<add> ConnectionManager::get('default')
<add> );
<add> $this->assertNull($extension->executeBeforeFirstTest());
<add> ConnectionManager::drop('test_fixture_schema');
<add> }
<add>} | 1 |
Python | Python | fix typo in unit test | 6cc11224fb4c77a03b31bd8317e861eedb3b2d42 | <ide><path>tests/keras/legacy/interface_test.py
<ide> def test_gaussiannoise_legacy_interface():
<ide>
<ide> @keras_test
<ide> def test_maxpooling2d_legacy_interface():
<del> old_layer = keras.layers.MaxPooling2D(pool_length=2, border_mode='valid', name='maxpool2d')
<del> new_layer = keras.layers.MaxPooling2D(pool_size=2, padding='valid', name='maxpool2dd')
<add> old_layer = keras.layers.MaxPool2D(pool_length=2, border_mode='valid', name='maxpool2d')
<add> new_layer = keras.layers.MaxPool2D(pool_size=2, padding='valid', name='maxpool2d')
<ide> assert json.dumps(old_layer.get_config()) == json.dumps(new_layer.get_config())
<ide>
<del> old_layer = keras.layers.MaxPooling2D(2, padding='valid', name='maxpool2d')
<del> new_layer = keras.layers.MaxPooling2D(pool_size=2, padding='valid', name='maxpool2d')
<add> old_layer = keras.layers.MaxPool2D(2, padding='valid', name='maxpool2d')
<add> new_layer = keras.layers.MaxPool2D(pool_size=2, padding='valid', name='maxpool2d')
<ide> assert json.dumps(old_layer.get_config()) == json.dumps(new_layer.get_config())
<ide>
<del> old_layer = keras.layers.MaxPooling2D(2, padding='valid', dim_ordering='tf', name='maxpool2d')
<del> new_layer = keras.layers.MaxPooling2D(pool_size=2, padding='valid', data_format='channels_last', name='maxpool2d')
<add> old_layer = keras.layers.MaxPool2D(2, padding='valid', dim_ordering='tf', name='maxpool2d')
<add> new_layer = keras.layers.MaxPool2D(pool_size=2, padding='valid', data_format='channels_last', name='maxpool2d')
<ide> assert json.dumps(old_layer.get_config()) == json.dumps(new_layer.get_config())
<ide>
<del> old_layer = keras.layers.MaxPooling2D(2, padding='valid', dim_ordering='th', name='maxpool2d')
<del> new_layer = keras.layers.MaxPooling2D(pool_size=2, padding='valid', data_format='channels_first', name='maxpool2d')
<add> old_layer = keras.layers.MaxPool2D(2, padding='valid', dim_ordering='th', name='maxpool2d')
<add> new_layer = keras.layers.MaxPool2D(pool_size=2, padding='valid', data_format='channels_first', name='maxpool2d')
<ide> assert json.dumps(old_layer.get_config()) == json.dumps(new_layer.get_config())
<ide>
<del> old_layer = keras.layers.MaxPooling2D(2, padding='valid', dim_ordering='default', name='maxpool2d')
<del> new_layer = keras.layers.MaxPooling2D(pool_size=2, padding='valid', name='maxpool2d')
<add> old_layer = keras.layers.MaxPool2D(2, padding='valid', dim_ordering='default', name='maxpool2d')
<add> new_layer = keras.layers.MaxPool2D(pool_size=2, padding='valid', name='maxpool2d')
<ide> assert json.dumps(old_layer.get_config()) == json.dumps(new_layer.get_config())
<ide>
<ide>
<ide> @keras_test
<ide> def test_avgpooling2d_legacy_interface():
<del> old_layer = keras.layers.AveragePooling2D(pool_length=2, border_mode='valid', name='avgpooling2d')
<del> new_layer = keras.layers.AveragePooling2D(pool_size=2, padding='valid', name='avgpooling2d')
<add> old_layer = keras.layers.AvgPool2D(pool_length=2, border_mode='valid', name='avgpooling2d')
<add> new_layer = keras.layers.AvgPool2D(pool_size=2, padding='valid', name='avgpooling2d')
<ide> assert json.dumps(old_layer.get_config()) == json.dumps(new_layer.get_config())
<ide>
<del> old_layer = keras.layers.AveragePooling2D(2, padding='valid', name='avgpooling2d')
<del> new_layer = keras.layers.AveragePooling2D(pool_size=2, padding='valid', name='avgpooling2d')
<add> old_layer = keras.layers.AvgPool2D(2, padding='valid', name='avgpooling2d')
<add> new_layer = keras.layers.AvgPool2D(pool_size=2, padding='valid', name='avgpooling2d')
<ide> assert json.dumps(old_layer.get_config()) == json.dumps(new_layer.get_config())
<ide>
<del> old_layer = keras.layers.AveragePooling2D(2, padding='valid', dim_ordering='tf', name='avgpooling2d')
<del> new_layer = keras.layers.AveragePooling2D(pool_size=2, padding='valid', data_format='channels_last', name='avgpooling2d')
<add> old_layer = keras.layers.AvgPool2D(2, padding='valid', dim_ordering='tf', name='avgpooling2d')
<add> new_layer = keras.layers.AvgPool2D(pool_size=2, padding='valid', data_format='channels_last', name='avgpooling2d')
<ide> assert json.dumps(old_layer.get_config()) == json.dumps(new_layer.get_config())
<ide>
<del> old_layer = keras.layers.AveragePooling2D(2, padding='valid', dim_ordering='th', name='avgpooling2d')
<del> new_layer = keras.layers.AveragePooling2D(pool_size=2, padding='valid', data_format='channels_first', name='avgpooling2d')
<add> old_layer = keras.layers.AvgPool2D(2, padding='valid', dim_ordering='th', name='avgpooling2d')
<add> new_layer = keras.layers.AvgPool2D(pool_size=2, padding='valid', data_format='channels_first', name='avgpooling2d')
<ide> assert json.dumps(old_layer.get_config()) == json.dumps(new_layer.get_config())
<ide>
<del> old_layer = keras.layers.AveragePooling2D(2, padding='valid', dim_ordering='default', name='avgpooling2d')
<del> new_layer = keras.layers.AveragePooling2D(pool_size=2, padding='valid', name='avgpooling2d')
<add> old_layer = keras.layers.AvgPool2D(2, padding='valid', dim_ordering='default', name='avgpooling2d')
<add> new_layer = keras.layers.AvgPool2D(pool_size=2, padding='valid', name='avgpooling2d')
<ide>
<ide>
<ide> if __name__ == '__main__': | 1 |
Java | Java | add getlasthandler to websockethandlerdecorator | 5feac077381b8cabe90c54f0c6f63fe8f8047b8a | <ide><path>spring-websocket/src/main/java/org/springframework/web/socket/support/WebSocketHandlerDecorator.java
<ide> public WebSocketHandler getDelegate() {
<ide> return this.delegate;
<ide> }
<ide>
<add> public WebSocketHandler getLastHandler() {
<add> WebSocketHandler result = delegate;
<add> while (result instanceof WebSocketHandlerDecorator) {
<add> result = ((WebSocketHandlerDecorator) result).getDelegate();
<add> }
<add> return result;
<add> }
<add>
<ide> @Override
<ide> public void afterConnectionEstablished(WebSocketSession session) throws Exception {
<ide> this.delegate.afterConnectionEstablished(session);
<ide><path>spring-websocket/src/test/java/org/springframework/web/socket/support/WebSocketHandlerDecoratorTests.java
<add>/*
<add> * Copyright 2002-2013 the original author or authors.
<add> *
<add> * Licensed under the Apache License, Version 2.0 (the "License");
<add> * you may not use this file except in compliance with the License.
<add> * You may obtain a copy of the License at
<add> *
<add> * http://www.apache.org/licenses/LICENSE-2.0
<add> *
<add> * Unless required by applicable law or agreed to in writing, software
<add> * distributed under the License is distributed on an "AS IS" BASIS,
<add> * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
<add> * See the License for the specific language governing permissions and
<add> * limitations under the License.
<add> */
<add>
<add>package org.springframework.web.socket.support;
<add>
<add>import org.junit.Test;
<add>import org.springframework.web.socket.adapter.WebSocketHandlerAdapter;
<add>
<add>import static org.junit.Assert.*;
<add>
<add>
<add>/**
<add> * Test fixture for {@link WebSocketHandlerDecorator}.
<add> *
<add> * @author Rossen Stoyanchev
<add> */
<add>public class WebSocketHandlerDecoratorTests {
<add>
<add>
<add> @Test
<add> public void getLastHandler() {
<add> WebSocketHandlerAdapter h1 = new WebSocketHandlerAdapter();
<add> WebSocketHandlerDecorator h2 = new WebSocketHandlerDecorator(h1);
<add> WebSocketHandlerDecorator h3 = new WebSocketHandlerDecorator(h2);
<add>
<add> assertSame(h1, h3.getLastHandler());
<add> }
<add>
<add>} | 2 |
PHP | PHP | use baseclass instead of full alias for the mock | a2e77ca1df4c3a5d158aa5c9e22bab432cb8217e | <ide><path>src/TestSuite/TestCase.php
<ide> public function getMockForModel($alias, array $methods = array(), array $options
<ide> $options += TableRegistry::config($alias);
<ide>
<ide> $mock = $this->getMock($options['className'], $methods, [$options]);
<del> TableRegistry::set($alias, $mock);
<add> TableRegistry::set($baseClass, $mock);
<ide> return $mock;
<ide> }
<ide> | 1 |
Ruby | Ruby | add missing require and remove extra module | b8f6dd8cbb2de870a4805800fd89148a417bc612 | <ide><path>activemodel/lib/active_model/secure_password.rb
<add>require 'active_support/core_ext/object/blank'
<ide> require 'bcrypt'
<ide>
<ide> module ActiveModel
<ide> def has_secure_password
<ide> end
<ide> end
<ide>
<del> module InstanceMethods
<del> # Returns self if the password is correct, otherwise false.
<del> def authenticate(unencrypted_password)
<del> if BCrypt::Password.new(password_digest) == unencrypted_password
<del> self
<del> else
<del> false
<del> end
<add> # Returns self if the password is correct, otherwise false.
<add> def authenticate(unencrypted_password)
<add> if BCrypt::Password.new(password_digest) == unencrypted_password
<add> self
<add> else
<add> false
<ide> end
<add> end
<ide>
<del> # Encrypts the password into the password_digest attribute.
<del> def password=(unencrypted_password)
<del> @password = unencrypted_password
<del> self.password_digest = BCrypt::Password.create(unencrypted_password)
<del> end
<add> # Encrypts the password into the password_digest attribute.
<add> def password=(unencrypted_password)
<add> @password = unencrypted_password
<add> self.password_digest = BCrypt::Password.create(unencrypted_password)
<add> end
<ide>
<add> private
<ide>
<del> private
<del> def password_must_be_strong
<del> if password.present?
<del> errors.add(:password, "must be longer than 6 characters") unless password.size > 6
<del> errors.add(:password, "is too weak and common") if WEAK_PASSWORDS.include?(password)
<del> end
<del> end
<add> def password_must_be_strong
<add> if password.present?
<add> errors.add(:password, "must be longer than 6 characters") unless password.size > 6
<add> errors.add(:password, "is too weak and common") if WEAK_PASSWORDS.include?(password)
<add> end
<ide> end
<ide> end
<ide> end
<ide>\ No newline at end of file | 1 |
Python | Python | fix dictkey initial value | 9098856d46f2bf1a5f191b48b5e7b7e07add4dc7 | <ide><path>rest_framework/fields.py
<ide> def to_representation(self, data):
<ide>
<ide> class DictField(Field):
<ide> child = _UnvalidatedField()
<del> initial = []
<add> initial = {}
<ide> default_error_messages = {
<ide> 'not_a_dict': _('Expected a dictionary of items but got type "{input_type}".')
<ide> } | 1 |
Text | Text | add solutions to html challenges | 722b65d80f594c24d415043583dca05aef7f41e4 | <ide><path>curriculum/challenges/english/01-responsive-web-design/basic-html-and-html5/add-placeholder-text-to-a-text-field.english.md
<ide> tests:
<ide> ## Solution
<ide> <section id='solution'>
<ide>
<del>```js
<del>// solution required
<add>```html
<add><h2>CatPhotoApp</h2>
<add><main>
<add> <p>Click here to view more <a href="#">cat photos</a>.</p>
<add>
<add> <a href="#"><img src="https://bit.ly/fcc-relaxing-cat" alt="A cute orange cat lying on its back."></a>
<add>
<add> <p>Things cats love:</p>
<add> <ul>
<add> <li>cat nip</li>
<add> <li>laser pointers</li>
<add> <li>lasagna</li>
<add> </ul>
<add> <p>Top 3 things cats hate:</p>
<add> <ol>
<add> <li>flea treatment</li>
<add> <li>thunder</li>
<add> <li>other cats</li>
<add> </ol>
<add> <input type="text" placeholder="cat photo URL">
<add></main>
<ide> ```
<ide> </section>
<ide><path>curriculum/challenges/english/01-responsive-web-design/basic-html-and-html5/create-a-set-of-checkboxes.english.md
<ide> tests:
<ide> ## Solution
<ide> <section id='solution'>
<ide>
<del>```js
<del>// solution required
<add>```html
<add><h2>CatPhotoApp</h2>
<add><main>
<add> <p>Click here to view more <a href="#">cat photos</a>.</p>
<add>
<add> <a href="#"><img src="https://bit.ly/fcc-relaxing-cat" alt="A cute orange cat lying on its back."></a>
<add>
<add> <p>Things cats love:</p>
<add> <ul>
<add> <li>cat nip</li>
<add> <li>laser pointers</li>
<add> <li>lasagna</li>
<add> </ul>
<add> <p>Top 3 things cats hate:</p>
<add> <ol>
<add> <li>flea treatment</li>
<add> <li>thunder</li>
<add> <li>other cats</li>
<add> </ol>
<add> <form action="/submit-cat-photo">
<add> <label for="indoor"><input id="indoor" type="radio" name="indoor-outdoor"> Indoor</label>
<add> <label for="outdoor"><input id="outdoor" type="radio" name="indoor-outdoor"> Outdoor</label><br>
<add> <label for="playful"><input id="playful" type="checkbox" name="personality">Playful</label>
<add> <label for="lazy"><input id="lazy" type="checkbox"
<add>name="personality">Lazy</label>
<add> <label for="evil"><input id="evil" type="checkbox"
<add>name="personality">Evil</label><br>
<add> <input type="text" placeholder="cat photo URL" required>
<add> <button type="submit">Submit</button>
<add> </form>
<add></main>
<ide> ```
<ide> </section>
<ide><path>curriculum/challenges/english/01-responsive-web-design/basic-html-and-html5/create-a-set-of-radio-buttons.english.md
<ide> tests:
<ide> ## Solution
<ide> <section id='solution'>
<ide>
<del>```js
<del>// solution required
<add>```html
<add><h2>CatPhotoApp</h2>
<add><main>
<add> <p>Click here to view more <a href="#">cat photos</a>.</p>
<add>
<add> <a href="#"><img src="https://bit.ly/fcc-relaxing-cat" alt="A cute orange cat lying on its back."></a>
<add>
<add> <p>Things cats love:</p>
<add> <ul>
<add> <li>cat nip</li>
<add> <li>laser pointers</li>
<add> <li>lasagna</li>
<add> </ul>
<add> <p>Top 3 things cats hate:</p>
<add> <ol>
<add> <li>flea treatment</li>
<add> <li>thunder</li>
<add> <li>other cats</li>
<add> </ol>
<add> <form action="/submit-cat-photo">
<add> <label for="indoor"><input id="indoor" type="radio" name="indoor-outdoor"> Indoor</label>
<add> <label for="outdoor"><input id="outdoor" type="radio" name="indoor-outdoor"> Outdoor</label><br>
<add> <input type="text" placeholder="cat photo URL" required>
<add> <button type="submit">Submit</button>
<add> </form>
<add></main>
<ide> ```
<ide> </section>
<ide><path>curriculum/challenges/english/01-responsive-web-design/basic-html-and-html5/fill-in-the-blank-with-placeholder-text.english.md
<ide> tests:
<ide> ## Solution
<ide> <section id='solution'>
<ide>
<del>```js
<del>// solution required
<add>```html
<add><h1>Hello World</h1>
<add>
<add><h2>CatPhotoApp</h2>
<add>
<add><p>Kitty ipsum dolor sit amet, shed everywhere shed everywhere stretching attack your ankles chase the red dot, hairball run catnip eat the grass sniff</p>
<ide> ```
<ide> </section>
<ide><path>curriculum/challenges/english/01-responsive-web-design/basic-html-and-html5/inform-with-the-paragraph-element.english.md
<ide> tests:
<ide> ## Solution
<ide> <section id='solution'>
<ide>
<del>```js
<del>// solution required
<add>```html
<add><h1>Hello World</h1>
<add><h2>CatPhotoApp</h2>
<add><p>Hello Paragraph</p>
<ide> ```
<ide> </section>
<ide><path>curriculum/challenges/english/01-responsive-web-design/basic-html-and-html5/link-to-external-pages-with-anchor-elements.english.md
<ide> tests:
<ide> ## Solution
<ide> <section id='solution'>
<ide>
<del>```js
<del>// solution required
<add>```html
<add><h2>CatPhotoApp</h2>
<add><main>
<add>
<add> <img src="https://bit.ly/fcc-relaxing-cat" alt="A cute orange cat lying on its back.">
<add>
<add> <a href="http://freecatphotoapp.com">cat photos</a>
<add> <p>Kitty ipsum dolor sit amet, shed everywhere shed everywhere stretching attack your ankles chase the red dot, hairball run catnip eat the grass sniff.</p>
<add> <p>Purr jump eat the grass rip the couch scratched sunbathe, shed everywhere rip the couch sleep in the sink fluffy fur catnip scratched.</p>
<add></main>
<ide> ```
<ide> </section>
<ide><path>curriculum/challenges/english/01-responsive-web-design/basic-html-and-html5/make-dead-links-using-the-hash-symbol.english.md
<ide> tests:
<ide> ## Solution
<ide> <section id='solution'>
<ide>
<del>```js
<del>// solution required
<add>```html
<add><h2>CatPhotoApp</h2>
<add><main>
<add> <p>Click here to view more <a href="#" target="_blank">cat photos</a>.</p>
<add>
<add> <img src="https://bit.ly/fcc-relaxing-cat" alt="A cute orange cat lying on its back.">
<add>
<add> <p>Kitty ipsum dolor sit amet, shed everywhere shed everywhere stretching attack your ankles chase the red dot, hairball run catnip eat the grass sniff.</p>
<add> <p>Purr jump eat the grass rip the couch scratched sunbathe, shed everywhere rip the couch sleep in the sink fluffy fur catnip scratched.</p>
<add></main>
<ide> ```
<ide> </section>
<ide><path>curriculum/challenges/english/01-responsive-web-design/basic-html-and-html5/nest-an-anchor-element-within-a-paragraph.english.md
<ide> tests:
<ide> ## Solution
<ide> <section id='solution'>
<ide>
<del>```js
<del>// solution required
<add>```html
<add><h2>CatPhotoApp</h2>
<add><main>
<add> <p>View more <a target="_blank" href="http://freecatphotoapp.com">cat photos</a></p>
<add>
<add> <img src="https://bit.ly/fcc-relaxing-cat" alt="A cute orange cat lying on its back.">
<add>
<add> <p>Kitty ipsum dolor sit amet, shed everywhere shed everywhere stretching attack your ankles chase the red dot, hairball run catnip eat the grass sniff.</p>
<add> <p>Purr jump eat the grass rip the couch scratched sunbathe, shed everywhere rip the couch sleep in the sink fluffy fur catnip scratched.</p>
<add></main>
<ide> ```
<ide> </section>
<ide><path>curriculum/challenges/english/01-responsive-web-design/basic-html-and-html5/nest-many-elements-within-a-single-div-element.english.md
<ide> tests:
<ide> ## Solution
<ide> <section id='solution'>
<ide>
<del>```js
<del>// solution required
<add>```html
<add><h2>CatPhotoApp</h2>
<add><main>
<add> <p>Click here to view more <a href="#">cat photos</a>.</p>
<add>
<add> <a href="#"><img src="https://bit.ly/fcc-relaxing-cat" alt="A cute orange cat lying on its back."></a>
<add> <div>
<add> <p>Things cats love:</p>
<add> <ul>
<add> <li>cat nip</li>
<add> <li>laser pointers</li>
<add> <li>lasagna</li>
<add> </ul>
<add> <p>Top 3 things cats hate:</p>
<add> <ol>
<add> <li>flea treatment</li>
<add> <li>thunder</li>
<add> <li>other cats</li>
<add> </ol>
<add> </div>
<add> <form action="/submit-cat-photo">
<add> <label><input type="radio" name="indoor-outdoor" checked> Indoor</label>
<add> <label><input type="radio" name="indoor-outdoor"> Outdoor</label><br>
<add> <label><input type="checkbox" name="personality" checked> Loving</label>
<add> <label><input type="checkbox" name="personality"> Lazy</label>
<add> <label><input type="checkbox" name="personality"> Energetic</label><br>
<add> <input type="text" placeholder="cat photo URL" required>
<add> <button type="submit">Submit</button>
<add> </form>
<add></main>
<ide> ```
<ide> </section>
<ide><path>curriculum/challenges/english/01-responsive-web-design/basic-html-and-html5/turn-an-image-into-a-link.english.md
<ide> tests:
<ide> ## Solution
<ide> <section id='solution'>
<ide>
<del>```js
<del>// solution required
<add>```html
<add><h2>CatPhotoApp</h2>
<add><main>
<add> <p>Click here to view more <a href="#">cat photos</a>.</p>
<add>
<add> <a href="#"><img src="https://bit.ly/fcc-relaxing-cat" alt="A cute orange cat lying on its back."></a>
<add>
<add> <p>Kitty ipsum dolor sit amet, shed everywhere shed everywhere stretching attack your ankles chase the red dot, hairball run catnip eat the grass sniff.</p>
<add> <p>Purr jump eat the grass rip the couch scratched sunbathe, shed everywhere rip the couch sleep in the sink fluffy fur catnip scratched.</p>
<add></main>
<ide> ```
<ide> </section>
<ide><path>curriculum/challenges/english/01-responsive-web-design/basic-html-and-html5/use-html5-to-require-a-field.english.md
<ide> tests:
<ide> ## Solution
<ide> <section id='solution'>
<ide>
<del>```js
<del>// solution required
<add>```html
<add><h2>CatPhotoApp</h2>
<add><main>
<add> <p>Click here to view more <a href="#">cat photos</a>.</p>
<add>
<add> <a href="#"><img src="https://bit.ly/fcc-relaxing-cat" alt="A cute orange cat lying on its back."></a>
<add>
<add> <p>Things cats love:</p>
<add> <ul>
<add> <li>cat nip</li>
<add> <li>laser pointers</li>
<add> <li>lasagna</li>
<add> </ul>
<add> <p>Top 3 things cats hate:</p>
<add> <ol>
<add> <li>flea treatment</li>
<add> <li>thunder</li>
<add> <li>other cats</li>
<add> </ol>
<add> <form action="/submit-cat-photo">
<add> <input type="text" required placeholder="cat photo URL">
<add> <button type="submit">Submit</button>
<add> </form>
<add></main>
<ide> ```
<ide> </section> | 11 |
Javascript | Javascript | remove common.port from test-net-pause | af19f4116c5c3ce0fc7b18b62ffb05e8138bf74b | <ide><path>test/pummel/test-net-pause.js
<ide> // USE OR OTHER DEALINGS IN THE SOFTWARE.
<ide>
<ide> 'use strict';
<del>const common = require('../common');
<add>require('../common');
<ide> const assert = require('assert');
<ide> const net = require('net');
<ide>
<ide> const server = net.createServer((connection) => {
<ide> });
<ide>
<ide> server.on('listening', () => {
<del> const client = net.createConnection(common.PORT);
<add> const client = net.createConnection(server.address().port);
<ide> client.setEncoding('ascii');
<ide> client.on('data', (d) => {
<ide> console.log(d);
<ide> server.on('listening', () => {
<ide> client.end();
<ide> });
<ide> });
<del>server.listen(common.PORT);
<add>server.listen(0);
<ide>
<ide> process.on('exit', () => {
<ide> assert.strictEqual(recv.length, N); | 1 |
PHP | PHP | add configure logging to bootstrappers | b83b9c26a193369361b7c7fef3bcd5220bb49934 | <ide><path>src/Illuminate/Foundation/Bootstrap/ConfigureLogging.php
<add><?php namespace Illuminate\Foundation\Bootstrap;
<add>
<add>use Illuminate\Log\Writer;
<add>use Monolog\Logger as Monolog;
<add>use Illuminate\Contracts\Foundation\Application;
<add>
<add>class ConfigureLogging {
<add>
<add> /**
<add> * Bootstrap the given application.
<add> *
<add> * @param \Illuminate\Contracts\Foundation\Application $app
<add> * @return void
<add> */
<add> public function bootstrap(Application $app)
<add> {
<add> $app->instance('log', new Writer(new Monolog(
<add> $app->environment()), $app['Illuminate\Contracts\Events\Dispatcher']
<add> ));
<add>
<add> $app->bind('Psr\Log\LoggerInterface', function()
<add> {
<add> return $app['log']->getMonolog();
<add> });
<add> }
<add>
<add>}
<add><path>src/Illuminate/Foundation/Bootstrap/DetectEnvironment.php
<del><path>src/Illuminate/Foundation/Bootstrap/LoadEnvironment.php
<ide> use Dotenv;
<ide> use Illuminate\Contracts\Foundation\Application;
<ide>
<del>class LoadEnvironment {
<add>class DetectEnvironment {
<ide>
<ide> /**
<ide> * Bootstrap the given application.
<ide><path>src/Illuminate/Foundation/Console/Kernel.php
<ide> class Kernel implements KernelContract {
<ide> * @return void
<ide> */
<ide> protected $bootstrappers = [
<del> 'Illuminate\Foundation\Bootstrap\LoadEnvironment',
<add> 'Illuminate\Foundation\Bootstrap\DetectEnvironment',
<ide> 'Illuminate\Foundation\Bootstrap\LoadConfiguration',
<add> 'Illuminate\Foundation\Bootstrap\ConfigureLogging',
<ide> 'Illuminate\Foundation\Bootstrap\RegisterFacades',
<ide> 'Illuminate\Foundation\Bootstrap\RegisterProviders',
<ide> 'Illuminate\Foundation\Bootstrap\BootProviders',
<ide><path>src/Illuminate/Foundation/Http/Kernel.php
<ide> class Kernel implements KernelContract {
<ide> * @return void
<ide> */
<ide> protected $bootstrappers = [
<del> 'Illuminate\Foundation\Bootstrap\LoadEnvironment',
<add> 'Illuminate\Foundation\Bootstrap\DetectEnvironment',
<ide> 'Illuminate\Foundation\Bootstrap\LoadConfiguration',
<add> 'Illuminate\Foundation\Bootstrap\ConfigureLogging',
<ide> 'Illuminate\Foundation\Bootstrap\HandleExceptions',
<ide> 'Illuminate\Foundation\Bootstrap\RegisterFacades',
<ide> 'Illuminate\Foundation\Bootstrap\RegisterProviders', | 4 |
PHP | PHP | add datetime support to database binding layer | 94b8582865cf3ec8f436fec9f2c6c9cb15ec3c81 | <ide><path>laravel/database/connection.php
<ide> protected function execute($sql, $bindings = array())
<ide>
<ide> $sql = $this->grammar()->shortcut($sql, $bindings);
<ide>
<add> // Next we need to translate all DateTime bindings to their date-time
<add> // strings that are compatible with the database. Each grammar may
<add> // define it's own date-time format according to its needs.
<add> $datetime = $this->grammar()->datetime;
<add>
<add> for ($i = 0; $i < count($bindings); $i++)
<add> {
<add> if ($bindings[$i] instanceof \DateTime)
<add> {
<add> $bindings[$i] = $bindings[$i]->format($datetime);
<add> }
<add> }
<add>
<ide> // Each database operation is wrapped in a try / catch so we can wrap
<ide> // any database exceptions in our custom exception class, which will
<ide> // set the message to include the SQL and query bindings.
<ide><path>laravel/database/eloquent/model.php
<ide> public static function update($id, $attributes)
<ide> {
<ide> $model = new static(array(), true);
<ide>
<del> if (static::$timestamps) $attributes['updated_at'] = $model->get_timestamp();
<add> if (static::$timestamps) $attributes['updated_at'] = new \DateTime;
<ide>
<ide> return $model->query()->where($model->key(), '=', $id)->update($attributes);
<ide> }
<ide> public function delete()
<ide> */
<ide> protected function timestamp()
<ide> {
<del> $this->updated_at = static::get_timestamp();
<add> $this->updated_at = new \DateTime;
<ide>
<ide> if ( ! $this->exists) $this->created_at = $this->updated_at;
<ide> }
<ide>
<del> /**
<del> * Get the current timestamp in its storable form.
<del> *
<del> * @return mixed
<del> */
<del> public static function get_timestamp()
<del> {
<del> return date('Y-m-d H:i:s');
<del> }
<del>
<ide> /**
<ide> * Get a new fluent query builder instance for the model.
<ide> *
<ide><path>laravel/database/eloquent/relationships/has_many_and_belongs_to.php
<ide> protected function insert_joining($attributes)
<ide> {
<ide> if (Pivot::$timestamps)
<ide> {
<del> $attributes['created_at'] = $this->model->get_timestamp();
<add> $attributes['created_at'] = new \DateTime;
<ide>
<ide> $attributes['updated_at'] = $attributes['created_at'];
<ide> }
<ide><path>laravel/database/eloquent/relationships/has_one_or_many.php
<ide> public function update(array $attributes)
<ide> {
<ide> if ($this->model->timestamps())
<ide> {
<del> $attributes['updated_at'] = $this->model->get_timestamp();
<add> $attributes['updated_at'] = new \DateTime;
<ide> }
<ide>
<ide> return $this->table->update($attributes);
<ide><path>laravel/database/query/grammars/grammar.php
<ide>
<ide> class Grammar extends \Laravel\Database\Grammar {
<ide>
<add> /**
<add> * The format for properly saving a DateTime.
<add> *
<add> * @var string
<add> */
<add> public $datetime = 'Y-m-d H:i:s';
<add>
<ide> /**
<ide> * All of the query componenets in the order they should be built.
<ide> *
<ide><path>laravel/database/query/grammars/sqlserver.php
<ide> class SQLServer extends Grammar {
<ide> */
<ide> protected $wrapper = '[%s]';
<ide>
<add> /**
<add> * The format for properly saving a DateTime.
<add> *
<add> * @var string
<add> */
<add> public $datetime = 'Y-m-d H:i:s.000';
<add>
<ide> /**
<ide> * Compile a SQL SELECT statement from a Query instance.
<ide> *
<ide><path>laravel/database/schema/grammars/postgres.php
<ide> protected function type_boolean(Fluent $column)
<ide> */
<ide> protected function type_date(Fluent $column)
<ide> {
<del> return 'TIMESTAMP';
<add> return 'TIMESTAMP(0) WITHOUT TIME ZONE';
<ide> }
<ide>
<ide> /** | 7 |
Ruby | Ruby | remove the renderer option from the hash | 60ca754b97f1254eebd61da08fb2f58f298fec31 | <ide><path>actionpack/lib/action_controller/metal/renderers.rb
<ide> def _write_render_options
<ide> <<-RUBY_EVAL
<ide> if options.key?(:#{name})
<ide> _process_options(options)
<del> return _render_option_#{name}(options[:#{name}], options)
<add> return _render_option_#{name}(options.delete(:#{name}), options)
<ide> end
<ide> RUBY_EVAL
<ide> end | 1 |
PHP | PHP | add router to aliases | be101265c08aaeec3d6dbea8d7e04adb587000c9 | <ide><path>src/Illuminate/Foundation/Application.php
<ide> public function registerCoreContainerAliases()
<ide> 'redirect' => 'Illuminate\Routing\Redirector',
<ide> 'redis' => ['Illuminate\Redis\Database', 'Illuminate\Contracts\Redis\Database'],
<ide> 'request' => 'Illuminate\Http\Request',
<del> 'router' => 'Illuminate\Routing\Router',
<add> 'router' => ['Illuminate\Routing\Router', 'Illuminate\Contracts\Routing\Registrar'],
<ide> 'session' => 'Illuminate\Session\SessionManager',
<ide> 'session.store' => ['Illuminate\Session\Store', 'Symfony\Component\HttpFoundation\Session\SessionInterface'],
<ide> 'url' => ['Illuminate\Routing\UrlGenerator', 'Illuminate\Contracts\Routing\UrlGenerator'], | 1 |
Python | Python | support multiple metrics in ctl | 5741cef6049a150d5b73e3f034e8b016fa4a8914 | <ide><path>official/modeling/training/distributed_executor.py
<ide> # pylint: disable=unused-import,g-import-not-at-top,redefined-outer-name,reimported
<ide> from typing import Optional, Dict, List, Text, Callable, Union, Iterator, Any
<ide> from official.modeling.hyperparams import params_dict
<add>from official.utils import hyperparams_flags
<ide> from official.utils.misc import distribution_utils
<ide> from official.utils.misc import keras_utils
<del>from official.utils import hyperparams_flags
<ide>
<ide> FLAGS = flags.FLAGS
<ide>
<ide> def _no_metric():
<ide> return None
<ide>
<ide>
<add>def metrics_as_dict(metric):
<add> """Puts input metric(s) into a list.
<add>
<add> Args:
<add> metric: metric(s) to be put into the list. `metric` could be a object, a
<add> list or a dict of tf.keras.metrics.Metric or has the `required_method`.
<add>
<add> Returns:
<add> A dictionary of valid metrics.
<add> """
<add> if isinstance(metric, tf.keras.metrics.Metric):
<add> metrics = {metric.name: metric}
<add> elif isinstance(metric, list):
<add> metrics = {m.name: m for m in metric}
<add> elif isinstance(metric, dict):
<add> metrics = metric
<add> elif not metric:
<add> return {}
<add> else:
<add> metrics = {'metric': metric}
<add> return metrics
<add>
<add>
<add>def metric_results(metric):
<add> """Collects results from the given metric(s)."""
<add> metrics = metrics_as_dict(metric)
<add> metric_result = {
<add> name: m.result().numpy().astype(float) for name, m in metrics.items()
<add> }
<add> return metric_result
<add>
<add>
<add>def reset_states(metric):
<add> """Resets states of the given metric(s)."""
<add> metrics = metrics_as_dict(metric)
<add> for m in metrics.values():
<add> m.reset_states()
<add>
<add>
<ide> class SummaryWriter(object):
<ide> """Simple SummaryWriter for writing dictionary of metrics.
<ide>
<ide> def _create_replicated_step(self,
<ide> loss_fn,
<ide> optimizer,
<ide> metric=None):
<add> metrics = metrics_as_dict(metric)
<ide>
<ide> def _replicated_step(inputs):
<ide> """Replicated training step."""
<ide> def _replicated_step(inputs):
<ide> prediction_loss = loss_fn(labels, outputs)
<ide> loss = tf.reduce_mean(prediction_loss)
<ide> loss = loss / strategy.num_replicas_in_sync
<del> if isinstance(metric, tf.keras.metrics.Metric):
<del> metric.update_state(labels, outputs)
<del> else:
<del> logging.error('train metric is not an instance of '
<del> 'tf.keras.metrics.Metric.')
<add> for m in metrics.values():
<add> m.update_state(labels, outputs)
<ide>
<ide> grads = tape.gradient(loss, model.trainable_variables)
<ide> optimizer.apply_gradients(zip(grads, model.trainable_variables))
<ide> def train_step(iterator, num_steps):
<ide>
<ide> Args:
<ide> iterator: an iterator that yields input tensors.
<add> num_steps: the number of steps in the loop.
<ide>
<ide> Returns:
<ide> The loss tensor.
<ide> def train_step(iterator, num_steps):
<ide>
<ide> def _create_test_step(self, strategy, model, metric):
<ide> """Creates a distributed test step."""
<add> metrics = metrics_as_dict(metric)
<ide>
<ide> @tf.function
<ide> def test_step(iterator):
<ide> """Calculates evaluation metrics on distributed devices."""
<ide> if not metric:
<ide> logging.info('Skip test_step because metric is None (%s)', metric)
<ide> return None, None
<del> if not isinstance(metric, tf.keras.metrics.Metric):
<del> raise ValueError(
<del> 'Metric must be an instance of tf.keras.metrics.Metric '
<del> 'for running in test_step. Actual {}'.format(metric))
<ide>
<ide> def _test_step_fn(inputs):
<ide> """Replicated accuracy calculation."""
<ide> inputs, labels = inputs
<ide> model_outputs = model(inputs, training=False)
<del> metric.update_state(labels, model_outputs)
<add> for m in metrics.values():
<add> m.update_state(labels, model_outputs)
<ide> return labels, model_outputs
<ide>
<ide> return strategy.run(_test_step_fn, args=(next(iterator),))
<ide>
<ide> return test_step
<ide>
<add>
<ide> def train(self,
<ide> train_input_fn: Callable[[params_dict.ParamsDict], tf.data.Dataset],
<ide> eval_input_fn: Callable[[params_dict.ParamsDict],
<ide> def _run_callbacks_on_batch_end(batch):
<ide> test_step = self._create_test_step(strategy, model, metric=eval_metric)
<ide>
<ide> # Step-0 operations
<del> _save_checkpoint(
<del> checkpoint, model_dir, checkpoint_name.format(step=current_step))
<add> if current_step == 0 and not latest_checkpoint_file:
<add> _save_checkpoint(
<add> checkpoint, model_dir, checkpoint_name.format(step=current_step))
<ide> if test_step:
<ide> eval_iterator = self._get_input_iterator(eval_input_fn, strategy)
<ide> eval_metric_result = self._run_evaluation(
<ide> def _run_callbacks_on_batch_end(batch):
<ide> 'Step: %s evalation metric = %s.', current_step, eval_metric_result)
<ide> test_summary_writer(
<ide> metrics=eval_metric_result, step=optimizer.iterations)
<del> eval_metric.reset_states()
<add> reset_states(eval_metric)
<ide>
<ide> logging.info('Training started')
<ide> last_save_checkpoint_step = current_step
<ide> def _run_callbacks_on_batch_end(batch):
<ide> raise ValueError('total loss is NaN.')
<ide>
<ide> if train_metric:
<del> train_metric_result = train_metric.result()
<del> if isinstance(train_metric, tf.keras.metrics.Metric):
<del> train_metric_result = tf.nest.map_structure(
<del> lambda x: x.numpy().astype(float), train_metric_result)
<del> if not isinstance(train_metric_result, dict):
<del> train_metric_result = {'metric': train_metric_result}
<add> train_metric_result = metric_results(train_metric)
<ide> train_metric_result.update(train_loss)
<ide> else:
<ide> train_metric_result = train_loss
<ide> def _run_callbacks_on_batch_end(batch):
<ide>
<ide> # Re-initialize evaluation metric, except the last step.
<ide> if eval_metric and current_step < total_steps:
<del> eval_metric.reset_states()
<add> reset_states(eval_metric)
<ide> if train_metric and current_step < total_steps:
<del> train_metric.reset_states()
<add> reset_states(train_metric)
<ide>
<ide> # Reaches the end of training and saves the last checkpoint.
<ide> if last_save_checkpoint_step < total_steps:
<ide> def _run_evaluation(self, test_step, current_training_step, metric,
<ide> except (StopIteration, tf.errors.OutOfRangeError):
<ide> break
<ide>
<del> metric_result = metric.result()
<del> if isinstance(metric, tf.keras.metrics.Metric):
<del> metric_result = metric_result.numpy().astype(float)
<add> metric_result = metric_results(metric)
<ide> logging.info('Step: [%d] Validation metric = %f', current_training_step,
<ide> metric_result)
<ide> return metric_result
<ide> def evaluate_checkpoint(self,
<ide> logging.info('Step: %s evalation metric = %s.', current_step,
<ide> eval_metric_result)
<ide> summary_writer(metrics=eval_metric_result, step=current_step)
<del> eval_metric.reset_states()
<add> reset_states(eval_metric)
<ide>
<ide> return eval_metric_result, current_step
<ide> | 1 |
Java | Java | add switch for enabling nodes screenshot tests | 6b80f11652d7937ace7fbe867c7d6cfacb7cab01 | <ide><path>ReactAndroid/src/androidTest/java/com/facebook/react/testing/ReactAppTestActivity.java
<ide> import com.facebook.react.ReactPackage;
<ide> import com.facebook.react.ReactRootView;
<ide> import com.facebook.react.shell.MainReactPackage;
<del>
<add>import com.facebook.react.uimanager.UIImplementationProvider;
<ide>
<ide> public class ReactAppTestActivity extends FragmentActivity implements
<ide> DefaultHardwareBackBtnHandler
<ide> public void loadApp(String appKey, ReactInstanceSpecForTest spec, String bundleN
<ide> loadApp(appKey, spec, null, bundleName, false /* = useDevSupport */);
<ide> }
<ide>
<add> public void loadApp(
<add> String appKey,
<add> ReactInstanceSpecForTest spec,
<add> String bundleName,
<add> UIImplementationProvider uiImplementationProvider) {
<add> loadApp(appKey, spec, null, bundleName, false /* = useDevSupport */, uiImplementationProvider);
<add> }
<add>
<ide> public void resetRootViewForScreenshotTests() {
<ide> if (mReactInstanceManager != null) {
<ide> mReactInstanceManager.destroy();
<ide> public void loadApp(
<ide> @Nullable Bundle initialProps,
<ide> String bundleName,
<ide> boolean useDevSupport) {
<add> loadApp(appKey, spec, initialProps, bundleName, useDevSupport, null);
<add> }
<add>
<add> public void loadApp(
<add> String appKey,
<add> ReactInstanceSpecForTest spec,
<add> @Nullable Bundle initialProps,
<add> String bundleName,
<add> boolean useDevSupport,
<add> UIImplementationProvider uiImplementationProvider) {
<ide>
<ide> final CountDownLatch currentLayoutEvent = mLayoutEvent = new CountDownLatch(1);
<ide> mBridgeIdleSignaler = new ReactBridgeIdleSignaler();
<ide> public void loadApp(
<ide> .addPackage(new InstanceSpecForTestPackage(spec))
<ide> .setUseDeveloperSupport(useDevSupport)
<ide> .setBridgeIdleDebugListener(mBridgeIdleSignaler)
<del> .setInitialLifecycleState(mLifecycleState);
<add> .setInitialLifecycleState(mLifecycleState)
<add> .setUIImplementationProvider(uiImplementationProvider);
<ide>
<ide> mReactInstanceManager = builder.build();
<ide> mReactInstanceManager.onHostResume(this, this); | 1 |
PHP | PHP | fix auto linking for urls with uppercased protocol | 3e8123868e987b9d220b4514e73434651831a6cf | <ide><path>src/View/Helper/TextHelper.php
<ide> protected function _linkUrls($text, $htmlOptions)
<ide> $replace = [];
<ide> foreach ($this->_placeholders as $hash => $url) {
<ide> $link = $url;
<del> if (!preg_match('#^[a-z]+\://#', $url)) {
<add> if (!preg_match('#^[a-z]+\://#i', $url)) {
<ide> $url = 'http://' . $url;
<ide> }
<ide> $replace[$hash] = $this->Html->link($link, $url, $htmlOptions);
<ide><path>tests/TestCase/View/Helper/TextHelperTest.php
<ide> public static function autoLinkProvider()
<ide> 'This is a test that includes www.wikipedia.org/wiki/Kanton_(Schweiz)#fragment',
<ide> 'This is a test that includes <a href="http://www.wikipedia.org/wiki/Kanton_(Schweiz)#fragment">www.wikipedia.org/wiki/Kanton_(Schweiz)#fragment</a>',
<ide> ],
<add> [
<add> 'This is a test that includes Http://example.com/test.php?foo=bar text',
<add> 'This is a test that includes <a href="Http://example.com/test.php?foo=bar">Http://example.com/test.php?foo=bar</a> text',
<add> ],
<ide> [
<ide> 'This is a test that includes http://example.com/test.php?foo=bar text',
<ide> 'This is a test that includes <a href="http://example.com/test.php?foo=bar">http://example.com/test.php?foo=bar</a> text', | 2 |
Javascript | Javascript | add referrer capability to the test resolver | 35889593cb05d8934413be96efa31a375fd0b4e3 | <ide><path>packages/container/tests/registry_test.js
<ide> import { Registry, privatize } from '..';
<del>import { factory, moduleFor, AbstractTestCase } from 'internal-test-helpers';
<add>import {
<add> factory,
<add> moduleFor,
<add> AbstractTestCase,
<add> ModuleBasedTestResolver
<add>} from 'internal-test-helpers';
<ide> import { EMBER_MODULE_UNIFICATION } from 'ember/features';
<ide> import { ENV } from 'ember-environment';
<ide>
<ide> if (EMBER_MODULE_UNIFICATION) {
<ide> moduleFor('Registry module unification', class extends AbstractTestCase {
<ide> ['@test The registry can pass a source to the resolver'](assert) {
<ide> let PrivateComponent = factory();
<del> let lookup = 'component:my-input';
<add> let type = 'component';
<add> let name = 'my-input';
<add> let specifier = `${type}:${name}`;
<ide> let source = 'template:routes/application';
<del> let resolveCount = 0;
<del> let resolver = {
<del> resolve(fullName, src) {
<del> resolveCount++;
<del> if (fullName === lookup && src === source) {
<del> return PrivateComponent;
<del> }
<del> }
<del> };
<add>
<add> let resolver = new ModuleBasedTestResolver();
<add> resolver.add({specifier, source}, PrivateComponent);
<ide> let registry = new Registry({ resolver });
<del> registry.normalize = function(name) {
<del> return name;
<del> };
<ide>
<del> assert.strictEqual(registry.resolve(lookup, { source }), PrivateComponent, 'The correct factory was provided');
<del> assert.strictEqual(registry.resolve(lookup, { source }), PrivateComponent, 'The correct factory was provided again');
<del> assert.equal(resolveCount, 1, 'resolve called only once and a cached factory was returned the second time');
<add> assert.strictEqual(
<add> registry.resolve(specifier, { source }),
<add> PrivateComponent,
<add> 'The correct factory was provided'
<add> );
<add> assert.strictEqual(
<add> registry.resolve(specifier, { source }),
<add> PrivateComponent,
<add> 'The correct factory was provided again'
<add> );
<ide> }
<ide> });
<ide> }
<ide><path>packages/internal-test-helpers/lib/test-resolver.js
<ide> import { compile } from 'ember-template-compiler';
<ide>
<add>const DELIMITER = '\0';
<add>
<add>function serializeKey(specifier, source) {
<add> return [specifier, source].join(DELIMITER);
<add>}
<add>
<ide> class Resolver {
<ide> constructor() {
<ide> this._registered = {};
<ide> this.constructor.lastInstance = this;
<ide> }
<del> resolve(specifier) {
<del> return this._registered[specifier];
<add> resolve(specifier, source) {
<add> return this._registered[serializeKey(specifier, source)];
<ide> }
<del> add(specifier, factory) {
<del> if (specifier.indexOf(':') === -1) {
<del> throw new Error('Specifiers added to the resolver must be in the format of type:name');
<add> add(lookup, factory) {
<add> let key;
<add> switch (typeof lookup) {
<add> case 'string':
<add> if (lookup.indexOf(':') === -1) {
<add> throw new Error('Specifiers added to the resolver must be in the format of type:name');
<add> }
<add> key = serializeKey(lookup);
<add> break;
<add> case 'object':
<add> key = serializeKey(lookup.specifier, lookup.source);
<add> break;
<add> default:
<add> throw new Error('Specifier string has an unknown type');
<ide> }
<del> return this._registered[specifier] = factory;
<add>
<add> return this._registered[key] = factory;
<ide> }
<ide> addTemplate(templateName, template) {
<ide> let templateType = typeof template;
<ide> if (templateType !== 'string') {
<ide> throw new Error(`You called addTemplate for "${templateName}" with a template argument of type of '${templateType}'. addTemplate expects an argument of an uncompiled template as a string.`);
<ide> }
<del> return this._registered[`template:${templateName}`] = compile(template, {
<add> return this._registered[serializeKey(`template:${templateName}`)] = compile(template, {
<ide> moduleName: templateName
<ide> });
<ide> } | 2 |
Python | Python | fix failing celery test | 0f97b92c1ad15bd6d0a90c8dee8287886641d7d9 | <ide><path>tests/cli/commands/test_celery_command.py
<ide> # KIND, either express or implied. See the License for the
<ide> # specific language governing permissions and limitations
<ide> # under the License.
<del>import os
<ide> import unittest
<ide> from argparse import Namespace
<ide> from tempfile import NamedTemporaryFile
<ide> def test_same_pid_file_is_used_in_start_and_stop(
<ide> celery_command.stop_worker(stop_args)
<ide> mock_read_pid_from_pidfile.assert_called_once_with(pid_file)
<ide>
<add> @mock.patch("airflow.cli.commands.celery_command.remove_existing_pidfile")
<ide> @mock.patch("airflow.cli.commands.celery_command.read_pid_from_pidfile")
<ide> @mock.patch("airflow.cli.commands.celery_command.worker_bin.worker")
<ide> @mock.patch("airflow.cli.commands.celery_command.psutil.Process")
<add> @mock.patch("airflow.cli.commands.celery_command.setup_locations")
<ide> @conf_vars({("core", "executor"): "CeleryExecutor"})
<ide> def test_custom_pid_file_is_used_in_start_and_stop(
<del> self, mock_celery_worker, mock_read_pid_from_pidfile, mock_process
<add> self,
<add> mock_setup_locations,
<add> mock_process,
<add> mock_celery_worker,
<add> mock_read_pid_from_pidfile,
<add> mock_remove_existing_pidfile,
<ide> ):
<ide> pid_file = "custom_test_pid_file"
<del>
<add> mock_setup_locations.return_value = (pid_file, None, None, None)
<ide> # Call worker
<ide> worker_args = self.parser.parse_args(['celery', 'worker', '--skip-serve-logs', '--pid', pid_file])
<ide> celery_command.worker(worker_args)
<ide> def test_custom_pid_file_is_used_in_start_and_stop(
<ide> assert 'pidfile' in kwargs
<ide> assert kwargs['pidfile'] == pid_file
<ide> assert not args
<del> assert os.path.exists(pid_file)
<del>
<del> with open(pid_file) as pid_fd:
<del> pid = "".join(pid_fd.readlines())
<del>
<del> # Call stop
<del> stop_args = self.parser.parse_args(['celery', 'stop', '--pid', pid_file])
<del> celery_command.stop_worker(stop_args)
<del> run_mock = mock_celery_worker.return_value.run
<del> assert run_mock.call_args
<del> args, kwargs = run_mock.call_args
<del> assert 'pidfile' in kwargs
<del> assert kwargs['pidfile'] == pid_file
<del> assert not args
<del>
<del> mock_read_pid_from_pidfile.assert_called_once_with(pid_file)
<del> mock_process.assert_called_once_with(int(pid))
<del> mock_process.return_value.terminate.assert_called_once_with()
<del> assert not os.path.exists(pid_file)
<add> stop_args = self.parser.parse_args(['celery', 'stop', '--pid', pid_file])
<add> celery_command.stop_worker(stop_args)
<add> run_mock = mock_celery_worker.return_value.run
<add> assert run_mock.call_args
<add> args, kwargs = run_mock.call_args
<add> assert 'pidfile' in kwargs
<add> assert kwargs['pidfile'] == pid_file
<add> assert not args
<add>
<add> mock_read_pid_from_pidfile.assert_called_once_with(pid_file)
<add> mock_process.return_value.terminate.assert_called()
<add> mock_remove_existing_pidfile.assert_called_once_with(pid_file)
<ide>
<ide>
<ide> @pytest.mark.backend("mysql", "postgres") | 1 |
Javascript | Javascript | fix ibmi skip message | 7d672733c63bf61a3816266aee57bedb8bc831a2 | <ide><path>test/async-hooks/test-fseventwrap.js
<ide> if (!common.isMainThread)
<ide> common.skip('Worker bootstrapping works differently -> different async IDs');
<ide>
<ide> if (common.isIBMi)
<del> common.skip('IBMi does not suppport fs.watch()');
<add> common.skip('IBMi does not support fs.watch()');
<ide>
<ide> const hooks = initHooks();
<ide> | 1 |
PHP | PHP | port 5.0 fix for queue sleeping | 80c524c81e801a7b01744d6559637094f5e859c4 | <ide><path>src/Illuminate/Queue/Console/WorkCommand.php
<ide> public function __construct(Worker $worker)
<ide> public function fire()
<ide> {
<ide> if ($this->downForMaintenance() && !$this->option('daemon')) {
<del> return;
<add> return $this->worker->sleep($this->option('sleep'));
<ide> }
<ide>
<ide> $queue = $this->option('queue'); | 1 |
Java | Java | fix failing tests failing when debug logging is on | d3c977b54b13c27bdf22747bbee8615d643c9559 | <ide><path>spring-web/src/test/java/org/springframework/web/client/RestTemplateTests.java
<ide> public void varArgsTemplateVariables() throws Exception {
<ide> .andReturn(request);
<ide> expect(request.execute()).andReturn(response);
<ide> expect(errorHandler.hasError(response)).andReturn(false);
<add> addLogResponseStatusExpectations(HttpStatus.OK);
<ide> response.close();
<ide>
<ide> replayMocks();
<ide> public void varArgsNullTemplateVariable() throws Exception {
<ide> .andReturn(request);
<ide> expect(request.execute()).andReturn(response);
<ide> expect(errorHandler.hasError(response)).andReturn(false);
<add> addLogResponseStatusExpectations(HttpStatus.OK);
<ide> response.close();
<ide>
<ide> replayMocks();
<ide> public void mapTemplateVariables() throws Exception {
<ide> .andReturn(request);
<ide> expect(request.execute()).andReturn(response);
<ide> expect(errorHandler.hasError(response)).andReturn(false);
<add> addLogResponseStatusExpectations(HttpStatus.OK);
<ide> response.close();
<ide>
<ide> replayMocks();
<ide> public void mapNullTemplateVariable() throws Exception {
<ide> .andReturn(request);
<ide> expect(request.execute()).andReturn(response);
<ide> expect(errorHandler.hasError(response)).andReturn(false);
<add> addLogResponseStatusExpectations(HttpStatus.OK);
<ide> response.close();
<ide>
<ide> replayMocks();
<ide> public void getForObject() throws Exception {
<ide> expect(converter.canRead(String.class, textPlain)).andReturn(true);
<ide> String expected = "Hello World";
<ide> expect(converter.read(String.class, response)).andReturn(expected);
<add> addLogResponseStatusExpectations(HttpStatus.OK);
<ide> response.close();
<ide>
<ide> replayMocks();
<ide> public void getUnsupportedMediaType() throws Exception {
<ide> expect(response.getStatusCode()).andReturn(HttpStatus.OK);
<ide> expect(response.getHeaders()).andReturn(responseHeaders).times(2);
<ide> expect(converter.canRead(String.class, contentType)).andReturn(false);
<add> addLogResponseStatusExpectations(HttpStatus.OK);
<ide> response.close();
<ide>
<ide> replayMocks();
<ide> public void getForEntity() throws Exception {
<ide> String expected = "Hello World";
<ide> expect(converter.read(String.class, response)).andReturn(expected);
<ide> expect(response.getStatusCode()).andReturn(HttpStatus.OK);
<add> addLogResponseStatusExpectations(HttpStatus.OK);
<ide> response.close();
<ide>
<ide> replayMocks();
<ide> public void headForHeaders() throws Exception {
<ide> expect(errorHandler.hasError(response)).andReturn(false);
<ide> HttpHeaders responseHeaders = new HttpHeaders();
<ide> expect(response.getHeaders()).andReturn(responseHeaders);
<add> addLogResponseStatusExpectations(HttpStatus.OK);
<ide> response.close();
<ide>
<ide> replayMocks();
<ide> public void postForLocation() throws Exception {
<ide> URI expected = new URI("http://example.com/hotels");
<ide> responseHeaders.setLocation(expected);
<ide> expect(response.getHeaders()).andReturn(responseHeaders);
<add> addLogResponseStatusExpectations(HttpStatus.OK);
<ide> response.close();
<ide>
<ide> replayMocks();
<ide> public void postForLocationEntityContentType() throws Exception {
<ide> URI expected = new URI("http://example.com/hotels");
<ide> responseHeaders.setLocation(expected);
<ide> expect(response.getHeaders()).andReturn(responseHeaders);
<add> addLogResponseStatusExpectations(HttpStatus.OK);
<ide> response.close();
<ide>
<ide> replayMocks();
<ide> public void postForLocationEntityCustomHeader() throws Exception {
<ide> URI expected = new URI("http://example.com/hotels");
<ide> responseHeaders.setLocation(expected);
<ide> expect(response.getHeaders()).andReturn(responseHeaders);
<add> addLogResponseStatusExpectations(HttpStatus.OK);
<ide> response.close();
<ide>
<ide> replayMocks();
<ide> public void postForLocationNoLocation() throws Exception {
<ide> expect(errorHandler.hasError(response)).andReturn(false);
<ide> HttpHeaders responseHeaders = new HttpHeaders();
<ide> expect(response.getHeaders()).andReturn(responseHeaders);
<add> addLogResponseStatusExpectations(HttpStatus.OK);
<ide> response.close();
<ide>
<ide> replayMocks();
<ide> public void postForLocationNull() throws Exception {
<ide> expect(errorHandler.hasError(response)).andReturn(false);
<ide> HttpHeaders responseHeaders = new HttpHeaders();
<ide> expect(response.getHeaders()).andReturn(responseHeaders);
<add> addLogResponseStatusExpectations(HttpStatus.OK);
<ide> response.close();
<ide>
<ide> replayMocks();
<ide> public void postForObject() throws Exception {
<ide> Integer expected = 42;
<ide> expect(converter.canRead(Integer.class, textPlain)).andReturn(true);
<ide> expect(converter.read(Integer.class, response)).andReturn(expected);
<add> addLogResponseStatusExpectations(HttpStatus.OK);
<ide> response.close();
<ide>
<ide> replayMocks();
<ide> public void postForEntity() throws Exception {
<ide> expect(converter.canRead(Integer.class, textPlain)).andReturn(true);
<ide> expect(converter.read(Integer.class, response)).andReturn(expected);
<ide> expect(response.getStatusCode()).andReturn(HttpStatus.OK);
<add> addLogResponseStatusExpectations(HttpStatus.OK);
<ide> response.close();
<ide>
<ide> replayMocks();
<ide> public void postForObjectNull() throws Exception {
<ide> expect(response.getHeaders()).andReturn(responseHeaders).times(2);
<ide> expect(converter.canRead(Integer.class, textPlain)).andReturn(true);
<ide> expect(converter.read(Integer.class, response)).andReturn(null);
<add> addLogResponseStatusExpectations(HttpStatus.OK);
<ide> response.close();
<ide>
<ide> replayMocks();
<ide> public void postForEntityNull() throws Exception {
<ide> expect(converter.canRead(Integer.class, textPlain)).andReturn(true);
<ide> expect(converter.read(Integer.class, response)).andReturn(null);
<ide> expect(response.getStatusCode()).andReturn(HttpStatus.OK);
<add> addLogResponseStatusExpectations(HttpStatus.OK);
<ide> response.close();
<ide>
<ide> replayMocks();
<ide> public void put() throws Exception {
<ide> converter.write(helloWorld, null, request);
<ide> expect(request.execute()).andReturn(response);
<ide> expect(errorHandler.hasError(response)).andReturn(false);
<add> addLogResponseStatusExpectations(HttpStatus.OK);
<ide> response.close();
<ide>
<ide> replayMocks();
<ide> public void putNull() throws Exception {
<ide> expect(request.getHeaders()).andReturn(requestHeaders);
<ide> expect(request.execute()).andReturn(response);
<ide> expect(errorHandler.hasError(response)).andReturn(false);
<add> addLogResponseStatusExpectations(HttpStatus.OK);
<ide> response.close();
<ide>
<ide> replayMocks();
<ide> public void delete() throws Exception {
<ide> expect(requestFactory.createRequest(new URI("http://example.com"), HttpMethod.DELETE)).andReturn(request);
<ide> expect(request.execute()).andReturn(response);
<ide> expect(errorHandler.hasError(response)).andReturn(false);
<add> addLogResponseStatusExpectations(HttpStatus.OK);
<ide> response.close();
<ide>
<ide> replayMocks();
<ide> public void optionsForAllow() throws Exception {
<ide> EnumSet<HttpMethod> expected = EnumSet.of(HttpMethod.GET, HttpMethod.POST);
<ide> responseHeaders.setAllow(expected);
<ide> expect(response.getHeaders()).andReturn(responseHeaders);
<add> addLogResponseStatusExpectations(HttpStatus.OK);
<ide> response.close();
<ide>
<ide> replayMocks();
<ide> public void exchange() throws Exception {
<ide> expect(converter.canRead(Integer.class, MediaType.TEXT_PLAIN)).andReturn(true);
<ide> expect(converter.read(Integer.class, response)).andReturn(expected);
<ide> expect(response.getStatusCode()).andReturn(HttpStatus.OK);
<add> addLogResponseStatusExpectations(HttpStatus.OK);
<ide> response.close();
<ide>
<ide> replayMocks();
<ide> public void exchangeParameterizedType() throws Exception {
<ide> expect(converter.canRead(intList.getType(), null, MediaType.TEXT_PLAIN)).andReturn(true);
<ide> expect(converter.read(intList.getType(), null, response)).andReturn(expected);
<ide> expect(response.getStatusCode()).andReturn(HttpStatus.OK);
<add> addLogResponseStatusExpectations(HttpStatus.OK);
<ide> response.close();
<ide>
<ide> replay(requestFactory, request, response, errorHandler, converter);
<ide> public void exchangeParameterizedType() throws Exception {
<ide> }
<ide>
<ide>
<add> private void addLogResponseStatusExpectations(HttpStatus status) throws IOException {
<add> expect(response.getStatusCode()).andReturn(status).times(0, 1);
<add> expect(response.getStatusText()).andReturn(status.getReasonPhrase()).times(0, 1);
<add> }
<add>
<ide> private void replayMocks() {
<ide> replay(requestFactory, request, response, errorHandler, converter);
<ide> }
<ide><path>spring-web/src/test/java/org/springframework/web/context/request/async/WebAsyncManagerTests.java
<ide>
<ide> import java.util.concurrent.Callable;
<ide>
<add>import javax.servlet.http.HttpServletRequest;
<add>
<ide> import org.easymock.EasyMock;
<ide> import org.junit.Before;
<ide> import org.junit.Test;
<ide> public class WebAsyncManagerTests {
<ide>
<ide> private AsyncWebRequest asyncWebRequest;
<ide>
<add> private MockHttpServletRequest servletRequest;
<add>
<ide>
<ide> @Before
<ide> public void setUp() {
<del> this.asyncManager = WebAsyncUtils.getAsyncManager(new MockHttpServletRequest());
<add> this.servletRequest = new MockHttpServletRequest();
<add> this.asyncManager = WebAsyncUtils.getAsyncManager(servletRequest);
<ide> this.asyncManager.setTaskExecutor(new SyncTaskExecutor());
<ide>
<ide> this.asyncWebRequest = createStrictMock(AsyncWebRequest.class);
<ide> public void startCallableProcessingWithAsyncTask() throws Exception {
<ide> this.asyncWebRequest.addTimeoutHandler(EasyMock.<Runnable>anyObject());
<ide> this.asyncWebRequest.addCompletionHandler(EasyMock.<Runnable>anyObject());
<ide> this.asyncWebRequest.startAsync();
<add> expect(this.asyncWebRequest.getNativeRequest(HttpServletRequest.class)).andReturn(this.servletRequest).times(0, 1);
<ide> replay(this.asyncWebRequest);
<ide>
<ide> @SuppressWarnings("unchecked")
<ide> private void setupDefaultAsyncScenario() {
<ide> this.asyncWebRequest.addTimeoutHandler((Runnable) notNull());
<ide> this.asyncWebRequest.addCompletionHandler((Runnable) notNull());
<ide> this.asyncWebRequest.startAsync();
<add> expect(this.asyncWebRequest.getNativeRequest(HttpServletRequest.class)).andReturn(this.servletRequest).times(0, 1);
<ide> expect(this.asyncWebRequest.isAsyncComplete()).andReturn(false);
<ide> this.asyncWebRequest.dispatch();
<ide> replay(this.asyncWebRequest); | 2 |
PHP | PHP | remove deprecations methods | eaa77156a5eb7315ea02eeab0db50978dbadc7a9 | <ide><path>Cake/Controller/Component/AclComponent.php
<ide> public function inherit($aro, $aco, $action = "*") {
<ide> return $this->_Instance->inherit($aro, $aco, $action);
<ide> }
<ide>
<del>/**
<del> * Pass-thru function for ACL grant instance. An alias for AclComponent::allow()
<del> *
<del> * @param array|string|Model $aro ARO The requesting object identifier. See `AclNode::node()` for possible formats
<del> * @param array|string|Model $aco ACO The controlled object identifier. See `AclNode::node()` for possible formats
<del> * @param string $action Action (defaults to *)
<del> * @return boolean Success
<del> * @deprecated Will be removed in 3.0.
<del> */
<del> public function grant($aro, $aco, $action = "*") {
<del> trigger_error(__d('cake_dev', '%s is deprecated, use %s instead', 'AclComponent::grant()', 'allow()'), E_USER_WARNING);
<del> return $this->_Instance->allow($aro, $aco, $action);
<del> }
<del>
<del>/**
<del> * Pass-thru function for ACL grant instance. An alias for AclComponent::deny()
<del> *
<del> * @param array|string|Model $aro ARO The requesting object identifier. See `AclNode::node()` for possible formats
<del> * @param array|string|Model $aco ACO The controlled object identifier. See `AclNode::node()` for possible formats
<del> * @param string $action Action (defaults to *)
<del> * @return boolean Success
<del> * @deprecated Will be removed in 3.0.
<del> */
<del> public function revoke($aro, $aco, $action = "*") {
<del> trigger_error(__d('cake_dev', '%s is deprecated, use %s instead', 'AclComponent::revoke()', 'deny()'), E_USER_WARNING);
<del> return $this->_Instance->deny($aro, $aco, $action);
<del> }
<del>
<ide> }
<ide><path>Cake/Controller/Component/CookieComponent.php
<ide> protected function _encrypt($value) {
<ide> if ($this->_type === 'rijndael') {
<ide> $cipher = Security::rijndael($value, $this->key, 'encrypt');
<ide> }
<del> if ($this->_type === 'cipher') {
<del> $cipher = Security::cipher($value, $this->key);
<del> }
<ide> if ($this->_type === 'aes') {
<ide> $cipher = Security::encrypt($value, $this->key);
<ide> }
<ide> protected function _decode($value) {
<ide> if ($this->_type === 'rijndael') {
<ide> $plain = Security::rijndael($value, $this->key, 'decrypt');
<ide> }
<del> if ($this->_type === 'cipher') {
<del> $plain = Security::cipher($value, $this->key);
<del> }
<ide> if ($this->_type === 'aes') {
<ide> $plain = Security::decrypt($value, $this->key);
<ide> }
<ide><path>Cake/Model/BehaviorCollection.php
<ide> public function init($modelName, $behaviors = array()) {
<ide> }
<ide> }
<ide>
<del>/**
<del> * Backwards compatible alias for load()
<del> *
<del> * @param string $behavior
<del> * @param array $config
<del> * @return void
<del> * @deprecated Will be removed in 3.0. Replaced with load().
<del> */
<del> public function attach($behavior, $config = array()) {
<del> return $this->load($behavior, $config);
<del> }
<del>
<ide> /**
<ide> * Loads a behavior into the collection. You can use use `$config['enabled'] = false`
<ide> * to load a behavior with callbacks disabled. By default callbacks are enabled. Disable behaviors
<ide> public function unload($name) {
<ide> }
<ide> }
<ide>
<del>/**
<del> * Backwards compatible alias for unload()
<del> *
<del> * @param string $name Name of behavior
<del> * @return void
<del> * @deprecated Will be removed in 3.0. Use unload instead.
<del> */
<del> public function detach($name) {
<del> return $this->unload($name);
<del> }
<del>
<ide> /**
<ide> * Dispatches a behavior method. Will call either normal methods or mapped methods.
<ide> *
<ide><path>Cake/Test/TestCase/Utility/SecurityTest.php
<ide> */
<ide> class SecurityTest extends TestCase {
<ide>
<del>/**
<del> * sut property
<del> *
<del> * @var mixed null
<del> */
<del> public $sut = null;
<del>
<del>/**
<del> * testInactiveMins method
<del> *
<del> * @return void
<del> */
<del> public function testInactiveMins() {
<del> Configure::write('Security.level', 'high');
<del> $this->assertEquals(10, Security::inactiveMins());
<del>
<del> Configure::write('Security.level', 'medium');
<del> $this->assertEquals(100, Security::inactiveMins());
<del>
<del> Configure::write('Security.level', 'low');
<del> $this->assertEquals(300, Security::inactiveMins());
<del> }
<del>
<ide> /**
<ide> * testGenerateAuthkey method
<ide> *
<ide><path>Cake/Utility/ObjectCollection.php
<ide> public function enabled($name = null) {
<ide> return array_keys($this->_enabled);
<ide> }
<ide>
<del>/**
<del> * Gets the list of attached objects, or, whether the given object is attached
<del> *
<del> * @param string $name Optional. The name of the object to check the status of. If omitted,
<del> * returns an array of currently-attached objects
<del> * @return mixed If $name is specified, returns the boolean status of the corresponding object.
<del> * Otherwise, returns an array of all attached objects.
<del> * @deprecated Will be removed in 3.0. Use loaded instead.
<del> */
<del> public function attached($name = null) {
<del> return $this->loaded($name);
<del> }
<del>
<ide> /**
<ide> * Gets the list of loaded objects, or, whether the given object is loaded
<ide> *
<ide><path>Cake/Utility/Security.php
<ide> class Security {
<ide> */
<ide> public static $hashCost = '10';
<ide>
<del>/**
<del> * Get allowed minutes of inactivity based on security level.
<del> *
<del> * @deprecated Exists for backwards compatibility only, not used by the core
<del> * @return integer Allowed inactivity in minutes
<del> */
<del> public static function inactiveMins() {
<del> switch (Configure::read('Security.level')) {
<del> case 'high':
<del> return 10;
<del> case 'medium':
<del> return 100;
<del> case 'low':
<del> default:
<del> return 300;
<del> }
<del> }
<del>
<ide> /**
<ide> * Generate authorization hash.
<ide> *
<ide> public static function setCost($cost) {
<ide> static::$hashCost = $cost;
<ide> }
<ide>
<del>/**
<del> * Deprecated method. Does nothing.
<del> * @param string $text Encrypted string to decrypt, normal string to encrypt
<del> * @param string $key Key to use
<del> * @throws Cake\Error\Exception
<del> * @deprecated This method will be removed in 3.x
<del> */
<del> public static function cipher($text, $key) {
<del> throw new Error\Exception(__d('cake_dev', 'Security::cipher() has been removed. Use Security::rijndael() to encrypt data'));
<del> }
<del>
<ide> /**
<ide> * Encrypts/Decrypts a text using the given key using rijndael method.
<ide> * | 6 |
Ruby | Ruby | move superbin into superenv module | a04f1ac3d362e3da38db7aea0bc89ebc55f92478 | <ide><path>Library/Homebrew/superenv.rb
<ide> # 7) Simpler formula that *just work*
<ide> # 8) Build-system agnostic configuration of the tool-chain
<ide>
<del>def superbin
<del> @bin ||= (HOMEBREW_REPOSITORY/"Library/ENV").children.reject{|d| d.basename.to_s > MacOS::Xcode.version }.max
<del>end
<del>
<ide> def superenv?
<ide> return false if MacOS::Xcode.without_clt? && MacOS.sdk_path.nil?
<del> return false unless superbin && superbin.directory?
<add> return false unless Superenv.bin && Superenv.bin.directory?
<ide> return false if ARGV.include? "--env=std"
<ide> true
<ide> end
<ide> def self.extended(base)
<ide> base.deps = []
<ide> end
<ide>
<add> def self.bin
<add> @bin ||= (HOMEBREW_REPOSITORY/"Library/ENV").children.reject{|d| d.basename.to_s > MacOS::Xcode.version }.max
<add> end
<add>
<ide> def reset
<ide> %w{CC CXX OBJC OBJCXX CPP MAKE LD LDSHARED
<ide> CFLAGS CXXFLAGS OBJCFLAGS OBJCXXFLAGS LDFLAGS CPPFLAGS
<ide> def default_cc
<ide> end
<ide>
<ide> def determine_path
<del> paths = [superbin]
<add> paths = [Superenv.bin]
<ide> if MacOS::Xcode.without_clt?
<ide> paths << "#{MacOS::Xcode.prefix}/usr/bin"
<ide> paths << "#{MacOS::Xcode.prefix}/Toolchains/XcodeDefault.xctoolchain/usr/bin" | 1 |
Javascript | Javascript | unify behavior of showing/hiding | c611f9f3585c6023819e7174b2251c2a6800309f | <ide><path>src/js/control-bar/text-track-controls/captions-button.js
<ide> class CaptionsButton extends TextTrackButton {
<ide> return `vjs-captions-button ${super.buildWrapperCSSClass()}`;
<ide> }
<ide>
<del> /**
<del> * Update caption menu items
<del> *
<del> * @param {EventTarget~Event} [event]
<del> * The `addtrack` or `removetrack` event that caused this function to be
<del> * called.
<del> *
<del> * @listens TextTrackList#addtrack
<del> * @listens TextTrackList#removetrack
<del> */
<del> update(event) {
<del> let threshold = 2;
<del>
<del> super.update();
<del>
<del> // if native, then threshold is 1 because no settings button
<del> if (this.player().tech_ && this.player().tech_.featuresNativeTextTracks) {
<del> threshold = 1;
<del> }
<del>
<del> if (this.items && this.items.length > threshold) {
<del> this.show();
<del> } else {
<del> this.hide();
<del> }
<del> }
<del>
<ide> /**
<ide> * Create caption menu items
<ide> *
<ide> class CaptionsButton extends TextTrackButton {
<ide>
<ide> if (!(this.player().tech_ && this.player().tech_.featuresNativeTextTracks)) {
<ide> items.push(new CaptionSettingsMenuItem(this.player_, {kind: this.kind_}));
<add>
<add> this.hideThreshold_ += 1;
<ide> }
<ide>
<ide> return super.createItems(items);
<ide><path>src/js/control-bar/text-track-controls/text-track-button.js
<ide> class TextTrackButton extends TrackButton {
<ide> label
<ide> }));
<ide>
<add> this.hideThreshold_ += 1;
<add>
<ide> const tracks = this.player_.textTracks();
<ide>
<ide> for (let i = 0; i < tracks.length; i++) {
<ide><path>src/js/menu/menu-button.js
<ide> class MenuButton extends Component {
<ide> this.buttonPressed_ = false;
<ide> this.menuButton_.el_.setAttribute('aria-expanded', 'false');
<ide>
<del> if (this.items && this.items.length === 0) {
<add> if (this.items && this.items.length <= this.hideThreshold_) {
<ide> this.hide();
<del> } else if (this.items && this.items.length > 1) {
<add> } else {
<ide> this.show();
<ide> }
<ide> }
<ide> class MenuButton extends Component {
<ide> createMenu() {
<ide> const menu = new Menu(this.player_, { menuButton: this });
<ide>
<add> /**
<add> * Hide the menu if the number of items is less than or equal to this threshold. This defaults
<add> * to 0 and whenever we add items which can be hidden to the menu we'll increment it. We list
<add> * it here because every time we run `createMenu` we need to reset the value.
<add> *
<add> * @protected
<add> * @type {Number}
<add> */
<add> this.hideThreshold_ = 0;
<add>
<ide> // Add a title list item to the top
<ide> if (this.options_.title) {
<ide> const title = Dom.createEl('li', {
<ide> class MenuButton extends Component {
<ide> tabIndex: -1
<ide> });
<ide>
<add> this.hideThreshold_ += 1;
<add>
<ide> menu.children_.unshift(title);
<ide> Dom.prependTo(title, menu.contentEl());
<ide> } | 3 |
Javascript | Javascript | revise $flowfixme in text | 6042592cf46787f089e76b661376705380607207 | <ide><path>Libraries/Text/Text.js
<ide> type ResponseHandlers = $ReadOnly<{|
<ide>
<ide> type Props = $ReadOnly<{
<ide> ...TextProps,
<del> // $FlowFixMe - Typing ReactNativeComponent revealed errors
<del> forwardedRef: ?React.Ref<NativeComponent<TextProps>>,
<add> forwardedRef: ?React.Ref<'RCTText' | 'RCTVirtualText'>,
<ide> }>;
<ide>
<ide> type State = {|
<ide> class TouchableText extends React.Component<Props, State> {
<ide> <TextAncestor.Consumer>
<ide> {hasTextAncestor =>
<ide> hasTextAncestor ? (
<del> // $FlowFixMe - Typing ReactNativeComponent revealed errors
<ide> <RCTVirtualText {...props} ref={props.forwardedRef} />
<ide> ) : (
<ide> <TextAncestor.Provider value={true}> | 1 |
Python | Python | resolve line-too-long in feature_column | 6fafb567af4e4d9f42974d0b6c55b18bc03e17eb | <ide><path>keras/feature_column/base_feature_layer.py
<ide> def __init__(
<ide> ):
<ide> super().__init__(name=name, trainable=trainable, **kwargs)
<ide> self._feature_columns = _normalize_feature_columns(feature_columns)
<del> self._state_manager = tf.__internal__.feature_column.StateManager( # pylint: disable=protected-access
<add> self._state_manager = tf.__internal__.feature_column.StateManager(
<ide> self, self.trainable
<ide> )
<ide> self._partitioner = partitioner
<ide> def _verify_static_batch_size_equality(tensors, columns):
<ide> expected_batch_size = batch_size
<ide> elif not expected_batch_size.is_compatible_with(batch_size):
<ide> raise ValueError(
<del> "Batch size (first dimension) of each feature must be same. "
<del> "Batch size of columns ({}, {}): ({}, {})".format(
<add> "Batch size (first dimension) of each feature must be "
<add> "same. Batch size of columns ({}, {}): ({}, {})".format(
<ide> columns[bath_size_column_index].name,
<ide> columns[i].name,
<ide> expected_batch_size,
<ide> def _verify_static_batch_size_equality(tensors, columns):
<ide> def _normalize_feature_columns(feature_columns):
<ide> """Normalizes the `feature_columns` input.
<ide>
<del> This method converts the `feature_columns` to list type as best as it can. In
<del> addition, verifies the type and other parts of feature_columns, required by
<del> downstream library.
<add> This method converts the `feature_columns` to list type as best as it can.
<add> In addition, verifies the type and other parts of feature_columns, required
<add> by downstream library.
<ide>
<ide> Args:
<ide> feature_columns: The raw feature columns, usually passed by users.
<ide><path>keras/feature_column/dense_features.py
<ide> class DenseFeatures(kfc._BaseFeaturesLayer): # pylint: disable=protected-access
<ide> """A layer that produces a dense `Tensor` based on given `feature_columns`.
<ide>
<del> Generally a single example in training data is described with FeatureColumns.
<del> At the first layer of the model, this column-oriented data should be converted
<del> to a single `Tensor`.
<add> Generally a single example in training data is described with
<add> FeatureColumns. At the first layer of the model, this column-oriented data
<add> should be converted to a single `Tensor`.
<ide>
<ide> This layer can be called multiple times with different features.
<ide>
<del> This is the V1 version of this layer that uses variable_scope's or partitioner
<del> to create variables which works well with PartitionedVariables. Variable
<del> scopes are deprecated in V2, so the V2 version uses name_scopes instead. But
<del> currently that lacks support for partitioned variables. Use this if you need
<del> partitioned variables. Use the partitioner argument if you have a Keras model
<del> and uses `tf.compat.v1.keras.estimator.model_to_estimator` for training.
<add> This is the V1 version of this layer that uses variable_scope's or
<add> partitioner to create variables which works well with PartitionedVariables.
<add> Variable scopes are deprecated in V2, so the V2 version uses name_scopes
<add> instead. But currently that lacks support for partitioned variables. Use
<add> this if you need partitioned variables. Use the partitioner argument if you
<add> have a Keras model and uses
<add> `tf.compat.v1.keras.estimator.model_to_estimator` for training.
<ide>
<ide> Example:
<ide>
<ide> def __init__(
<ide>
<ide> Args:
<ide> feature_columns: An iterable containing the FeatureColumns to use as
<del> inputs to your model. All items should be instances of classes derived
<del> from `DenseColumn` such as `numeric_column`, `embedding_column`,
<del> `bucketized_column`, `indicator_column`. If you have categorical
<del> features, you can wrap them with an `embedding_column` or
<del> `indicator_column`.
<add> inputs to your model. All items should be instances of classes
<add> derived from `DenseColumn` such as `numeric_column`,
<add> `embedding_column`, `bucketized_column`, `indicator_column`. If you
<add> have categorical features, you can wrap them with an
<add> `embedding_column` or `indicator_column`.
<ide> trainable: Boolean, whether the layer's variables will be updated via
<ide> gradient descent during training.
<ide> name: Name to give to the DenseFeatures.
<ide> def _tracking_metadata(self):
<ide> """String stored in metadata field in the SavedModel proto.
<ide>
<ide> Returns:
<del> A serialized JSON storing information necessary for recreating this layer.
<add> A serialized JSON storing information necessary for recreating this
<add> layer.
<ide> """
<ide> metadata = json.loads(super()._tracking_metadata)
<ide> metadata["_is_feature_layer"] = True
<ide> def call(self, features, cols_to_output_tensors=None, training=None):
<ide> ... dimension=8)
<ide> >>> t2 = tf.feature_column.numeric_column('t2')
<ide> >>> feature_layer = tf.compat.v1.keras.layers.DenseFeatures([t1, t2])
<del> >>> features = {"t1": tf.constant(["a", "b"]), "t2": tf.constant([1, 2])}
<add> >>> features = {"t1": tf.constant(["a", "b"]),
<add> ... "t2": tf.constant([1, 2])}
<ide> >>> dense_tensor = feature_layer(features, training=True)
<ide>
<ide> Args:
<ide> features: A mapping from key to tensors. `FeatureColumn`s look up via
<del> these keys. For example `numeric_column('price')` will look at 'price'
<del> key in this dict. Values can be a `SparseTensor` or a `Tensor` depends
<del> on corresponding `FeatureColumn`.
<add> these keys. For example `numeric_column('price')` will look at
<add> 'price' key in this dict. Values can be a `SparseTensor` or a
<add> `Tensor` depends on corresponding `FeatureColumn`.
<ide> cols_to_output_tensors: If not `None`, this will be filled with a dict
<ide> mapping feature columns to output tensors created.
<del> training: Python boolean or None, indicating whether to the layer is being
<del> run in training mode. This argument is passed to the call method of any
<del> `FeatureColumn` that takes a `training` argument. For example, if a
<del> `FeatureColumn` performed dropout, the column could expose a `training`
<del> argument to control whether the dropout should be applied. If `None`,
<del> defaults to `tf.keras.backend.learning_phase()`.
<add> training: Python boolean or None, indicating whether to the layer is
<add> being run in training mode. This argument is passed to the call
<add> method of any `FeatureColumn` that takes a `training` argument. For
<add> example, if a `FeatureColumn` performed dropout, the column could
<add> expose a `training` argument to control whether the dropout should
<add> be applied. If `None`, defaults to
<add> `tf.keras.backend.learning_phase()`.
<ide>
<ide>
<ide> Returns:
<ide><path>keras/feature_column/dense_features_test.py
<ide> def _embedding_column_initializer(shape, dtype, partition_info=None):
<ide> # Check that only one variable was created.
<ide> self.assertEqual(1, len(variables))
<ide>
<del> # Check that invoking dense_features on the same features does not create
<del> # additional variables
<add> # Check that invoking dense_features on the same features does not
<add> # create additional variables
<ide> _ = dense_features(features)
<ide> self.assertEqual(1, len(variables))
<ide> self.assertIs(variables[0], dense_features.variables[0])
<ide> def _embedding_column_initializer(shape, dtype, partition_info=None):
<ide> # Check that only one variable was created.
<ide> self.assertEqual(2, len(variables))
<ide>
<del> # Check that invoking dense_features on the same features does not create
<del> # additional variables
<add> # Check that invoking dense_features on the same features does not
<add> # create additional variables
<ide> _ = dense_features(features)
<ide> self.assertEqual(2, len(variables))
<ide> self.assertIs(variables[0], dense_features.variables[0])
<ide> def _initializer(shape, dtype, partition_info=None):
<ide> expected_lookups = (
<ide> # example 0, ids [2], embedding = [7, 11]
<ide> (7.0, 11.0),
<del> # example 1, ids [0, 1], embedding = mean([1, 2] + [3, 5]) = [2, 3.5]
<add> # example 1, ids [0, 1], embedding = mean([1, 2] + [3, 5]) = [2,
<add> # 3.5]
<ide> (2.0, 3.5),
<ide> # example 2, ids [], embedding = [0, 0]
<ide> (0.0, 0.0),
<ide> def _initializer(shape, dtype, partition_info=None):
<ide> if partition_variables:
<ide> self.assertCountEqual(
<ide> (
<del> "vars/dense_features/aaa_embedding/embedding_weights/part_0:0",
<del> "vars/dense_features/aaa_embedding/embedding_weights/part_1:0",
<add> "vars/dense_features/aaa_embedding/embedding_weights/"
<add> "part_0:0",
<add> "vars/dense_features/aaa_embedding/embedding_weights/"
<add> "part_1:0",
<ide> ),
<ide> tuple([v.name for v in global_vars]),
<ide> )
<ide> def _initializer(shape, dtype, partition_info=None):
<ide> if partition_variables:
<ide> self.assertCountEqual(
<ide> (
<del> "vars/dense_features/aaa_embedding/embedding_weights/part_0:0",
<del> "vars/dense_features/aaa_embedding/embedding_weights/part_1:0",
<add> "vars/dense_features/aaa_embedding/embedding_weights/"
<add> "part_0:0",
<add> "vars/dense_features/aaa_embedding/embedding_weights/"
<add> "part_1:0",
<ide> ),
<ide> tuple([v.name for v in trainable_vars]),
<ide> )
<ide> def _initializer(shape, dtype, partition_info=None):
<ide> expected_lookups = (
<ide> # example 0, ids [2], embedding = [7, 11]
<ide> (7.0, 11.0),
<del> # example 1, ids [0, 1], embedding = mean([1, 2] + [3, 5]) = [2, 3.5]
<add> # example 1, ids [0, 1], embedding = mean([1, 2] + [3, 5]) = [2,
<add> # 3.5]
<ide> (2.0, 3.5),
<ide> # example 2, ids [], embedding = [0, 0]
<ide> (0.0, 0.0),
<ide> def test_embedding_column(self):
<ide> input_layer = df.DenseFeatures([embedding_column_a])
<ide> with self.assertRaisesRegex(
<ide> ValueError,
<del> r"In embedding_column: aaa_embedding\. categorical_column must not be "
<del> r"of type SequenceCategoricalColumn\.",
<add> r"In embedding_column: aaa_embedding\. categorical_column must not "
<add> r"be of type SequenceCategoricalColumn\.",
<ide> ):
<ide> _ = input_layer({"aaa": sparse_input})
<ide>
<ide> def test_indicator_column(self):
<ide> input_layer = df.DenseFeatures([indicator_column_a])
<ide> with self.assertRaisesRegex(
<ide> ValueError,
<del> r"In indicator_column: aaa_indicator\. categorical_column must not be "
<del> r"of type SequenceCategoricalColumn\.",
<add> r"In indicator_column: aaa_indicator\. categorical_column must not "
<add> r"be of type SequenceCategoricalColumn\.",
<ide> ):
<ide> _ = input_layer({"aaa": sparse_input})
<ide>
<ide><path>keras/feature_column/dense_features_v2.py
<ide> class DenseFeatures(dense_features.DenseFeatures):
<ide> """A layer that produces a dense `Tensor` based on given `feature_columns`.
<ide>
<del> Generally a single example in training data is described with FeatureColumns.
<del> At the first layer of the model, this column oriented data should be converted
<del> to a single `Tensor`.
<add> Generally a single example in training data is described with
<add> FeatureColumns. At the first layer of the model, this column oriented data
<add> should be converted to a single `Tensor`.
<ide>
<ide> This layer can be called multiple times with different features.
<ide>
<ide> class DenseFeatures(dense_features.DenseFeatures):
<ide> ```python
<ide> price = tf.feature_column.numeric_column('price')
<ide> keywords_embedded = tf.feature_column.embedding_column(
<del> tf.feature_column.categorical_column_with_hash_bucket("keywords", 10000),
<add> tf.feature_column.categorical_column_with_hash_bucket("keywords",
<add> 10000),
<ide> dimensions=16)
<ide> columns = [price, keywords_embedded, ...]
<ide> feature_layer = tf.keras.layers.DenseFeatures(columns)
<ide> class DenseFeatures(dense_features.DenseFeatures):
<ide> ..., features=tf.feature_column.make_parse_example_spec(columns))
<ide> dense_tensor = feature_layer(features)
<ide> for units in [128, 64, 32]:
<del> dense_tensor = tf.keras.layers.Dense(units, activation='relu')(dense_tensor)
<add> dense_tensor = tf.keras.layers.Dense(units, activation='relu')(
<add> dense_tensor)
<ide> prediction = tf.keras.layers.Dense(1)(dense_tensor)
<ide> ```
<ide> """
<ide> def __init__(self, feature_columns, trainable=True, name=None, **kwargs):
<ide>
<ide> Args:
<ide> feature_columns: An iterable containing the FeatureColumns to use as
<del> inputs to your model. All items should be instances of classes derived
<del> from `DenseColumn` such as `numeric_column`, `embedding_column`,
<del> `bucketized_column`, `indicator_column`. If you have categorical
<del> features, you can wrap them with an `embedding_column` or
<del> `indicator_column`.
<add> inputs to your model. All items should be instances of classes
<add> derived from `DenseColumn` such as `numeric_column`,
<add> `embedding_column`, `bucketized_column`, `indicator_column`. If you
<add> have categorical features, you can wrap them with an
<add> `embedding_column` or `indicator_column`.
<ide> trainable: Boolean, whether the layer's variables will be updated via
<ide> gradient descent during training.
<ide> name: Name to give to the DenseFeatures.
<ide> def create_variable(
<ide> if name in self._cols_to_vars_map[feature_column]:
<ide> raise ValueError("Variable already exists.")
<ide>
<del> # We explicitly track these variables since `name` is not guaranteed to be
<del> # unique and disable manual tracking that the add_weight call does.
<add> # We explicitly track these variables since `name` is not guaranteed to
<add> # be unique and disable manual tracking that the add_weight call does.
<ide> with no_manual_dependency_tracking_scope(self._layer):
<ide> var = self._layer.add_weight(
<ide> name=name,
<ide> def no_manual_dependency_tracking_scope(obj):
<ide> """A context that disables manual dependency tracking for the given `obj`.
<ide>
<ide> Sometimes library methods might track objects on their own and we might want
<del> to disable that and do the tracking on our own. One can then use this context
<del> manager to disable the tracking the library method does and do your own
<del> tracking.
<add> to disable that and do the tracking on our own. One can then use this
<add> context manager to disable the tracking the library method does and do your
<add> own tracking.
<ide>
<ide> For example:
<ide>
<ide> class TestLayer(tf.keras.Layer):
<ide> def build():
<ide> with no_manual_dependency_tracking_scope(self):
<ide> var = self.add_weight("name1") # Creates a var and doesn't track it
<del> self._track_trackable("name2", var) # We track variable with name `name2`
<add> # We track variable with name `name2`
<add> self._track_trackable("name2", var)
<ide>
<ide> Args:
<ide> obj: A trackable object.
<ide><path>keras/feature_column/dense_features_v2_test.py
<ide> def _embedding_column_initializer(shape, dtype, partition_info=None):
<ide> # Check that only one variable was created.
<ide> self.assertEqual(1, len(variables))
<ide>
<del> # Check that invoking dense_features on the same features does not create
<del> # additional variables
<add> # Check that invoking dense_features on the same features does not
<add> # create additional variables
<ide> _ = dense_features(features)
<ide> self.assertEqual(1, len(variables))
<ide> self.assertIs(variables[0], dense_features.variables[0])
<ide><path>keras/feature_column/sequence_feature_column.py
<ide> def __init__(self, feature_columns, trainable=True, name=None, **kwargs):
<ide> """ "Constructs a SequenceFeatures layer.
<ide>
<ide> Args:
<del> feature_columns: An iterable of dense sequence columns. Valid columns are
<del> - `embedding_column` that wraps a `sequence_categorical_column_with_*`
<add> feature_columns: An iterable of dense sequence columns. Valid columns
<add> are
<add> - `embedding_column` that wraps a
<add> `sequence_categorical_column_with_*`
<ide> - `sequence_numeric_column`.
<ide> trainable: Boolean, whether the layer's variables will be updated via
<ide> gradient descent during training.
<ide> def call(self, features, training=None):
<ide>
<ide> Args:
<ide> features: A dict mapping keys to tensors.
<del> training: Python boolean or None, indicating whether to the layer is being
<del> run in training mode. This argument is passed to the call method of any
<del> `FeatureColumn` that takes a `training` argument. For example, if a
<del> `FeatureColumn` performed dropout, the column could expose a `training`
<del> argument to control whether the dropout should be applied. If `None`,
<del> defaults to `tf.keras.backend.learning_phase()`.
<add> training: Python boolean or None, indicating whether to the layer is
<add> being run in training mode. This argument is passed to the call
<add> method of any `FeatureColumn` that takes a `training` argument. For
<add> example, if a `FeatureColumn` performed dropout, the column could
<add> expose a `training` argument to control whether the dropout should
<add> be applied. If `None`, defaults to
<add> `tf.keras.backend.learning_phase()`.
<ide>
<ide>
<ide> Returns:
<ide> An `(input_layer, sequence_length)` tuple where:
<ide> - input_layer: A float `Tensor` of shape `[batch_size, T, D]`.
<del> `T` is the maximum sequence length for this batch, which could differ
<del> from batch to batch. `D` is the sum of `num_elements` for all
<del> `feature_columns`.
<del> - sequence_length: An int `Tensor` of shape `[batch_size]`. The sequence
<del> length for each example.
<add> `T` is the maximum sequence length for this batch, which could
<add> differ from batch to batch. `D` is the sum of `num_elements` for
<add> all `feature_columns`.
<add> - sequence_length: An int `Tensor` of shape `[batch_size]`. The
<add> sequence length for each example.
<ide>
<ide> Raises:
<ide> ValueError: If features are not a dictionary.
<ide> def call(self, features, training=None):
<ide> sequence_lengths.append(sequence_length)
<ide>
<ide> # Check and process sequence lengths.
<del> kfc._verify_static_batch_size_equality( # pylint: disable=protected-access
<add> kfc._verify_static_batch_size_equality(
<ide> sequence_lengths, self._feature_columns
<ide> )
<ide> sequence_length = _assert_all_equal_and_return(sequence_lengths)
<ide><path>keras/feature_column/sequence_feature_column_test.py
<ide> def test_embedding_column_with_non_sequence_categorical(self):
<ide> sequence_input_layer = ksfc.SequenceFeatures([embedding_column_a])
<ide> with self.assertRaisesRegex(
<ide> ValueError,
<del> r"In embedding_column: aaa_embedding\. categorical_column must be of "
<del> r"type SequenceCategoricalColumn to use SequenceFeatures\.",
<add> r"In embedding_column: aaa_embedding\. categorical_column must be "
<add> r"of type SequenceCategoricalColumn to use SequenceFeatures\.",
<ide> ):
<ide> _, _ = sequence_input_layer({"aaa": sparse_input})
<ide>
<ide> def _initializer(shape, dtype, partition_info=None):
<ide> )
<ide>
<ide> def test_shared_embedding_column_with_non_sequence_categorical(self):
<del> """Tests that error is raised for non-sequence shared embedding column."""
<add> """Tests that error is raised for non-sequence shared embedding
<add> column."""
<ide> with tf.Graph().as_default():
<ide> vocabulary_size = 3
<ide> sparse_input_a = tf.compat.v1.SparseTensorValue(
<ide> def test_shared_embedding_column_with_non_sequence_categorical(self):
<ide> ValueError,
<ide> r"In embedding_column: aaa_shared_embedding\. "
<ide> r"categorical_column must "
<del> r"be of type SequenceCategoricalColumn to use SequenceFeatures\.",
<add> r"be of type SequenceCategoricalColumn to use "
<add> r"SequenceFeatures\.",
<ide> ):
<ide> _, _ = sequence_input_layer(
<ide> {"aaa": sparse_input_a, "bbb": sparse_input_b}
<ide> def test_indicator_column_with_non_sequence_categorical(self):
<ide> sequence_input_layer = ksfc.SequenceFeatures([indicator_column_a])
<ide> with self.assertRaisesRegex(
<ide> ValueError,
<del> r"In indicator_column: aaa_indicator\. categorical_column must be of "
<del> r"type SequenceCategoricalColumn to use SequenceFeatures\.",
<add> r"In indicator_column: aaa_indicator\. categorical_column must be "
<add> r"of type SequenceCategoricalColumn to use SequenceFeatures\.",
<ide> ):
<ide> _, _ = sequence_input_layer({"aaa": sparse_input})
<ide>
<ide> def test_numeric_column(
<ide> "dense_shape": (2, 8),
<ide> },
<ide> "expected_input_layer": [
<del> # The output of numeric_column._get_dense_tensor should be flattened.
<add> # The output of numeric_column._get_dense_tensor should be
<add> # flattened.
<ide> [[0.0, 1.0, 2.0, 3.0], [4.0, 5.0, 6.0, 7.0]],
<ide> [[10.0, 11.0, 12.0, 13.0], [0.0, 0.0, 0.0, 0.0]],
<ide> ],
<ide> def test_numeric_column(
<ide> "dense_shape": (2, 2, 4),
<ide> },
<ide> "expected_input_layer": [
<del> # The output of numeric_column._get_dense_tensor should be flattened.
<add> # The output of numeric_column._get_dense_tensor should be
<add> # flattened.
<ide> [[0.0, 1.0, 2.0, 3.0], [4.0, 5.0, 6.0, 7.0]],
<ide> [[10.0, 11.0, 12.0, 13.0], [0.0, 0.0, 0.0, 0.0]],
<ide> ],
<ide> def test_sequence_length_not_equal(self):
<ide> {
<ide> "testcase_name": "2D",
<ide> "sparse_input_args": {
<del> # example 0, values [[[0., 1.], [2., 3.]], [[4., 5.], [6., 7.]]]
<add> # example 0, values [[[0., 1.], [2., 3.]], [[4., 5.], [6.,
<add> # 7.]]]
<ide> # example 1, [[[10., 11.], [12., 13.]]]
<ide> "indices": (
<ide> (0, 0), | 7 |
Go | Go | let utils.parsehost return err when errors happen | e81da876df57fb8e0562cc64e7b57dc7eb32284a | <ide><path>docker/docker.go
<ide> func main() {
<ide> flHosts = flHosts[1:] //trick to display a nice default value in the usage
<ide> }
<ide> for i, flHost := range flHosts {
<del> flHosts[i] = utils.ParseHost(docker.DEFAULTHTTPHOST, docker.DEFAULTHTTPPORT, flHost)
<add> host, err := utils.ParseHost(docker.DEFAULTHTTPHOST, docker.DEFAULTHTTPPORT, flHost)
<add> if err == nil {
<add> flHosts[i] = host
<add> } else {
<add> log.Fatal(err)
<add> }
<ide> }
<ide>
<ide> if *bridgeName != "" {
<ide><path>utils/utils.go
<ide> import (
<ide> "index/suffixarray"
<ide> "io"
<ide> "io/ioutil"
<del> "log"
<ide> "net/http"
<ide> "os"
<ide> "os/exec"
<ide> func StripComments(input []byte, commentMarker []byte) []byte {
<ide> return output
<ide> }
<ide>
<del>func ParseHost(host string, port int, addr string) string {
<add>func ParseHost(host string, port int, addr string) (string, error) {
<ide> var proto string
<ide> switch {
<ide> case strings.HasPrefix(addr, "unix://"):
<del> return addr
<add> return addr, nil
<ide> case strings.HasPrefix(addr, "tcp://"):
<ide> proto = "tcp"
<ide> addr = strings.TrimPrefix(addr, "tcp://")
<ide> default:
<ide> if strings.Contains(addr, "://") {
<del> log.Fatal("Invalid bind address proto")
<add> return "", fmt.Errorf("Invalid bind address protocol: %s", addr)
<ide> }
<ide> proto = "tcp"
<ide> }
<ide>
<ide> if strings.Contains(addr, ":") {
<ide> hostParts := strings.Split(addr, ":")
<ide> if len(hostParts) != 2 {
<del> log.Fatal("Invalid bind address format.")
<add> return "", fmt.Errorf("Invalid bind address format: %s", addr)
<ide> }
<ide> if hostParts[0] != "" {
<ide> host = hostParts[0]
<ide> func ParseHost(host string, port int, addr string) string {
<ide> } else {
<ide> host = addr
<ide> }
<del> return fmt.Sprintf("%s://%s:%d", proto, host, port)
<add> return fmt.Sprintf("%s://%s:%d", proto, host, port), nil
<ide> }
<ide>
<ide> func GetReleaseVersion() string {
<ide><path>utils/utils_test.go
<ide> func TestHumanSize(t *testing.T) {
<ide> }
<ide>
<ide> func TestParseHost(t *testing.T) {
<del> if addr := ParseHost("127.0.0.1", 4243, "0.0.0.0"); addr != "tcp://0.0.0.0:4243" {
<add> if addr, err := ParseHost("127.0.0.1", 4243, "0.0.0.0"); err != nil || addr != "tcp://0.0.0.0:4243" {
<ide> t.Errorf("0.0.0.0 -> expected tcp://0.0.0.0:4243, got %s", addr)
<ide> }
<del> if addr := ParseHost("127.0.0.1", 4243, "0.0.0.1:5555"); addr != "tcp://0.0.0.1:5555" {
<add> if addr, err := ParseHost("127.0.0.1", 4243, "0.0.0.1:5555"); err != nil || addr != "tcp://0.0.0.1:5555" {
<ide> t.Errorf("0.0.0.1:5555 -> expected tcp://0.0.0.1:5555, got %s", addr)
<ide> }
<del> if addr := ParseHost("127.0.0.1", 4243, ":6666"); addr != "tcp://127.0.0.1:6666" {
<add> if addr, err := ParseHost("127.0.0.1", 4243, ":6666"); err != nil || addr != "tcp://127.0.0.1:6666" {
<ide> t.Errorf(":6666 -> expected tcp://127.0.0.1:6666, got %s", addr)
<ide> }
<del> if addr := ParseHost("127.0.0.1", 4243, "tcp://:7777"); addr != "tcp://127.0.0.1:7777" {
<add> if addr, err := ParseHost("127.0.0.1", 4243, "tcp://:7777"); err != nil || addr != "tcp://127.0.0.1:7777" {
<ide> t.Errorf("tcp://:7777 -> expected tcp://127.0.0.1:7777, got %s", addr)
<ide> }
<del> if addr := ParseHost("127.0.0.1", 4243, "unix:///var/run/docker.sock"); addr != "unix:///var/run/docker.sock" {
<add> if addr, err := ParseHost("127.0.0.1", 4243, "unix:///var/run/docker.sock"); err != nil || addr != "unix:///var/run/docker.sock" {
<ide> t.Errorf("unix:///var/run/docker.sock -> expected unix:///var/run/docker.sock, got %s", addr)
<ide> }
<add> if addr, err := ParseHost("127.0.0.1", 4243, "udp://127.0.0.1"); err == nil {
<add> t.Errorf("udp protocol address expected error return, but err == nil. Got %s", addr)
<add> }
<ide> }
<ide>
<ide> func TestParseRepositoryTag(t *testing.T) { | 3 |
Ruby | Ruby | treat empty hash and array as nil | 99ae95fda156bfedb94c503967c1ef622d30bd3f | <ide><path>actionview/lib/action_view/helpers/tag_helper.rb
<ide> def tag_options(options, escape = true)
<ide> value.each_pair do |k, v|
<ide> next if v.nil?
<ide>
<del> v = (v.is_a?(Array) || v.is_a?(Hash)) ? safe_join(TagHelper.build_tag_values(v), " ") : v.to_s
<add> case v
<add> when Array, Hash
<add> tokens = TagHelper.build_tag_values(v)
<add> next if tokens.none?
<add>
<add> v = safe_join(tokens, " ")
<add> else
<add> v = v.to_s
<add> end
<ide>
<ide> output << sep
<ide> output << prefix_tag_option(key, k, v, escape)
<ide><path>actionview/test/template/tag_helper_test.rb
<ide> def test_data_attributes
<ide> def test_aria_attributes
<ide> ["aria", :aria].each { |aria|
<ide> assert_dom_equal '<a aria-a-float="3.14" aria-a-big-decimal="-123.456" aria-a-number="1" aria-truthy="true" aria-falsey="false" aria-array="1 2 3" aria-hash="a b" aria-tokens="a b" aria-string-with-quotes="double"quote"party"" aria-string="hello" aria-symbol="foo" />',
<del> tag("a", aria => { nil: nil, a_float: 3.14, a_big_decimal: BigDecimal("-123.456"), a_number: 1, truthy: true, falsey: false, string: "hello", symbol: :foo, array: [1, 2, 3], hash: { a: true, b: "truthy", falsey: false, nil: nil }, tokens: ["a", { b: true, c: false }], string_with_quotes: 'double"quote"party"' })
<add> tag("a", aria => { nil: nil, a_float: 3.14, a_big_decimal: BigDecimal("-123.456"), a_number: 1, truthy: true, falsey: false, string: "hello", symbol: :foo, array: [1, 2, 3], empty_array: [], hash: { a: true, b: "truthy", falsey: false, nil: nil }, empty_hash: {}, tokens: ["a", { b: true, c: false }], empty_tokens: [{ a: false }], string_with_quotes: 'double"quote"party"' })
<ide> }
<ide>
<ide> assert_dom_equal '<a aria-a-float="3.14" aria-a-big-decimal="-123.456" aria-a-number="1" aria-truthy="true" aria-falsey="false" aria-array="1 2 3" aria-hash="a b" aria-tokens="a b" aria-string-with-quotes="double"quote"party"" aria-string="hello" aria-symbol="foo" />',
<del> tag.a(aria: { nil: nil, a_float: 3.14, a_big_decimal: BigDecimal("-123.456"), a_number: 1, truthy: true, falsey: false, string: "hello", symbol: :foo, array: [1, 2, 3], hash: { a: true, b: "truthy", falsey: false, nil: nil }, tokens: ["a", { b: true, c: false }], string_with_quotes: 'double"quote"party"' })
<add> tag.a(aria: { nil: nil, a_float: 3.14, a_big_decimal: BigDecimal("-123.456"), a_number: 1, truthy: true, falsey: false, string: "hello", symbol: :foo, array: [1, 2, 3], empty_array: [], hash: { a: true, b: "truthy", falsey: false, nil: nil }, empty_hash: {}, tokens: ["a", { b: true, c: false }], empty_tokens: [{ a: false }], string_with_quotes: 'double"quote"party"' })
<ide> end
<ide>
<ide> def test_link_to_data_nil_equal | 2 |
Java | Java | update copyright header | 75b18d7b7bf46a9cd8a5f9fb4c58adffec2a2cd4 | <ide><path>spring-test/src/main/java/org/springframework/test/web/servlet/result/ContentResultMatchers.java
<ide> /*
<del> * Copyright 2002-2015 the original author or authors.
<add> * Copyright 2002-2017 the original author or authors.
<ide> *
<ide> * Licensed under the Apache License, Version 2.0 (the "License");
<ide> * you may not use this file except in compliance with the License. | 1 |
Mixed | Ruby | extend date_select helper functionality | a48ef9b879a29cb54e01ad295224e056fb0966e1 | <ide><path>actionpack/CHANGELOG.md
<ide> ## Rails 4.0.0 (unreleased) ##
<ide>
<add>* `date_select` helper accepts :with_css_classes => true to add css classes similar with type
<add> of generated select tags. *Pavel Nikitin*
<add>
<ide> * `assert_template` can be used to assert on the same template with different locals
<ide> Fix #3675
<ide>
<ide><path>actionpack/lib/action_view/helpers/date_helper.rb
<ide> def time_ago_in_words(from_time, include_seconds_or_options = {})
<ide> # for <tt>:year</tt>, <tt>:month</tt>, <tt>:day</tt>, <tt>:hour</tt>, <tt>:minute</tt> and <tt>:second</tt>.
<ide> # Setting this option prepends a select option with a generic prompt (Day, Month, Year, Hour, Minute, Seconds)
<ide> # or the given prompt string.
<add> # * <tt>:with_css_classes</tt> - Set to true if you want assign different styles for 'select' tags. This option
<add> # automatically set classes 'year', 'month', 'day', 'hour', 'minute' and 'second' for your 'select' tags.
<ide> #
<ide> # If anything is passed in the +html_options+ hash it will be applied to every select tag in the set.
<ide> #
<ide> def build_select(type, select_options_as_html)
<ide> :name => input_name_from_type(type)
<ide> }.merge!(@html_options)
<ide> select_options[:disabled] = 'disabled' if @options[:disabled]
<add> select_options[:class] = type if @options[:with_css_classes]
<ide>
<ide> select_html = "\n"
<ide> select_html << content_tag(:option, '', :value => '') + "\n" if @options[:include_blank]
<ide><path>actionpack/test/template/date_helper_test.rb
<ide> def test_select_date_with_hidden
<ide> assert_dom_equal expected, select_date(Time.mktime(2003, 8, 16), { :date_separator => " / ", :prefix => "date[first]", :use_hidden => true })
<ide> end
<ide>
<add> def test_select_date_with_css_classes_option
<add> expected = %(<select id="date_first_year" name="date[first][year]" class="year">\n)
<add> expected << %(<option value="2003" selected="selected">2003</option>\n<option value="2004">2004</option>\n<option value="2005">2005</option>\n)
<add> expected << "</select>\n"
<add>
<add> expected << %(<select id="date_first_month" name="date[first][month]" class="month">\n)
<add> expected << %(<option value="1">January</option>\n<option value="2">February</option>\n<option value="3">March</option>\n<option value="4">April</option>\n<option value="5">May</option>\n<option value="6">June</option>\n<option value="7">July</option>\n<option value="8" selected="selected">August</option>\n<option value="9">September</option>\n<option value="10">October</option>\n<option value="11">November</option>\n<option value="12">December</option>\n)
<add> expected << "</select>\n"
<add>
<add> expected << %(<select id="date_first_day" name="date[first][day]" class="day">\n)
<add> expected << %(<option value="1">1</option>\n<option value="2">2</option>\n<option value="3">3</option>\n<option value="4">4</option>\n<option value="5">5</option>\n<option value="6">6</option>\n<option value="7">7</option>\n<option value="8">8</option>\n<option value="9">9</option>\n<option value="10">10</option>\n<option value="11">11</option>\n<option value="12">12</option>\n<option value="13">13</option>\n<option value="14">14</option>\n<option value="15">15</option>\n<option value="16" selected="selected">16</option>\n<option value="17">17</option>\n<option value="18">18</option>\n<option value="19">19</option>\n<option value="20">20</option>\n<option value="21">21</option>\n<option value="22">22</option>\n<option value="23">23</option>\n<option value="24">24</option>\n<option value="25">25</option>\n<option value="26">26</option>\n<option value="27">27</option>\n<option value="28">28</option>\n<option value="29">29</option>\n<option value="30">30</option>\n<option value="31">31</option>\n)
<add> expected << "</select>\n"
<add>
<add> assert_dom_equal expected, select_date(Time.mktime(2003, 8, 16), {:start_year => 2003, :end_year => 2005, :prefix => "date[first]", :with_css_classes => true})
<add> end
<add>
<ide> def test_select_datetime
<ide> expected = %(<select id="date_first_year" name="date[first][year]">\n)
<ide> expected << %(<option value="2003" selected="selected">2003</option>\n<option value="2004">2004</option>\n<option value="2005">2005</option>\n) | 3 |
Ruby | Ruby | allow dashes in github usernames | 827d263d017c02637a2745ee155ee3e03725f9cd | <ide><path>Library/Homebrew/cmd/tap.rb
<ide> def link_tap_formula formulae
<ide> private
<ide>
<ide> def tap_args
<del> ARGV.first =~ %r{^(\w+)/(homebrew-)?(\w+)$}
<add> ARGV.first =~ %r{^(\S+)/(homebrew-)?(\w+)$}
<ide> raise "Invalid usage" unless $1 and $3
<ide> [$1, $3]
<ide> end | 1 |
Javascript | Javascript | drop transferpropsto usage in react core | 225d76f77219dc9ae1d394893f31fde285961fbe | <ide><path>src/addons/transitions/ReactCSSTransitionGroup.js
<ide> var React = require('React');
<ide> var ReactTransitionGroup = require('ReactTransitionGroup');
<ide> var ReactCSSTransitionGroupChild = require('ReactCSSTransitionGroupChild');
<ide>
<add>var merge = require('merge');
<add>
<ide> var ReactCSSTransitionGroup = React.createClass({
<ide> displayName: 'ReactCSSTransitionGroup',
<ide>
<ide> var ReactCSSTransitionGroup = React.createClass({
<ide> },
<ide>
<ide> render: function() {
<del> return this.transferPropsTo(
<add> return (
<ide> ReactTransitionGroup(
<del> {childFactory: this._wrapChild},
<del> this.props.children
<add> merge(this.props, {childFactory: this._wrapChild})
<ide> )
<ide> );
<ide> }
<ide><path>src/addons/transitions/ReactTransitionGroup.js
<ide> var ReactTransitionGroup = React.createClass({
<ide> );
<ide> }
<ide> }
<del> return this.transferPropsTo(this.props.component(null, childrenToRender));
<add> return this.props.component(this.props, childrenToRender);
<ide> }
<ide> });
<ide>
<ide><path>src/browser/ui/dom/components/ReactDOMForm.js
<ide> var ReactDOMForm = ReactCompositeComponent.createClass({
<ide> // TODO: Instead of using `ReactDOM` directly, we should use JSX. However,
<ide> // `jshint` fails to parse JSX so in order for linting to work in the open
<ide> // source repo, we need to just use `ReactDOM.form`.
<del> return this.transferPropsTo(form(null, this.props.children));
<add> return form(this.props);
<ide> },
<ide>
<ide> componentDidMount: function() {
<ide><path>src/browser/ui/dom/components/createFullPageComponent.js
<ide> function createFullPageComponent(componentClass) {
<ide> },
<ide>
<ide> render: function() {
<del> return this.transferPropsTo(componentClass(null, this.props.children));
<add> return componentClass(this.props);
<ide> }
<ide> });
<ide> | 4 |
Ruby | Ruby | fix some more warnings on 1.9 | 640ee5b68d1078fc164bd4e10c019f284ad9b760 | <ide><path>activesupport/lib/active_support/core_ext/class/delegating_attributes.rb
<ide> def superclass_delegating_accessor(name, options = {})
<ide> # inheritance behavior, without having to store the object in an instance
<ide> # variable and look up the superclass chain manually.
<ide> def _stash_object_in_method(object, method, instance_reader = true)
<add> singleton_class.send(:remove_possible_method, method)
<ide> singleton_class.send(:define_method, method) { object }
<add> remove_possible_method(method)
<ide> define_method(method) { object } if instance_reader
<ide> end
<ide>
<ide><path>activesupport/test/abstract_unit.rb
<del>require File.expand_path('../../../load_paths', __FILE__)
<add>begin
<add> old, $VERBOSE = $VERBOSE, nil
<add> require File.expand_path('../../../load_paths', __FILE__)
<add>ensure
<add> $VERBOSE = old
<add>end
<ide>
<ide> lib = File.expand_path("#{File.dirname(__FILE__)}/../lib")
<ide> $:.unshift(lib) unless $:.include?('lib') || $:.include?(lib)
<ide>
<ide> require 'test/unit'
<del>require 'mocha'
<add>require 'active_support/core_ext/kernel/reporting'
<add>
<add>silence_warnings { require 'mocha' }
<ide>
<ide> ENV['NO_RELOAD'] = '1'
<ide> require 'active_support'
<ide><path>activesupport/test/core_ext/string_ext_test.rb
<ide> def test_sprintf
<ide>
<ide> def test_percent
<ide> assert_equal("% 1", "%% %<num>d" % {:num => 1.0})
<del> assert_equal("%{num} %<num>d", "%%{num} %%<num>d" % {:num => 1})
<add> assert_equal("%{num} %<num>d 1", "%%{num} %%<num>d %<num>d" % {:num => 1})
<ide> end
<ide>
<ide> def test_sprintf_percent_in_replacement | 3 |
Python | Python | make custom_object_scope thread-local | 8024bd3bd6da31adcbcfda28dacfc66f74e1fb20 | <ide><path>keras/utils/generic_utils.py
<ide> # If a layer does not have a defined config, then the returned config will be a
<ide> # dictionary with the below key.
<ide> _LAYER_UNDEFINED_CONFIG_KEY = "layer was saved without config"
<add># Thread-local custom objects set by custom_object_scope.
<add>_THREAD_LOCAL_CUSTOM_OBJECTS = threading.local()
<ide>
<ide>
<ide> @keras_export(
<ide> def __init__(self, *args):
<ide> self.backup = None
<ide>
<ide> def __enter__(self):
<del> self.backup = _GLOBAL_CUSTOM_OBJECTS.copy()
<add> self.backup = _THREAD_LOCAL_CUSTOM_OBJECTS.__dict__.copy()
<ide> for objects in self.custom_objects:
<del> _GLOBAL_CUSTOM_OBJECTS.update(objects)
<add> _THREAD_LOCAL_CUSTOM_OBJECTS.__dict__.update(objects)
<ide> return self
<ide>
<ide> def __exit__(self, *args, **kwargs):
<del> _GLOBAL_CUSTOM_OBJECTS.clear()
<del> _GLOBAL_CUSTOM_OBJECTS.update(self.backup)
<add> _THREAD_LOCAL_CUSTOM_OBJECTS.__dict__.clear()
<add> _THREAD_LOCAL_CUSTOM_OBJECTS.__dict__.update(self.backup)
<ide>
<ide>
<ide> @keras_export("keras.utils.get_custom_objects")
<ide> def get_custom_objects():
<ide> """Retrieves a live reference to the global dictionary of custom objects.
<ide>
<del> Updating and clearing custom objects using `custom_object_scope`
<del> is preferred, but `get_custom_objects` can
<del> be used to directly access the current collection of custom objects.
<add> Custom objects set using using `custom_object_scope` are not added to the
<add> global dictionary of custom objects, and will not appear in the returned
<add> dictionary.
<ide>
<ide> Example:
<ide>
<ide> def from_config(cls, config, custom_objects=None):
<ide> An instantiable class associated with 'name', or None if no such class
<ide> exists.
<ide> """
<del> if name in _GLOBAL_CUSTOM_OBJECTS:
<add> if name in _THREAD_LOCAL_CUSTOM_OBJECTS.__dict__:
<add> return _THREAD_LOCAL_CUSTOM_OBJECTS.__dict__[name]
<add> elif name in _GLOBAL_CUSTOM_OBJECTS:
<ide> return _GLOBAL_CUSTOM_OBJECTS[name]
<ide> elif custom_objects and name in custom_objects:
<ide> return custom_objects[name]
<ide> def serialize_keras_object(instance):
<ide>
<ide> def get_custom_objects_by_name(item, custom_objects=None):
<ide> """Returns the item if it is in either local or global custom objects."""
<del> if item in _GLOBAL_CUSTOM_OBJECTS:
<add> if item in _THREAD_LOCAL_CUSTOM_OBJECTS.__dict__:
<add> return _THREAD_LOCAL_CUSTOM_OBJECTS.__dict__[item]
<add> elif item in _GLOBAL_CUSTOM_OBJECTS:
<ide> return _GLOBAL_CUSTOM_OBJECTS[item]
<ide> elif custom_objects and item in custom_objects:
<ide> return custom_objects[item]
<ide> def deserialize(config, custom_objects=None):
<ide> cls_config,
<ide> custom_objects=dict(
<ide> list(_GLOBAL_CUSTOM_OBJECTS.items())
<add> + list(_THREAD_LOCAL_CUSTOM_OBJECTS.__dict__.items())
<ide> + list(custom_objects.items())
<ide> ),
<ide> )
<ide> def deserialize(config, custom_objects=None):
<ide> object_name = identifier
<ide> if custom_objects and object_name in custom_objects:
<ide> obj = custom_objects.get(object_name)
<add> elif object_name in _THREAD_LOCAL_CUSTOM_OBJECTS.__dict__:
<add> obj = _THREAD_LOCAL_CUSTOM_OBJECTS.__dict__[object_name]
<ide> elif object_name in _GLOBAL_CUSTOM_OBJECTS:
<ide> obj = _GLOBAL_CUSTOM_OBJECTS[object_name]
<ide> else:
<ide><path>keras/utils/generic_utils_test.py
<ide> def custom_fn():
<ide> class CustomClass:
<ide> pass
<ide>
<del> with keras.utils.generic_utils.custom_object_scope(
<del> {"CustomClass": CustomClass, "custom_fn": custom_fn}
<del> ):
<del> act = keras.activations.get("custom_fn")
<del> self.assertEqual(act, custom_fn)
<del> cl = keras.regularizers.get("CustomClass")
<del> self.assertEqual(cl.__class__, CustomClass)
<add> def check_get_in_thread():
<add> with keras.utils.generic_utils.custom_object_scope(
<add> {"CustomClass": CustomClass, "custom_fn": custom_fn}
<add> ):
<add> actual_custom_fn = keras.activations.get("custom_fn")
<add> self.assertEqual(actual_custom_fn, custom_fn)
<add> actual_custom_class = keras.regularizers.get("CustomClass")
<add> self.assertEqual(actual_custom_class.__class__, CustomClass)
<add>
<add> with keras.utils.generic_utils.custom_object_scope(
<add> {"CustomClass": CustomClass, "custom_fn": custom_fn}
<add> ):
<add> actual_custom_fn = keras.activations.get("custom_fn")
<add> self.assertEqual(actual_custom_fn, custom_fn)
<add> actual_custom_class = keras.regularizers.get("CustomClass")
<add> self.assertEqual(actual_custom_class.__class__, CustomClass)
<add> checked_thread = self.checkedThread(check_get_in_thread)
<add> checked_thread.start()
<add> checked_thread.join()
<ide>
<ide>
<ide> class SerializeKerasObjectTest(tf.test.TestCase): | 2 |
Ruby | Ruby | remove actionview tests which modify fixtures | d130ea2ff2f51dd1c53b2fb70305d71aad261c5d | <ide><path>actionview/test/template/compiled_templates_test.rb
<ide> def test_template_gets_recompiled_when_using_different_keys_in_local_assigns
<ide> assert_equal "two", render(template: "test/render_file_with_locals_and_default", locals: { secret: "two" })
<ide> end
<ide>
<del> def test_template_changes_are_not_reflected_with_cached_templates
<del> assert_equal "Hello world!", render(template: "test/hello_world")
<del> modify_template "test/hello_world.erb", "Goodbye world!" do
<del> assert_equal "Hello world!", render(template: "test/hello_world")
<del> end
<del> assert_equal "Hello world!", render(template: "test/hello_world")
<del> end
<del>
<del> def test_template_changes_are_reflected_with_uncached_templates
<del> assert_equal "Hello world!", render_without_cache(template: "test/hello_world")
<del> modify_template "test/hello_world.erb", "Goodbye world!" do
<del> assert_equal "Goodbye world!", render_without_cache(template: "test/hello_world")
<del> end
<del> assert_equal "Hello world!", render_without_cache(template: "test/hello_world")
<del> end
<del>
<ide> private
<ide> def render(*args)
<del> render_with_cache(*args)
<del> end
<del>
<del> def render_with_cache(*args)
<del> view_paths = ActionController::Base.view_paths
<del> view_class.with_view_paths(view_paths, {}).render(*args)
<del> end
<del>
<del> def render_without_cache(*args)
<del> path = ActionView::FileSystemResolver.new(FIXTURE_LOAD_PATH)
<del> view_paths = ActionView::PathSet.new([path])
<del> view_class.with_view_paths(view_paths, {}).render(*args)
<del> end
<del>
<del> def modify_template(template, content)
<del> filename = "#{FIXTURE_LOAD_PATH}/#{template}"
<del> old_content = File.read(filename)
<del> begin
<del> File.open(filename, "wb+") { |f| f.write(content) }
<del> yield
<del> ensure
<del> File.open(filename, "wb+") { |f| f.write(old_content) }
<del> end
<add> ActionController::Base.render(*args)
<ide> end
<ide> end | 1 |
Python | Python | fix incorrect shape in documentation | 6f83089e9a308bea4fd5346cbfe9c55c1590a23c | <ide><path>numpy/linalg/linalg.py
<ide> def lstsq(a, b, rcond="warn"):
<ide> x : {(N,), (N, K)} ndarray
<ide> Least-squares solution. If `b` is two-dimensional,
<ide> the solutions are in the `K` columns of `x`.
<del> residuals : {(), (1,), (K,)} ndarray
<add> residuals : {(1,), (K,), (0,)} ndarray
<ide> Sums of residuals; squared Euclidean 2-norm for each column in
<ide> ``b - a*x``.
<ide> If the rank of `a` is < N or M <= N, this is an empty array. | 1 |
Ruby | Ruby | use string#each_line instead of #each | 922c528d428b5ab08611976dfe0037875a4bf387 | <ide><path>ci/ci_build.rb
<ide> puts "[CruiseControl] #{`pg_config --version`}"
<ide> puts "[CruiseControl] SQLite2: #{`sqlite -version`}"
<ide> puts "[CruiseControl] SQLite3: #{`sqlite3 -version`}"
<del>`gem env`.each {|line| print "[CruiseControl] #{line}"}
<add>`gem env`.each_line {|line| print "[CruiseControl] #{line}"}
<ide> puts "[CruiseControl] Local gems:"
<del>`gem list`.each {|line| print "[CruiseControl] #{line}"}
<add>`gem list`.each_line {|line| print "[CruiseControl] #{line}"}
<ide>
<ide> failures = build_results.select { |key, value| value == false }
<ide> | 1 |
Go | Go | remove unused import | 52d471684350c31578f67c6b120106aefd619381 | <ide><path>profiles/seccomp/seccomp_unsupported.go
<ide> package seccomp
<ide>
<ide> import (
<ide> "github.com/docker/docker/api/types"
<del> "github.com/opencontainers/runtime-spec/specs-go"
<ide> )
<ide>
<ide> // DefaultProfile returns a nil pointer on unsupported systems. | 1 |
PHP | PHP | fix incorrect field detection for habtm fields | c2c63d373c60e8daced862db1fccb9137bcdd7a5 | <ide><path>lib/Cake/Test/Case/View/HelperTest.php
<ide> public function testSetEntityAssociatedCamelCaseFieldHabtmMultiple() {
<ide> $this->assertEquals(array('Tag', 'Tag'), $this->Helper->entity());
<ide> }
<ide>
<add>/**
<add> * Test that habtm associations can have property fields created.
<add> *
<add> * @return void
<add> */
<add> public function testSetEntityHabtmPropertyFieldNames() {
<add> $this->Helper->fieldset = array(
<add> 'HelperTestComment' => array(
<add> 'fields' => array('Tag' => array('type' => 'multiple'))
<add> )
<add> );
<add> $this->Helper->setEntity('HelperTestComment', true);
<add>
<add> $this->Helper->setEntity('Tag.name');
<add> $this->assertEquals('Tag', $this->Helper->model());
<add> $this->assertEquals('name', $this->Helper->field());
<add> $this->assertEquals(array('Tag', 'name'), $this->Helper->entity());
<add> }
<add>
<ide> /**
<ide> * test that 'view' doesn't break things.
<ide> *
<ide><path>lib/Cake/View/Helper.php
<ide> public function setEntity($entity, $setScope = false) {
<ide>
<ide> $this->_association = null;
<ide>
<del> // habtm models are special
<del> if (
<add> $isHabtm = (
<ide> isset($this->fieldset[$this->_modelScope]['fields'][$parts[0]]['type']) &&
<del> $this->fieldset[$this->_modelScope]['fields'][$parts[0]]['type'] === 'multiple'
<del> ) {
<add> $this->fieldset[$this->_modelScope]['fields'][$parts[0]]['type'] === 'multiple' &&
<add> $count == 1
<add> );
<add>
<add> // habtm models are special
<add> if ($count == 1 && $isHabtm) {
<ide> $this->_association = $parts[0];
<ide> $entity = $parts[0] . '.' . $parts[0];
<ide> } else {
<ide> // check for associated model.
<ide> $reversed = array_reverse($parts);
<del> foreach ($reversed as $part) {
<del> if (
<del> !isset($this->fieldset[$this->_modelScope]['fields'][$part]) &&
<del> preg_match('/^[A-Z]/', $part)
<del> ) {
<add> foreach ($reversed as $i => $part) {
<add> if ($i > 0 && preg_match('/^[A-Z]/', $part)) {
<ide> $this->_association = $part;
<ide> break;
<ide> }
<ide><path>lib/Cake/View/Helper/FormHelper.php
<ide> protected function _introspectModel($model, $key, $field = null) {
<ide> if ($key === 'fields') {
<ide> if (!isset($this->fieldset[$model]['fields'])) {
<ide> $fields = $this->fieldset[$model]['fields'] = $object->schema();
<del> }
<del> if (empty($field)) {
<ide> foreach ($object->hasAndBelongsToMany as $alias => $assocData) {
<ide> $this->fieldset[$object->alias]['fields'][$alias] = array('type' => 'multiple');
<ide> }
<add> }
<add> if (empty($field)) {
<ide> return $this->fieldset[$model]['fields'];
<ide> } elseif (isset($this->fieldset[$model]['fields'][$field])) {
<ide> return $this->fieldset[$model]['fields'][$field];
<ide> public function create($model = null, $options = array()) {
<ide>
<ide> if ($model !== false) {
<ide> $this->setEntity($model, true);
<add> $this->_introspectModel($model, 'fields');
<ide> }
<ide> return $this->Html->useTag('form', $action, $htmlAttributes) . $append;
<ide> }
<ide> public function dateTime($fieldName, $dateFormat = 'DMY', $timeFormat = '12', $a
<ide> return $opt;
<ide> }
<ide>
<del>/**
<del> * Add support for special HABTM syntax.
<del> *
<del> * Sets this helper's model and field properties to the dot-separated value-pair in $entity.
<del> *
<del> * @param mixed $entity A field name, like "ModelName.fieldName" or "ModelName.ID.fieldName"
<del> * @param boolean $setScope Sets the view scope to the model specified in $tagValue
<del> * @return void
<del> */
<del> public function setEntity($entity, $setScope = false) {
<del> parent::setEntity($entity, $setScope);
<del> $parts = explode('.', $entity);
<del> $field = $this->_introspectModel($this->_modelScope, 'fields', $parts[0]);
<del> if (!empty($field) && $field['type'] === 'multiple') {
<del> $this->_entityPath = $parts[0] . '.' . $parts[0];
<del> }
<del> }
<del>
<ide> /**
<ide> * Gets the input field name for the current tag
<ide> * | 3 |
Python | Python | use builtin when np.{x} is builtins.{x} | 2b781f8967488dc007f8f0a1e6a7f49208788d12 | <ide><path>benchmarks/benchmarks/bench_core.py
<ide> def time_count_nonzero_multi_axis(self, numaxes, size, dtype):
<ide>
<ide> class PackBits(Benchmark):
<ide> param_names = ['dtype']
<del> params = [[np.bool, np.uintp]]
<add> params = [[bool, np.uintp]]
<ide> def setup(self, dtype):
<ide> self.d = np.ones(10000, dtype=dtype)
<ide> self.d2 = np.ones((200, 1000), dtype=dtype)
<ide><path>benchmarks/benchmarks/bench_reduce.py
<ide> def time_reduce(self, axis, typename):
<ide>
<ide> class AnyAll(Benchmark):
<ide> def setup(self):
<del> self.zeros = np.zeros(100000, np.bool)
<del> self.ones = np.ones(100000, np.bool)
<add> self.zeros = np.zeros(100000, bool)
<add> self.ones = np.ones(100000, bool)
<ide>
<ide> def time_all_fast(self):
<ide> self.zeros.all()
<ide><path>benchmarks/benchmarks/bench_ufunc.py
<ide> def time_ufunc_types(self, ufuncname):
<ide>
<ide> class Custom(Benchmark):
<ide> def setup(self):
<del> self.b = np.ones(20000, dtype=np.bool)
<add> self.b = np.ones(20000, dtype=bool)
<ide>
<ide> def time_nonzero(self):
<ide> np.nonzero(self.b)
<ide><path>numpy/add_newdocs.py
<ide> def luf(lamdaexpr, *args, **kwargs):
<ide> >>> np.zeros(5)
<ide> array([ 0., 0., 0., 0., 0.])
<ide>
<del> >>> np.zeros((5,), dtype=np.int)
<add> >>> np.zeros((5,), dtype=int)
<ide> array([0, 0, 0, 0, 0])
<ide>
<ide> >>> np.zeros((2, 1))
<ide> def luf(lamdaexpr, *args, **kwargs):
<ide> Examples
<ide> --------
<ide> >>> iterable = (x*x for x in range(5))
<del> >>> np.fromiter(iterable, np.float)
<add> >>> np.fromiter(iterable, float)
<ide> array([ 0., 1., 4., 9., 16.])
<ide>
<ide> """)
<ide> def luf(lamdaexpr, *args, **kwargs):
<ide>
<ide> >>> np.can_cast(np.int32, np.int64)
<ide> True
<del> >>> np.can_cast(np.float64, np.complex)
<add> >>> np.can_cast(np.float64, complex)
<ide> True
<del> >>> np.can_cast(np.complex, np.float)
<add> >>> np.can_cast(complex, float)
<ide> False
<ide>
<ide> >>> np.can_cast('i8', 'f8')
<ide> def luf(lamdaexpr, *args, **kwargs):
<ide> The input array needs to be of integer dtype, otherwise a
<ide> TypeError is raised:
<ide>
<del> >>> np.bincount(np.arange(5, dtype=np.float))
<add> >>> np.bincount(np.arange(5, dtype=float))
<ide> Traceback (most recent call last):
<ide> File "<stdin>", line 1, in <module>
<ide> TypeError: array cannot be safely cast to required type
<ide> def luf(lamdaexpr, *args, **kwargs):
<ide> Using tuples. ``int`` is a fixed type, 3 the field's shape. ``void``
<ide> is a flexible type, here of size 10:
<ide>
<del> >>> np.dtype([('hello',(np.int,3)),('world',np.void,10)])
<add> >>> np.dtype([('hello',(int,3)),('world',np.void,10)])
<ide> dtype([('hello', '<i4', 3), ('world', '|V10')])
<ide>
<ide> Subdivide ``int16`` into 2 ``int8``'s, called x and y. 0 and 1 are
<ide><path>numpy/core/fromnumeric.py
<ide> def amax(a, axis=None, out=None, keepdims=np._NoValue):
<ide> >>> np.amax(a, axis=1) # Maxima along the second axis
<ide> array([1, 3])
<ide>
<del> >>> b = np.arange(5, dtype=np.float)
<add> >>> b = np.arange(5, dtype=float)
<ide> >>> b[2] = np.NaN
<ide> >>> np.amax(b)
<ide> nan
<ide> def amin(a, axis=None, out=None, keepdims=np._NoValue):
<ide> >>> np.amin(a, axis=1) # Minima along the second axis
<ide> array([0, 2])
<ide>
<del> >>> b = np.arange(5, dtype=np.float)
<add> >>> b = np.arange(5, dtype=float)
<ide> >>> b[2] = np.NaN
<ide> >>> np.amin(b)
<ide> nan
<ide> def prod(a, axis=None, dtype=None, out=None, keepdims=np._NoValue):
<ide> is the default platform integer:
<ide>
<ide> >>> x = np.array([1, 2, 3], dtype=np.int8)
<del> >>> np.prod(x).dtype == np.int
<add> >>> np.prod(x).dtype == int
<ide> True
<ide>
<ide> """
<ide><path>numpy/core/numeric.py
<ide> def zeros_like(a, dtype=None, order='K', subok=True):
<ide> array([[0, 0, 0],
<ide> [0, 0, 0]])
<ide>
<del> >>> y = np.arange(3, dtype=np.float)
<add> >>> y = np.arange(3, dtype=float)
<ide> >>> y
<ide> array([ 0., 1., 2.])
<ide> >>> np.zeros_like(y)
<ide> def ones(shape, dtype=None, order='C'):
<ide> >>> np.ones(5)
<ide> array([ 1., 1., 1., 1., 1.])
<ide>
<del> >>> np.ones((5,), dtype=np.int)
<add> >>> np.ones((5,), dtype=int)
<ide> array([1, 1, 1, 1, 1])
<ide>
<ide> >>> np.ones((2, 1))
<ide> def ones_like(a, dtype=None, order='K', subok=True):
<ide> array([[1, 1, 1],
<ide> [1, 1, 1]])
<ide>
<del> >>> y = np.arange(3, dtype=np.float)
<add> >>> y = np.arange(3, dtype=float)
<ide> >>> y
<ide> array([ 0., 1., 2.])
<ide> >>> np.ones_like(y)
<ide> def full_like(a, fill_value, dtype=None, order='K', subok=True):
<ide>
<ide> Examples
<ide> --------
<del> >>> x = np.arange(6, dtype=np.int)
<add> >>> x = np.arange(6, dtype=int)
<ide> >>> np.full_like(x, 1)
<ide> array([1, 1, 1, 1, 1, 1])
<ide> >>> np.full_like(x, 0.1)
<ide><path>numpy/core/numerictypes.py
<ide> def maximum_sctype(t):
<ide>
<ide> Examples
<ide> --------
<del> >>> np.maximum_sctype(np.int)
<add> >>> np.maximum_sctype(int)
<ide> <type 'numpy.int64'>
<ide> >>> np.maximum_sctype(np.uint8)
<ide> <type 'numpy.uint64'>
<del> >>> np.maximum_sctype(np.complex)
<add> >>> np.maximum_sctype(complex)
<ide> <type 'numpy.complex192'>
<ide>
<ide> >>> np.maximum_sctype(str)
<ide> def issubclass_(arg1, arg2):
<ide>
<ide> Examples
<ide> --------
<del> >>> np.issubclass_(np.int32, np.int)
<add> >>> np.issubclass_(np.int32, int)
<ide> True
<del> >>> np.issubclass_(np.int32, np.float)
<add> >>> np.issubclass_(np.int32, float)
<ide> False
<ide>
<ide> """
<ide> def issubsctype(arg1, arg2):
<ide> --------
<ide> >>> np.issubsctype('S8', str)
<ide> True
<del> >>> np.issubsctype(np.array([1]), np.int)
<add> >>> np.issubsctype(np.array([1]), int)
<ide> True
<del> >>> np.issubsctype(np.array([1]), np.float)
<add> >>> np.issubsctype(np.array([1]), float)
<ide> False
<ide>
<ide> """
<ide> def sctype2char(sctype):
<ide>
<ide> Examples
<ide> --------
<del> >>> for sctype in [np.int32, np.float, np.complex, np.string_, np.ndarray]:
<add> >>> for sctype in [np.int32, float, complex, np.string_, np.ndarray]:
<ide> ... print(np.sctype2char(sctype))
<ide> l
<ide> d
<ide> def find_common_type(array_types, scalar_types):
<ide>
<ide> Examples
<ide> --------
<del> >>> np.find_common_type([], [np.int64, np.float32, np.complex])
<add> >>> np.find_common_type([], [np.int64, np.float32, complex])
<ide> dtype('complex128')
<ide> >>> np.find_common_type([np.int64, np.float32], [])
<ide> dtype('float64')
<ide> def find_common_type(array_types, scalar_types):
<ide> Complex is of a different type, so it up-casts the float in the
<ide> `array_types` argument:
<ide>
<del> >>> np.find_common_type([np.float32], [np.complex])
<add> >>> np.find_common_type([np.float32], [complex])
<ide> dtype('complex128')
<ide>
<ide> Type specifier strings are convertible to dtypes and can therefore
<ide><path>numpy/core/tests/test_deprecations.py
<ide> class TestNonCContiguousViewDeprecation(_DeprecationTestCase):
<ide> """
<ide>
<ide> def test_fortran_contiguous(self):
<del> self.assert_deprecated(np.ones((2,2)).T.view, args=(np.complex,))
<add> self.assert_deprecated(np.ones((2,2)).T.view, args=(complex,))
<ide> self.assert_deprecated(np.ones((2,2)).T.view, args=(np.int8,))
<ide>
<ide>
<ide><path>numpy/core/tests/test_dtype.py
<ide> def assert_dtype_not_equal(a, b):
<ide> class TestBuiltin(object):
<ide> def test_run(self):
<ide> """Only test hash runs at all."""
<del> for t in [np.int, np.float, np.complex, np.int32, np.str, np.object,
<add> for t in [int, float, complex, np.int32, str, object,
<ide> np.unicode]:
<ide> dt = np.dtype(t)
<ide> hash(dt)
<ide>
<ide> def test_dtype(self):
<ide> # Make sure equivalent byte order char hash the same (e.g. < and = on
<ide> # little endian)
<del> for t in [np.int, np.float]:
<add> for t in [int, float]:
<ide> dt = np.dtype(t)
<ide> dt2 = dt.newbyteorder("<")
<ide> dt3 = dt.newbyteorder(">")
<ide> def test_bad_param(self):
<ide> class TestRecord(object):
<ide> def test_equivalent_record(self):
<ide> """Test whether equivalent record dtypes hash the same."""
<del> a = np.dtype([('yo', np.int)])
<del> b = np.dtype([('yo', np.int)])
<add> a = np.dtype([('yo', int)])
<add> b = np.dtype([('yo', int)])
<ide> assert_dtype_equal(a, b)
<ide>
<ide> def test_different_names(self):
<ide> # In theory, they may hash the same (collision) ?
<del> a = np.dtype([('yo', np.int)])
<del> b = np.dtype([('ye', np.int)])
<add> a = np.dtype([('yo', int)])
<add> b = np.dtype([('ye', int)])
<ide> assert_dtype_not_equal(a, b)
<ide>
<ide> def test_different_titles(self):
<ide> def test_different_titles(self):
<ide>
<ide> def test_mutate(self):
<ide> # Mutating a dtype should reset the cached hash value
<del> a = np.dtype([('yo', np.int)])
<del> b = np.dtype([('yo', np.int)])
<del> c = np.dtype([('ye', np.int)])
<add> a = np.dtype([('yo', int)])
<add> b = np.dtype([('yo', int)])
<add> c = np.dtype([('ye', int)])
<ide> assert_dtype_equal(a, b)
<ide> assert_dtype_not_equal(a, c)
<ide> a.names = ['ye']
<ide> def make_dtype(off):
<ide>
<ide> class TestSubarray(object):
<ide> def test_single_subarray(self):
<del> a = np.dtype((np.int, (2)))
<del> b = np.dtype((np.int, (2,)))
<add> a = np.dtype((int, (2)))
<add> b = np.dtype((int, (2,)))
<ide> assert_dtype_equal(a, b)
<ide>
<ide> assert_equal(type(a.subdtype[1]), tuple)
<ide> assert_equal(type(b.subdtype[1]), tuple)
<ide>
<ide> def test_equivalent_record(self):
<ide> """Test whether equivalent subarray dtypes hash the same."""
<del> a = np.dtype((np.int, (2, 3)))
<del> b = np.dtype((np.int, (2, 3)))
<add> a = np.dtype((int, (2, 3)))
<add> b = np.dtype((int, (2, 3)))
<ide> assert_dtype_equal(a, b)
<ide>
<ide> def test_nonequivalent_record(self):
<ide> """Test whether different subarray dtypes hash differently."""
<del> a = np.dtype((np.int, (2, 3)))
<del> b = np.dtype((np.int, (3, 2)))
<add> a = np.dtype((int, (2, 3)))
<add> b = np.dtype((int, (3, 2)))
<ide> assert_dtype_not_equal(a, b)
<ide>
<del> a = np.dtype((np.int, (2, 3)))
<del> b = np.dtype((np.int, (2, 2)))
<add> a = np.dtype((int, (2, 3)))
<add> b = np.dtype((int, (2, 2)))
<ide> assert_dtype_not_equal(a, b)
<ide>
<del> a = np.dtype((np.int, (1, 2, 3)))
<del> b = np.dtype((np.int, (1, 2)))
<add> a = np.dtype((int, (1, 2, 3)))
<add> b = np.dtype((int, (1, 2)))
<ide> assert_dtype_not_equal(a, b)
<ide>
<ide> def test_shape_equal(self):
<ide> """Test some data types that are equal"""
<ide> assert_dtype_equal(np.dtype('f8'), np.dtype(('f8', tuple())))
<ide> assert_dtype_equal(np.dtype('f8'), np.dtype(('f8', 1)))
<del> assert_dtype_equal(np.dtype((np.int, 2)), np.dtype((np.int, (2,))))
<add> assert_dtype_equal(np.dtype((int, 2)), np.dtype((int, (2,))))
<ide> assert_dtype_equal(np.dtype(('<f4', (3, 2))), np.dtype(('<f4', (3, 2))))
<ide> d = ([('a', 'f4', (1, 2)), ('b', 'f8', (3, 1))], (3, 2))
<ide> assert_dtype_equal(np.dtype(d), np.dtype(d))
<ide> class TestMonsterType(object):
<ide> def test1(self):
<ide> simple1 = np.dtype({'names': ['r', 'b'], 'formats': ['u1', 'u1'],
<ide> 'titles': ['Red pixel', 'Blue pixel']})
<del> a = np.dtype([('yo', np.int), ('ye', simple1),
<del> ('yi', np.dtype((np.int, (3, 2))))])
<del> b = np.dtype([('yo', np.int), ('ye', simple1),
<del> ('yi', np.dtype((np.int, (3, 2))))])
<add> a = np.dtype([('yo', int), ('ye', simple1),
<add> ('yi', np.dtype((int, (3, 2))))])
<add> b = np.dtype([('yo', int), ('ye', simple1),
<add> ('yi', np.dtype((int, (3, 2))))])
<ide> assert_dtype_equal(a, b)
<ide>
<del> c = np.dtype([('yo', np.int), ('ye', simple1),
<add> c = np.dtype([('yo', int), ('ye', simple1),
<ide> ('yi', np.dtype((a, (3, 2))))])
<del> d = np.dtype([('yo', np.int), ('ye', simple1),
<add> d = np.dtype([('yo', int), ('ye', simple1),
<ide> ('yi', np.dtype((a, (3, 2))))])
<ide> assert_dtype_equal(c, d)
<ide>
<ide> def check_pickling(self, dtype):
<ide> assert_equal(x[0], y[0])
<ide>
<ide> def test_builtin(self):
<del> for t in [np.int, np.float, np.complex, np.int32, np.str, np.object,
<del> np.unicode, np.bool]:
<add> for t in [int, float, complex, np.int32, str, object,
<add> np.unicode, bool]:
<ide> self.check_pickling(np.dtype(t))
<ide>
<ide> def test_structured(self):
<ide><path>numpy/core/tests/test_half.py
<ide> def test_half_conversions(self):
<ide> # Check the range for which all integers can be represented
<ide> i_int = np.arange(-2048, 2049)
<ide> i_f16 = np.array(i_int, dtype=float16)
<del> j = np.array(i_f16, dtype=np.int)
<add> j = np.array(i_f16, dtype=int)
<ide> assert_equal(i_int, j)
<ide>
<ide> def test_nans_infs(self):
<ide><path>numpy/core/tests/test_item_selection.py
<ide> def test_simple(self):
<ide> # Currently all types but object, use the same function generation.
<ide> # So it should not be necessary to test all. However test also a non
<ide> # refcounted struct on top of object.
<del> types = np.int, np.object, np.dtype([('', 'i', 2)])
<add> types = int, object, np.dtype([('', 'i', 2)])
<ide> for t in types:
<ide> # ta works, even if the array may be odd if buffer interface is used
<ide> ta = np.array(a if np.issubdtype(t, np.number) else a_str, dtype=t)
<ide><path>numpy/core/tests/test_multiarray.py
<ide> def test_array(self):
<ide> assert_equal(r[0], [d, d + 1])
<ide> assert_equal(r[1], d + 2)
<ide>
<del> tgt = np.ones((2, 3), dtype=np.bool)
<add> tgt = np.ones((2, 3), dtype=bool)
<ide> tgt[0, 2] = False
<ide> tgt[1, 0:2] = False
<ide> r = np.array([[True, True, False], [False, False, True]])
<ide> def test_empty_unicode(self):
<ide> str(d)
<ide>
<ide> def test_sequence_non_homogenous(self):
<del> assert_equal(np.array([4, 2**80]).dtype, np.object)
<del> assert_equal(np.array([4, 2**80, 4]).dtype, np.object)
<del> assert_equal(np.array([2**80, 4]).dtype, np.object)
<del> assert_equal(np.array([2**80] * 3).dtype, np.object)
<del> assert_equal(np.array([[1, 1],[1j, 1j]]).dtype, np.complex)
<del> assert_equal(np.array([[1j, 1j],[1, 1]]).dtype, np.complex)
<del> assert_equal(np.array([[1, 1, 1],[1, 1j, 1.], [1, 1, 1]]).dtype, np.complex)
<add> assert_equal(np.array([4, 2**80]).dtype, object)
<add> assert_equal(np.array([4, 2**80, 4]).dtype, object)
<add> assert_equal(np.array([2**80, 4]).dtype, object)
<add> assert_equal(np.array([2**80] * 3).dtype, object)
<add> assert_equal(np.array([[1, 1],[1j, 1j]]).dtype, complex)
<add> assert_equal(np.array([[1j, 1j],[1, 1]]).dtype, complex)
<add> assert_equal(np.array([[1, 1, 1],[1, 1j, 1.], [1, 1, 1]]).dtype, complex)
<ide>
<ide> @dec.skipif(sys.version_info[0] >= 3)
<ide> def test_sequence_long(self):
<ide> assert_equal(np.array([long(4), long(4)]).dtype, np.long)
<del> assert_equal(np.array([long(4), 2**80]).dtype, np.object)
<del> assert_equal(np.array([long(4), 2**80, long(4)]).dtype, np.object)
<del> assert_equal(np.array([2**80, long(4)]).dtype, np.object)
<add> assert_equal(np.array([long(4), 2**80]).dtype, object)
<add> assert_equal(np.array([long(4), 2**80, long(4)]).dtype, object)
<add> assert_equal(np.array([2**80, long(4)]).dtype, object)
<ide>
<ide> def test_non_sequence_sequence(self):
<ide> """Should not segfault.
<ide> def test_subarray_comparison(self):
<ide> # multi-dimensional field types work properly
<ide> a = np.rec.fromrecords(
<ide> [([1, 2, 3], 'a', [[1, 2], [3, 4]]), ([3, 3, 3], 'b', [[0, 0], [0, 0]])],
<del> dtype=[('a', ('f4', 3)), ('b', np.object), ('c', ('i4', (2, 2)))])
<add> dtype=[('a', ('f4', 3)), ('b', object), ('c', ('i4', (2, 2)))])
<ide> b = a.copy()
<ide> assert_equal(a == b, [True, True])
<ide> assert_equal(a != b, [False, False])
<ide> def test_test_interning(self):
<ide> assert_(np.array(True)[()] is a1)
<ide>
<ide> def test_sum(self):
<del> d = np.ones(101, dtype=np.bool)
<add> d = np.ones(101, dtype=bool)
<ide> assert_equal(d.sum(), d.size)
<ide> assert_equal(d[::2].sum(), d[::2].size)
<ide> assert_equal(d[::-2].sum(), d[::-2].size)
<ide> def check_count_nonzero(self, power, length):
<ide> powers = [2 ** i for i in range(length)]
<ide> for i in range(2**power):
<ide> l = [(i & x) != 0 for x in powers]
<del> a = np.array(l, dtype=np.bool)
<add> a = np.array(l, dtype=bool)
<ide> c = builtins.sum(l)
<ide> assert_equal(np.count_nonzero(a), c)
<ide> av = a.view(np.uint8)
<ide> def test_count_nonzero_all(self):
<ide> def test_count_nonzero_unaligned(self):
<ide> # prevent mistakes as e.g. gh-4060
<ide> for o in range(7):
<del> a = np.zeros((18,), dtype=np.bool)[o+1:]
<add> a = np.zeros((18,), dtype=bool)[o+1:]
<ide> a[:o] = True
<ide> assert_equal(np.count_nonzero(a), builtins.sum(a.tolist()))
<del> a = np.ones((18,), dtype=np.bool)[o+1:]
<add> a = np.ones((18,), dtype=bool)[o+1:]
<ide> a[:o] = False
<ide> assert_equal(np.count_nonzero(a), builtins.sum(a.tolist()))
<ide>
<ide> def test_sort(self):
<ide> assert_equal(c, a, msg)
<ide>
<ide> # test object array sorts.
<del> a = np.empty((101,), dtype=np.object)
<add> a = np.empty((101,), dtype=object)
<ide> a[:] = list(range(101))
<ide> b = a[::-1]
<ide> for kind in ['q', 'h', 'm']:
<ide> def test_argsort(self):
<ide> assert_equal(b.copy().argsort(kind=kind), rr, msg)
<ide>
<ide> # test object array argsorts.
<del> a = np.empty((101,), dtype=np.object)
<add> a = np.empty((101,), dtype=object)
<ide> a[:] = list(range(101))
<ide> b = a[::-1]
<ide> r = np.arange(101)
<ide> def test_argsort(self):
<ide> a = np.zeros(100)
<ide> assert_equal(a.argsort(kind='m'), r)
<ide> # complex
<del> a = np.zeros(100, dtype=np.complex)
<add> a = np.zeros(100, dtype=complex)
<ide> assert_equal(a.argsort(kind='m'), r)
<ide> # string
<ide> a = np.array(['aaaaaaaaa' for i in range(100)])
<ide> def test_elide_broadcast(self):
<ide> # only triggers elision code path in debug mode as triggering it in
<ide> # normal mode needs 256kb large matching dimension, so a lot of memory
<ide> d = np.ones((2000, 1), dtype=int)
<del> b = np.ones((2000), dtype=np.bool)
<add> b = np.ones((2000), dtype=bool)
<ide> r = (1 - d) + b
<ide> assert_equal(r, 1)
<ide> assert_equal(r.shape, (2000, 2000))
<ide> class TestIO(object):
<ide> def setup(self):
<ide> shape = (2, 4, 3)
<ide> rand = np.random.random
<del> self.x = rand(shape) + rand(shape).astype(np.complex)*1j
<add> self.x = rand(shape) + rand(shape).astype(complex)*1j
<ide> self.x[0,:, 1] = [np.nan, np.inf, -np.inf, np.nan]
<ide> self.dtype = self.x.dtype
<ide> self.tempdir = tempfile.mkdtemp()
<ide> def tst_basic(self, buffer, expected, kwargs):
<ide>
<ide> def test_ip_basic(self):
<ide> for byteorder in ['<', '>']:
<del> for dtype in [float, int, np.complex]:
<add> for dtype in [float, int, complex]:
<ide> dt = np.dtype(dtype).newbyteorder(byteorder)
<ide> x = (np.random.random((4, 7))*5).astype(dt)
<ide> buf = x.tobytes()
<ide> def test_basic(self):
<ide> assert_equal(np.vdot(b, b), 3)
<ide>
<ide> # test boolean
<del> b = np.eye(3, dtype=np.bool)
<add> b = np.eye(3, dtype=bool)
<ide> res = np.vdot(b, b)
<ide> assert_(np.isscalar(res))
<ide> assert_equal(np.vdot(b, b), True)
<ide> class TestMatmul(MatmulCommon):
<ide> matmul = np.matmul
<ide>
<ide> def test_out_arg(self):
<del> a = np.ones((2, 2), dtype=np.float)
<del> b = np.ones((2, 2), dtype=np.float)
<del> tgt = np.full((2,2), 2, dtype=np.float)
<add> a = np.ones((2, 2), dtype=float)
<add> b = np.ones((2, 2), dtype=float)
<add> tgt = np.full((2,2), 2, dtype=float)
<ide>
<ide> # test as positional argument
<ide> msg = "out positional argument"
<del> out = np.zeros((2, 2), dtype=np.float)
<add> out = np.zeros((2, 2), dtype=float)
<ide> self.matmul(a, b, out)
<ide> assert_array_equal(out, tgt, err_msg=msg)
<ide>
<ide> # test as keyword argument
<ide> msg = "out keyword argument"
<del> out = np.zeros((2, 2), dtype=np.float)
<add> out = np.zeros((2, 2), dtype=float)
<ide> self.matmul(a, b, out=out)
<ide> assert_array_equal(out, tgt, err_msg=msg)
<ide>
<ide> def test_out_arg(self):
<ide>
<ide> # test out non-contiguous
<ide> # msg = "out argument with non-contiguous layout"
<del> # c = np.zeros((2, 2, 2), dtype=np.float)
<add> # c = np.zeros((2, 2, 2), dtype=float)
<ide> # self.matmul(a, b, out=c[..., 0])
<ide> # assert_array_equal(c, tgt, err_msg=msg)
<ide>
<ide> def _test_simple2d(self, dt):
<ide> assert_array_equal(l, r)
<ide>
<ide> def test_simple2d(self):
<del> self._test_simple2d(np.float)
<add> self._test_simple2d(float)
<ide>
<ide> def test_simple2d_object(self):
<ide> self._test_simple2d(Decimal)
<ide> def _test_mirror2d(self, dt):
<ide> assert_array_equal(l, r)
<ide>
<ide> def test_mirror2d(self):
<del> self._test_mirror2d(np.float)
<add> self._test_mirror2d(float)
<ide>
<ide> def test_mirror2d_object(self):
<ide> self._test_mirror2d(Decimal)
<ide> def _test_simple(self, dt):
<ide> assert_array_equal(l, r)
<ide>
<ide> def test_simple_float(self):
<del> self._test_simple(np.float)
<add> self._test_simple(float)
<ide>
<ide> def test_simple_object(self):
<ide> self._test_simple(Decimal)
<ide> def _test_mirror(self, dt):
<ide> assert_array_equal(l, r)
<ide>
<ide> def test_mirror(self):
<del> self._test_mirror(np.float)
<add> self._test_mirror(float)
<ide>
<ide> def test_mirror_object(self):
<ide> self._test_mirror(Decimal)
<ide> def _test_circular(self, dt):
<ide> assert_array_equal(l, r)
<ide>
<ide> def test_circular(self):
<del> self._test_circular(np.float)
<add> self._test_circular(float)
<ide>
<ide> def test_circular_object(self):
<ide> self._test_circular(Decimal)
<ide> def __bool__(self):
<ide>
<ide> class TestWhere(object):
<ide> def test_basic(self):
<del> dts = [np.bool, np.int16, np.int32, np.int64, np.double, np.complex128,
<add> dts = [bool, np.int16, np.int32, np.int64, np.double, np.complex128,
<ide> np.longdouble, np.clongdouble]
<ide> for dt in dts:
<del> c = np.ones(53, dtype=np.bool)
<add> c = np.ones(53, dtype=bool)
<ide> assert_equal(np.where( c, dt(0), dt(1)), dt(0))
<ide> assert_equal(np.where(~c, dt(0), dt(1)), dt(1))
<ide> assert_equal(np.where(True, dt(0), dt(1)), dt(0))
<ide> def test_dtype_mix(self):
<ide> assert_equal(np.where(c, a, b), r)
<ide>
<ide> # non bool mask
<del> c = c.astype(np.int)
<add> c = c.astype(int)
<ide> c[c != 0] = 34242324
<ide> assert_equal(np.where(c, a, b), r)
<ide> # invert
<ide> def test_subclass_other(self):
<ide> class TestBytestringArrayNonzero(object):
<ide>
<ide> def test_empty_bstring_array_is_falsey(self):
<del> assert_(not np.array([''], dtype=np.str))
<add> assert_(not np.array([''], dtype=str))
<ide>
<ide> def test_whitespace_bstring_array_is_falsey(self):
<del> a = np.array(['spam'], dtype=np.str)
<add> a = np.array(['spam'], dtype=str)
<ide> a[0] = ' \0\0'
<ide> assert_(not a)
<ide>
<ide> def test_all_null_bstring_array_is_falsey(self):
<del> a = np.array(['spam'], dtype=np.str)
<add> a = np.array(['spam'], dtype=str)
<ide> a[0] = '\0\0\0\0'
<ide> assert_(not a)
<ide>
<ide> def test_null_inside_bstring_array_is_truthy(self):
<del> a = np.array(['spam'], dtype=np.str)
<add> a = np.array(['spam'], dtype=str)
<ide> a[0] = ' \0 \0'
<ide> assert_(a)
<ide>
<ide><path>numpy/core/tests/test_nditer.py
<ide> def test_iter_buffered_reduce_reuse():
<ide> op_flags = [('readonly',), ('readwrite', 'allocate')]
<ide> op_axes_list = [[(0, 1, 2), (0, 1, -1)], [(0, 1, 2), (0, -1, -1)]]
<ide> # wrong dtype to force buffering
<del> op_dtypes = [np.float, a.dtype]
<add> op_dtypes = [float, a.dtype]
<ide>
<ide> def get_params():
<ide> for xs in range(-3**2, 3**2 + 1):
<ide><path>numpy/core/tests/test_numeric.py
<ide> def test_bitwise_xor(self):
<ide> class TestBoolArray(object):
<ide> def setup(self):
<ide> # offset for simd tests
<del> self.t = np.array([True] * 41, dtype=np.bool)[1::]
<del> self.f = np.array([False] * 41, dtype=np.bool)[1::]
<del> self.o = np.array([False] * 42, dtype=np.bool)[2::]
<add> self.t = np.array([True] * 41, dtype=bool)[1::]
<add> self.f = np.array([False] * 41, dtype=bool)[1::]
<add> self.o = np.array([False] * 42, dtype=bool)[2::]
<ide> self.nm = self.f.copy()
<ide> self.im = self.t.copy()
<ide> self.nm[3] = True
<ide> def test_all_any(self):
<ide> assert_(not self.im.all())
<ide> # check bad element in all positions
<ide> for i in range(256 - 7):
<del> d = np.array([False] * 256, dtype=np.bool)[7::]
<add> d = np.array([False] * 256, dtype=bool)[7::]
<ide> d[i] = True
<ide> assert_(np.any(d))
<del> e = np.array([True] * 256, dtype=np.bool)[7::]
<add> e = np.array([True] * 256, dtype=bool)[7::]
<ide> e[i] = False
<ide> assert_(not np.all(e))
<ide> assert_array_equal(e, ~d)
<ide> # big array test for blocked libc loops
<ide> for i in list(range(9, 6000, 507)) + [7764, 90021, -10]:
<del> d = np.array([False] * 100043, dtype=np.bool)
<add> d = np.array([False] * 100043, dtype=bool)
<ide> d[i] = True
<ide> assert_(np.any(d), msg="%r" % i)
<del> e = np.array([True] * 100043, dtype=np.bool)
<add> e = np.array([True] * 100043, dtype=bool)
<ide> e[i] = False
<ide> assert_(not np.all(e), msg="%r" % i)
<ide>
<ide> def test_logical_and_or_xor(self):
<ide> class TestBoolCmp(object):
<ide> def setup(self):
<ide> self.f = np.ones(256, dtype=np.float32)
<del> self.ef = np.ones(self.f.size, dtype=np.bool)
<add> self.ef = np.ones(self.f.size, dtype=bool)
<ide> self.d = np.ones(128, dtype=np.float64)
<del> self.ed = np.ones(self.d.size, dtype=np.bool)
<add> self.ed = np.ones(self.d.size, dtype=bool)
<ide> # generate values for all permutation of 256bit simd vectors
<ide> s = 0
<ide> for i in range(32):
<ide> def test_promote_types_strings(self):
<ide>
<ide> def test_can_cast(self):
<ide> assert_(np.can_cast(np.int32, np.int64))
<del> assert_(np.can_cast(np.float64, np.complex))
<del> assert_(not np.can_cast(np.complex, np.float))
<add> assert_(np.can_cast(np.float64, complex))
<add> assert_(not np.can_cast(complex, float))
<ide>
<ide> assert_(np.can_cast('i8', 'f8'))
<ide> assert_(not np.can_cast('i8', 'f4'))
<ide> def test_nonzero_twodim(self):
<ide> def test_sparse(self):
<ide> # test special sparse condition boolean code path
<ide> for i in range(20):
<del> c = np.zeros(200, dtype=np.bool)
<add> c = np.zeros(200, dtype=bool)
<ide> c[i::20] = True
<ide> assert_equal(np.nonzero(c)[0], np.arange(i, 200 + i, 20))
<ide>
<del> c = np.zeros(400, dtype=np.bool)
<add> c = np.zeros(400, dtype=bool)
<ide> c[10 + i:20 + i] = True
<ide> c[20 + i*2] = True
<ide> assert_equal(np.nonzero(c)[0],
<ide> def test_count_nonzero_axis_consistent(self):
<ide>
<ide> rng = np.random.RandomState(1234)
<ide> m = rng.randint(-100, 100, size=size)
<del> n = m.astype(np.object)
<add> n = m.astype(object)
<ide>
<ide> for length in range(len(axis)):
<ide> for combo in combinations(axis, length):
<ide> def test_clip_complex(self):
<ide> # Address Issue gh-5354 for clipping complex arrays
<ide> # Test native complex input without explicit min/max
<ide> # ie, either min=None or max=None
<del> a = np.ones(10, dtype=np.complex)
<add> a = np.ones(10, dtype=complex)
<ide> m = a.min()
<ide> M = a.max()
<ide> am = self.fastclip(a, m, None)
<ide> def _setup(self, dt):
<ide> -102., -54., -19.], dtype=dt)
<ide>
<ide> def test_float(self):
<del> self._setup(np.float)
<add> self._setup(float)
<ide> z = np.correlate(self.x, self.y, 'full')
<ide> assert_array_almost_equal(z, self.z1)
<ide> z = np.correlate(self.x, self.y[:-1], 'full')
<ide> def test_no_overwrite(self):
<ide> assert_array_equal(k, np.ones(3))
<ide>
<ide> def test_complex(self):
<del> x = np.array([1, 2, 3, 4+1j], dtype=np.complex)
<del> y = np.array([-1, -2j, 3+1j], dtype=np.complex)
<del> r_z = np.array([3-1j, 6, 8+1j, 11+5j, -5+8j, -4-1j], dtype=np.complex)
<add> x = np.array([1, 2, 3, 4+1j], dtype=complex)
<add> y = np.array([-1, -2j, 3+1j], dtype=complex)
<add> r_z = np.array([3-1j, 6, 8+1j, 11+5j, -5+8j, -4-1j], dtype=complex)
<ide> r_z = r_z[::-1].conjugate()
<ide> z = np.correlate(y, x, mode='full')
<ide> assert_array_almost_equal(z, r_z)
<ide><path>numpy/core/tests/test_print.py
<ide> def test_float_types():
<ide> """ Check formatting.
<ide>
<ide> This is only for the str function, and only for simple types.
<del> The precision of np.float and np.longdouble aren't the same as the
<add> The precision of np.float32 and np.longdouble aren't the same as the
<ide> python float precision.
<ide>
<ide> """
<ide> def test_nan_inf_float():
<ide> """ Check formatting of nan & inf.
<ide>
<ide> This is only for the str function, and only for simple types.
<del> The precision of np.float and np.longdouble aren't the same as the
<add> The precision of np.float32 and np.longdouble aren't the same as the
<ide> python float precision.
<ide>
<ide> """
<ide> def test_complex_types():
<ide> """Check formatting of complex types.
<ide>
<ide> This is only for the str function, and only for simple types.
<del> The precision of np.float and np.longdouble aren't the same as the
<add> The precision of np.float32 and np.longdouble aren't the same as the
<ide> python float precision.
<ide>
<ide> """
<ide><path>numpy/core/tests/test_records.py
<ide> def test_fromrecords(self):
<ide>
<ide> def test_fromrecords_0len(self):
<ide> """ Verify fromrecords works with a 0-length input """
<del> dtype = [('a', np.float), ('b', np.float)]
<add> dtype = [('a', float), ('b', float)]
<ide> r = np.rec.fromrecords([], dtype=dtype)
<ide> assert_equal(r.shape, (0,))
<ide>
<ide> def test_recarray_conflict_fields(self):
<ide>
<ide> def test_fromrecords_with_explicit_dtype(self):
<ide> a = np.rec.fromrecords([(1, 'a'), (2, 'bbb')],
<del> dtype=[('a', int), ('b', np.object)])
<add> dtype=[('a', int), ('b', object)])
<ide> assert_equal(a.a, [1, 2])
<ide> assert_equal(a[0].a, 1)
<ide> assert_equal(a.b, ['a', 'bbb'])
<ide> assert_equal(a[-1].b, 'bbb')
<ide> #
<del> ndtype = np.dtype([('a', int), ('b', np.object)])
<add> ndtype = np.dtype([('a', int), ('b', object)])
<ide> a = np.rec.fromrecords([(1, 'a'), (2, 'bbb')], dtype=ndtype)
<ide> assert_equal(a.a, [1, 2])
<ide> assert_equal(a[0].a, 1)
<ide><path>numpy/core/tests/test_regression.py
<ide> def test_pickle_py2_bytes_encoding(self):
<ide>
<ide> def test_pickle_dtype(self, level=rlevel):
<ide> # Ticket #251
<del> pickle.dumps(np.float)
<add> pickle.dumps(float)
<ide>
<ide> def test_swap_real(self, level=rlevel):
<ide> # Ticket #265
<ide> def test_lexsort_buffer_length(self):
<ide> a = np.ones(100, dtype=np.int8)
<ide> b = np.ones(100, dtype=np.int32)
<ide> i = np.lexsort((a[::-1], b))
<del> assert_equal(i, np.arange(100, dtype=np.int))
<add> assert_equal(i, np.arange(100, dtype=int))
<ide>
<ide> def test_object_array_to_fixed_string(self):
<ide> # Ticket #1235.
<ide> def test_type(t):
<ide> min //= -1
<ide>
<ide> with np.errstate(divide="ignore"):
<del> for t in (np.int8, np.int16, np.int32, np.int64, np.int, np.long):
<add> for t in (np.int8, np.int16, np.int32, np.int64, int, np.long):
<ide> test_type(t)
<ide>
<ide> def test_buffer_hashlib(self):
<ide> class Subclass(np.ndarray):
<ide> @dec.skipif(not HAS_REFCOUNT, "python has no sys.getrefcount")
<ide> def test_take_refcount(self):
<ide> # ticket #939
<del> a = np.arange(16, dtype=np.float)
<add> a = np.arange(16, dtype=float)
<ide> a.shape = (4, 4)
<del> lut = np.ones((5 + 3, 4), np.float)
<add> lut = np.ones((5 + 3, 4), float)
<ide> rgba = np.empty(shape=a.shape + (4,), dtype=lut.dtype)
<ide> c1 = sys.getrefcount(rgba)
<ide> try:
<ide> def test_leak_in_structured_dtype_comparison(self):
<ide> # gh-6250
<ide> recordtype = np.dtype([('a', np.float64),
<ide> ('b', np.int32),
<del> ('d', (np.str, 5))])
<add> ('d', (str, 5))])
<ide>
<ide> # Simple case
<ide> a = np.zeros(2, dtype=recordtype)
<ide><path>numpy/core/tests/test_scalarmath.py
<ide> def test_large_types(self):
<ide>
<ide> def test_integers_to_negative_integer_power(self):
<ide> # Note that the combination of uint64 with a signed integer
<del> # has common type np.float. The other combinations should all
<add> # has common type np.float64. The other combinations should all
<ide> # raise a ValueError for integer ** negative integer.
<ide> exp = [np.array(-1, dt)[()] for dt in 'bhilq']
<ide>
<ide><path>numpy/core/tests/test_ufunc.py
<ide> class TestUfuncKwargs(object):
<ide> def test_kwarg_exact(self):
<ide> assert_raises(TypeError, np.add, 1, 2, castingx='safe')
<del> assert_raises(TypeError, np.add, 1, 2, dtypex=np.int)
<add> assert_raises(TypeError, np.add, 1, 2, dtypex=int)
<ide> assert_raises(TypeError, np.add, 1, 2, extobjx=[4096])
<ide> assert_raises(TypeError, np.add, 1, 2, outx=None)
<ide> assert_raises(TypeError, np.add, 1, 2, sigx='ii->i')
<ide> def test_sig_signature(self):
<ide>
<ide> def test_sig_dtype(self):
<ide> assert_raises(RuntimeError, np.add, 1, 2, sig='ii->i',
<del> dtype=np.int)
<add> dtype=int)
<ide> assert_raises(RuntimeError, np.add, 1, 2, signature='ii->i',
<del> dtype=np.int)
<add> dtype=int)
<ide>
<ide>
<ide> class TestUfunc(object):
<ide> def logical_xor(self, obj):
<ide>
<ide> # check unary PyUFunc_O_O
<ide> msg = "PyUFunc_O_O"
<del> x = np.ones(10, dtype=np.object)[0::2]
<add> x = np.ones(10, dtype=object)[0::2]
<ide> assert_(np.all(np.abs(x) == 1), msg)
<ide> # check unary PyUFunc_O_O_method
<ide> msg = "PyUFunc_O_O_method"
<del> x = np.zeros(10, dtype=np.object)[0::2]
<add> x = np.zeros(10, dtype=object)[0::2]
<ide> for i in range(len(x)):
<ide> x[i] = foo()
<ide> assert_(np.all(np.conjugate(x) == True), msg)
<ide>
<ide> # check binary PyUFunc_OO_O
<ide> msg = "PyUFunc_OO_O"
<del> x = np.ones(10, dtype=np.object)[0::2]
<add> x = np.ones(10, dtype=object)[0::2]
<ide> assert_(np.all(np.add(x, x) == 2), msg)
<ide> # check binary PyUFunc_OO_O_method
<ide> msg = "PyUFunc_OO_O_method"
<del> x = np.zeros(10, dtype=np.object)[0::2]
<add> x = np.zeros(10, dtype=object)[0::2]
<ide> for i in range(len(x)):
<ide> x[i] = foo()
<ide> assert_(np.all(np.logical_xor(x, x)), msg)
<ide> def test_sum_stability(self):
<ide> assert_almost_equal((a / 10.).sum() - a.size / 10., 0, 13)
<ide>
<ide> def test_sum(self):
<del> for dt in (np.int, np.float16, np.float32, np.float64, np.longdouble):
<add> for dt in (int, np.float16, np.float32, np.float64, np.longdouble):
<ide> for v in (0, 1, 2, 7, 8, 9, 15, 16, 19, 127,
<ide> 128, 1024, 1235):
<ide> tgt = dt(v * (v + 1) / 2)
<ide> def broadcastable(s1, s2):
<ide> assert_equal(ref, True, err_msg="reference check")
<ide>
<ide> def test_euclidean_pdist(self):
<del> a = np.arange(12, dtype=np.float).reshape(4, 3)
<add> a = np.arange(12, dtype=float).reshape(4, 3)
<ide> out = np.empty((a.shape[0] * (a.shape[0] - 1) // 2,), dtype=a.dtype)
<ide> umt.euclidean_pdist(a, out)
<ide> b = np.sqrt(np.sum((a[:, None] - a)**2, axis=-1))
<ide> def test_inplace_fancy_indexing(self):
<ide> assert_array_equal(values, [1, 8, 6, 4])
<ide>
<ide> # Test exception thrown
<del> values = np.array(['a', 1], dtype=np.object)
<add> values = np.array(['a', 1], dtype=object)
<ide> assert_raises(TypeError, np.add.at, values, [0, 1], 1)
<del> assert_array_equal(values, np.array(['a', 1], dtype=np.object))
<add> assert_array_equal(values, np.array(['a', 1], dtype=object))
<ide>
<ide> # Test multiple output ufuncs raise error, gh-5665
<ide> assert_raises(ValueError, np.modf.at, np.arange(10), [1])
<ide><path>numpy/core/tests/test_umath.py
<ide> def test_object_nans(self):
<ide> # fail if cmp is used instead of rich compare.
<ide> # Failure cannot be guaranteed.
<ide> for i in range(1):
<del> x = np.array(float('nan'), np.object)
<add> x = np.array(float('nan'), object)
<ide> y = 1.0
<del> z = np.array(float('nan'), np.object)
<add> z = np.array(float('nan'), object)
<ide> assert_(np.maximum(x, y) == 1.0)
<ide> assert_(np.maximum(z, y) == 1.0)
<ide>
<ide> def test_complex_nans(self):
<ide> nan = np.nan
<ide> for cnan in [complex(nan, 0), complex(0, nan), complex(nan, nan)]:
<del> arg1 = np.array([0, cnan, cnan], dtype=np.complex)
<del> arg2 = np.array([cnan, 0, cnan], dtype=np.complex)
<del> out = np.array([nan, nan, nan], dtype=np.complex)
<add> arg1 = np.array([0, cnan, cnan], dtype=complex)
<add> arg2 = np.array([cnan, 0, cnan], dtype=complex)
<add> out = np.array([nan, nan, nan], dtype=complex)
<ide> assert_equal(np.maximum(arg1, arg2), out)
<ide>
<ide> def test_object_array(self):
<del> arg1 = np.arange(5, dtype=np.object)
<add> arg1 = np.arange(5, dtype=object)
<ide> arg2 = arg1 + 1
<ide> assert_equal(np.maximum(arg1, arg2), arg2)
<ide>
<ide> def test_object_nans(self):
<ide> # fail if cmp is used instead of rich compare.
<ide> # Failure cannot be guaranteed.
<ide> for i in range(1):
<del> x = np.array(float('nan'), np.object)
<add> x = np.array(float('nan'), object)
<ide> y = 1.0
<del> z = np.array(float('nan'), np.object)
<add> z = np.array(float('nan'), object)
<ide> assert_(np.minimum(x, y) == 1.0)
<ide> assert_(np.minimum(z, y) == 1.0)
<ide>
<ide> def test_complex_nans(self):
<ide> nan = np.nan
<ide> for cnan in [complex(nan, 0), complex(0, nan), complex(nan, nan)]:
<del> arg1 = np.array([0, cnan, cnan], dtype=np.complex)
<del> arg2 = np.array([cnan, 0, cnan], dtype=np.complex)
<del> out = np.array([nan, nan, nan], dtype=np.complex)
<add> arg1 = np.array([0, cnan, cnan], dtype=complex)
<add> arg2 = np.array([cnan, 0, cnan], dtype=complex)
<add> out = np.array([nan, nan, nan], dtype=complex)
<ide> assert_equal(np.minimum(arg1, arg2), out)
<ide>
<ide> def test_object_array(self):
<del> arg1 = np.arange(5, dtype=np.object)
<add> arg1 = np.arange(5, dtype=object)
<ide> arg2 = arg1 + 1
<ide> assert_equal(np.minimum(arg1, arg2), arg1)
<ide>
<ide> def test_float_nans(self):
<ide> def test_complex_nans(self):
<ide> nan = np.nan
<ide> for cnan in [complex(nan, 0), complex(0, nan), complex(nan, nan)]:
<del> arg1 = np.array([0, cnan, cnan], dtype=np.complex)
<del> arg2 = np.array([cnan, 0, cnan], dtype=np.complex)
<del> out = np.array([0, 0, nan], dtype=np.complex)
<add> arg1 = np.array([0, cnan, cnan], dtype=complex)
<add> arg2 = np.array([cnan, 0, cnan], dtype=complex)
<add> out = np.array([0, 0, nan], dtype=complex)
<ide> assert_equal(np.fmax(arg1, arg2), out)
<ide>
<ide>
<ide> def test_float_nans(self):
<ide> def test_complex_nans(self):
<ide> nan = np.nan
<ide> for cnan in [complex(nan, 0), complex(0, nan), complex(nan, nan)]:
<del> arg1 = np.array([0, cnan, cnan], dtype=np.complex)
<del> arg2 = np.array([cnan, 0, cnan], dtype=np.complex)
<del> out = np.array([0, 0, nan], dtype=np.complex)
<add> arg1 = np.array([0, cnan, cnan], dtype=complex)
<add> arg2 = np.array([cnan, 0, cnan], dtype=complex)
<add> out = np.array([0, 0, nan], dtype=complex)
<ide> assert_equal(np.fmin(arg1, arg2), out)
<ide>
<ide>
<ide> def test_reduction(self):
<ide> class TestInt(object):
<ide> def test_logical_not(self):
<ide> x = np.ones(10, dtype=np.int16)
<del> o = np.ones(10 * 2, dtype=np.bool)
<add> o = np.ones(10 * 2, dtype=bool)
<ide> tgt = o.copy()
<ide> tgt[::2] = False
<ide> os = o[::2]
<ide> def test_sign_dtype_object(self):
<ide> # In reference to github issue #6229
<ide>
<ide> foo = np.array([-.1, 0, .1])
<del> a = np.sign(foo.astype(np.object))
<add> a = np.sign(foo.astype(object))
<ide> b = np.sign(foo)
<ide>
<ide> assert_array_equal(a, b)
<ide> def test_sign_dtype_nan_object(self):
<ide> # In reference to github issue #6229
<ide> def test_nan():
<ide> foo = np.array([np.nan])
<del> a = np.sign(foo.astype(np.object))
<add> a = np.sign(foo.astype(object))
<ide>
<ide> assert_raises(TypeError, test_nan)
<ide>
<ide> def test_it(self):
<ide> else:
<ide> x = .5
<ide> fr = f(x)
<del> fz = f(np.complex(x))
<add> fz = f(complex(x))
<ide> assert_almost_equal(fz.real, fr, err_msg='real part %s' % f)
<ide> assert_almost_equal(fz.imag, 0., err_msg='imag part %s' % f)
<ide>
<ide> def test_against_cmath(self):
<ide> points = [-1-1j, -1+1j, +1-1j, +1+1j]
<ide> name_map = {'arcsin': 'asin', 'arccos': 'acos', 'arctan': 'atan',
<ide> 'arcsinh': 'asinh', 'arccosh': 'acosh', 'arctanh': 'atanh'}
<del> atol = 4*np.finfo(np.complex).eps
<add> atol = 4*np.finfo(complex).eps
<ide> for func in self.funcs:
<ide> fname = func.__name__.split('.')[-1]
<ide> cname = name_map.get(fname, fname)
<ide> def __new__(subtype, shape):
<ide> assert_equal(a+a, a)
<ide>
<ide> def _check_branch_cut(f, x0, dx, re_sign=1, im_sign=-1, sig_zero_ok=False,
<del> dtype=np.complex):
<add> dtype=complex):
<ide> """
<ide> Check for a branch cut in a function.
<ide>
<ide><path>numpy/core/tests/test_umath_complex.py
<ide> def test_simple(self):
<ide> yield check, f, 1, 0, np.exp(1), 0, False
<ide> yield check, f, 0, 1, np.cos(1), np.sin(1), False
<ide>
<del> ref = np.exp(1) * np.complex(np.cos(1), np.sin(1))
<add> ref = np.exp(1) * complex(np.cos(1), np.sin(1))
<ide> yield check, f, 1, 1, ref.real, ref.imag, False
<ide>
<ide> @platform_skip
<ide> def test_special_values(self):
<ide> def _check_ninf_inf(dummy):
<ide> msgform = "cexp(-inf, inf) is (%f, %f), expected (+-0, +-0)"
<ide> with np.errstate(invalid='ignore'):
<del> z = f(np.array(np.complex(-np.inf, np.inf)))
<add> z = f(np.array(complex(-np.inf, np.inf)))
<ide> if z.real != 0 or z.imag != 0:
<ide> raise AssertionError(msgform % (z.real, z.imag))
<ide>
<ide> def _check_ninf_inf(dummy):
<ide> def _check_inf_inf(dummy):
<ide> msgform = "cexp(inf, inf) is (%f, %f), expected (+-inf, nan)"
<ide> with np.errstate(invalid='ignore'):
<del> z = f(np.array(np.complex(np.inf, np.inf)))
<add> z = f(np.array(complex(np.inf, np.inf)))
<ide> if not np.isinf(z.real) or not np.isnan(z.imag):
<ide> raise AssertionError(msgform % (z.real, z.imag))
<ide>
<ide> def _check_inf_inf(dummy):
<ide> def _check_ninf_nan(dummy):
<ide> msgform = "cexp(-inf, nan) is (%f, %f), expected (+-0, +-0)"
<ide> with np.errstate(invalid='ignore'):
<del> z = f(np.array(np.complex(-np.inf, np.nan)))
<add> z = f(np.array(complex(-np.inf, np.nan)))
<ide> if z.real != 0 or z.imag != 0:
<ide> raise AssertionError(msgform % (z.real, z.imag))
<ide>
<ide> def _check_ninf_nan(dummy):
<ide> def _check_inf_nan(dummy):
<ide> msgform = "cexp(-inf, nan) is (%f, %f), expected (+-inf, nan)"
<ide> with np.errstate(invalid='ignore'):
<del> z = f(np.array(np.complex(np.inf, np.nan)))
<add> z = f(np.array(complex(np.inf, np.nan)))
<ide> if not np.isinf(z.real) or not np.isnan(z.imag):
<ide> raise AssertionError(msgform % (z.real, z.imag))
<ide>
<ide> def test_special_values(self):
<ide> # clog(-0 + i0) returns -inf + i pi and raises the 'divide-by-zero'
<ide> # floating-point exception.
<ide> with np.errstate(divide='raise'):
<del> x = np.array([np.NZERO], dtype=np.complex)
<del> y = np.complex(-np.inf, np.pi)
<add> x = np.array([np.NZERO], dtype=complex)
<add> y = complex(-np.inf, np.pi)
<ide> assert_raises(FloatingPointError, np.log, x)
<ide> with np.errstate(divide='ignore'):
<ide> assert_almost_equal(np.log(x), y)
<ide> def test_special_values(self):
<ide> # clog(+0 + i0) returns -inf + i0 and raises the 'divide-by-zero'
<ide> # floating-point exception.
<ide> with np.errstate(divide='raise'):
<del> x = np.array([0], dtype=np.complex)
<del> y = np.complex(-np.inf, 0)
<add> x = np.array([0], dtype=complex)
<add> y = complex(-np.inf, 0)
<ide> assert_raises(FloatingPointError, np.log, x)
<ide> with np.errstate(divide='ignore'):
<ide> assert_almost_equal(np.log(x), y)
<ide> def test_special_values(self):
<ide> yl.append(y)
<ide>
<ide> # clog(x + i inf returns +inf + i pi /2, for finite x.
<del> x = np.array([complex(1, np.inf)], dtype=np.complex)
<del> y = np.complex(np.inf, 0.5 * np.pi)
<add> x = np.array([complex(1, np.inf)], dtype=complex)
<add> y = complex(np.inf, 0.5 * np.pi)
<ide> assert_almost_equal(np.log(x), y)
<ide> xl.append(x)
<ide> yl.append(y)
<ide>
<del> x = np.array([complex(-1, np.inf)], dtype=np.complex)
<add> x = np.array([complex(-1, np.inf)], dtype=complex)
<ide> assert_almost_equal(np.log(x), y)
<ide> xl.append(x)
<ide> yl.append(y)
<ide>
<ide> # clog(x + iNaN) returns NaN + iNaN and optionally raises the
<ide> # 'invalid' floating- point exception, for finite x.
<ide> with np.errstate(invalid='raise'):
<del> x = np.array([complex(1., np.nan)], dtype=np.complex)
<del> y = np.complex(np.nan, np.nan)
<add> x = np.array([complex(1., np.nan)], dtype=complex)
<add> y = complex(np.nan, np.nan)
<ide> #assert_raises(FloatingPointError, np.log, x)
<ide> with np.errstate(invalid='ignore'):
<ide> assert_almost_equal(np.log(x), y)
<ide> def test_special_values(self):
<ide> yl.append(y)
<ide>
<ide> with np.errstate(invalid='raise'):
<del> x = np.array([np.inf + 1j * np.nan], dtype=np.complex)
<add> x = np.array([np.inf + 1j * np.nan], dtype=complex)
<ide> #assert_raises(FloatingPointError, np.log, x)
<ide> with np.errstate(invalid='ignore'):
<ide> assert_almost_equal(np.log(x), y)
<ide> def test_special_values(self):
<ide> yl.append(y)
<ide>
<ide> # clog(- inf + iy) returns +inf + ipi , for finite positive-signed y.
<del> x = np.array([-np.inf + 1j], dtype=np.complex)
<del> y = np.complex(np.inf, np.pi)
<add> x = np.array([-np.inf + 1j], dtype=complex)
<add> y = complex(np.inf, np.pi)
<ide> assert_almost_equal(np.log(x), y)
<ide> xl.append(x)
<ide> yl.append(y)
<ide>
<ide> # clog(+ inf + iy) returns +inf + i0, for finite positive-signed y.
<del> x = np.array([np.inf + 1j], dtype=np.complex)
<del> y = np.complex(np.inf, 0)
<add> x = np.array([np.inf + 1j], dtype=complex)
<add> y = complex(np.inf, 0)
<ide> assert_almost_equal(np.log(x), y)
<ide> xl.append(x)
<ide> yl.append(y)
<ide>
<ide> # clog(- inf + i inf) returns +inf + i3pi /4.
<del> x = np.array([complex(-np.inf, np.inf)], dtype=np.complex)
<del> y = np.complex(np.inf, 0.75 * np.pi)
<add> x = np.array([complex(-np.inf, np.inf)], dtype=complex)
<add> y = complex(np.inf, 0.75 * np.pi)
<ide> assert_almost_equal(np.log(x), y)
<ide> xl.append(x)
<ide> yl.append(y)
<ide>
<ide> # clog(+ inf + i inf) returns +inf + ipi /4.
<del> x = np.array([complex(np.inf, np.inf)], dtype=np.complex)
<del> y = np.complex(np.inf, 0.25 * np.pi)
<add> x = np.array([complex(np.inf, np.inf)], dtype=complex)
<add> y = complex(np.inf, 0.25 * np.pi)
<ide> assert_almost_equal(np.log(x), y)
<ide> xl.append(x)
<ide> yl.append(y)
<ide>
<ide> # clog(+/- inf + iNaN) returns +inf + iNaN.
<del> x = np.array([complex(np.inf, np.nan)], dtype=np.complex)
<del> y = np.complex(np.inf, np.nan)
<add> x = np.array([complex(np.inf, np.nan)], dtype=complex)
<add> y = complex(np.inf, np.nan)
<ide> assert_almost_equal(np.log(x), y)
<ide> xl.append(x)
<ide> yl.append(y)
<ide>
<del> x = np.array([complex(-np.inf, np.nan)], dtype=np.complex)
<add> x = np.array([complex(-np.inf, np.nan)], dtype=complex)
<ide> assert_almost_equal(np.log(x), y)
<ide> xl.append(x)
<ide> yl.append(y)
<ide>
<ide> # clog(NaN + iy) returns NaN + iNaN and optionally raises the
<ide> # 'invalid' floating-point exception, for finite y.
<del> x = np.array([complex(np.nan, 1)], dtype=np.complex)
<del> y = np.complex(np.nan, np.nan)
<add> x = np.array([complex(np.nan, 1)], dtype=complex)
<add> y = complex(np.nan, np.nan)
<ide> assert_almost_equal(np.log(x), y)
<ide> xl.append(x)
<ide> yl.append(y)
<ide>
<ide> # clog(NaN + i inf) returns +inf + iNaN.
<del> x = np.array([complex(np.nan, np.inf)], dtype=np.complex)
<del> y = np.complex(np.inf, np.nan)
<add> x = np.array([complex(np.nan, np.inf)], dtype=complex)
<add> y = complex(np.inf, np.nan)
<ide> assert_almost_equal(np.log(x), y)
<ide> xl.append(x)
<ide> yl.append(y)
<ide>
<ide> # clog(NaN + iNaN) returns NaN + iNaN.
<del> x = np.array([complex(np.nan, np.nan)], dtype=np.complex)
<del> y = np.complex(np.nan, np.nan)
<add> x = np.array([complex(np.nan, np.nan)], dtype=complex)
<add> y = complex(np.nan, np.nan)
<ide> assert_almost_equal(np.log(x), y)
<ide> xl.append(x)
<ide> yl.append(y)
<ide>
<ide> # clog(conj(z)) = conj(clog(z)).
<del> xa = np.array(xl, dtype=np.complex)
<del> ya = np.array(yl, dtype=np.complex)
<add> xa = np.array(xl, dtype=complex)
<add> ya = np.array(yl, dtype=complex)
<ide> with np.errstate(divide='ignore'):
<ide> for i in range(len(xa)):
<ide> assert_almost_equal(np.log(xa[i].conj()), ya[i].conj())
<ide> def test_simple(self):
<ide> yield check_complex_value, np.sqrt, -1, 0, 0, 1
<ide>
<ide> def test_simple_conjugate(self):
<del> ref = np.conj(np.sqrt(np.complex(1, 1)))
<add> ref = np.conj(np.sqrt(complex(1, 1)))
<ide>
<ide> def f(z):
<ide> return np.sqrt(np.conj(z))
<ide> def test_special_values(self):
<ide> # csqrt(-inf + nani) is nan +- infi (both +i infi are valid)
<ide> def _check_ninf_nan(dummy):
<ide> msgform = "csqrt(-inf, nan) is (%f, %f), expected (nan, +-inf)"
<del> z = np.sqrt(np.array(np.complex(-np.inf, np.nan)))
<add> z = np.sqrt(np.array(complex(-np.inf, np.nan)))
<ide> #Fixme: ugly workaround for isinf bug.
<ide> with np.errstate(invalid='ignore'):
<ide> if not (np.isnan(z.real) and np.isinf(z.imag)):
<ide> def test_simple(self):
<ide>
<ide> def test_fabs(self):
<ide> # Test that np.abs(x +- 0j) == np.abs(x) (as mandated by C99 for cabs)
<del> x = np.array([1+0j], dtype=np.complex)
<add> x = np.array([1+0j], dtype=complex)
<ide> assert_array_equal(np.abs(x), np.real(x))
<ide>
<del> x = np.array([complex(1, np.NZERO)], dtype=np.complex)
<add> x = np.array([complex(1, np.NZERO)], dtype=complex)
<ide> assert_array_equal(np.abs(x), np.real(x))
<ide>
<del> x = np.array([complex(np.inf, np.NZERO)], dtype=np.complex)
<add> x = np.array([complex(np.inf, np.NZERO)], dtype=complex)
<ide> assert_array_equal(np.abs(x), np.real(x))
<ide>
<del> x = np.array([complex(np.nan, np.NZERO)], dtype=np.complex)
<add> x = np.array([complex(np.nan, np.NZERO)], dtype=complex)
<ide> assert_array_equal(np.abs(x), np.real(x))
<ide>
<ide> def test_cabs_inf_nan(self):
<ide> def f(a):
<ide> return np.abs(np.conj(a))
<ide>
<ide> def g(a, b):
<del> return np.abs(np.complex(a, b))
<add> return np.abs(complex(a, b))
<ide>
<del> xa = np.array(x, dtype=np.complex)
<add> xa = np.array(x, dtype=complex)
<ide> for i in range(len(xa)):
<ide> ref = g(x[i], y[i])
<ide> yield check_real_value, f, x[i], y[i], ref
<ide> def check_real_value(f, x1, y1, x, exact=True):
<ide>
<ide> def check_complex_value(f, x1, y1, x2, y2, exact=True):
<ide> z1 = np.array([complex(x1, y1)])
<del> z2 = np.complex(x2, y2)
<add> z2 = complex(x2, y2)
<ide> with np.errstate(invalid='ignore'):
<ide> if exact:
<ide> assert_equal(f(z1), z2)
<ide><path>numpy/doc/creation.py
<ide>
<ide> >>> np.arange(10)
<ide> array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])
<del> >>> np.arange(2, 10, dtype=np.float)
<add> >>> np.arange(2, 10, dtype=float)
<ide> array([ 2., 3., 4., 5., 6., 7., 8., 9.])
<ide> >>> np.arange(2, 3, 0.1)
<ide> array([ 2. , 2.1, 2.2, 2.3, 2.4, 2.5, 2.6, 2.7, 2.8, 2.9])
<ide><path>numpy/lib/arraysetops.py
<ide> def in1d(ar1, ar2, assume_unique=False, invert=False):
<ide> # This code is significantly faster when the condition is satisfied.
<ide> if len(ar2) < 10 * len(ar1) ** 0.145:
<ide> if invert:
<del> mask = np.ones(len(ar1), dtype=np.bool)
<add> mask = np.ones(len(ar1), dtype=bool)
<ide> for a in ar2:
<ide> mask &= (ar1 != a)
<ide> else:
<del> mask = np.zeros(len(ar1), dtype=np.bool)
<add> mask = np.zeros(len(ar1), dtype=bool)
<ide> for a in ar2:
<ide> mask |= (ar1 == a)
<ide> return mask
<ide><path>numpy/lib/function_base.py
<ide> def histogram(a, bins=10, range=None, normed=False, weights=None,
<ide> # At this point, if the weights are not integer, floating point, or
<ide> # complex, we have to use the slow algorithm.
<ide> if weights is not None and not (np.can_cast(weights.dtype, np.double) or
<del> np.can_cast(weights.dtype, np.complex)):
<add> np.can_cast(weights.dtype, complex)):
<ide> bins = linspace(mn, mx, bins + 1, endpoint=True)
<ide>
<ide> if not iterable(bins):
<ide> def gradient(f, *varargs, **kwargs):
<ide>
<ide> Examples
<ide> --------
<del> >>> f = np.array([1, 2, 4, 7, 11, 16], dtype=np.float)
<add> >>> f = np.array([1, 2, 4, 7, 11, 16], dtype=float)
<ide> >>> np.gradient(f)
<ide> array([ 1. , 1.5, 2.5, 3.5, 4.5, 5. ])
<ide> >>> np.gradient(f, 2)
<ide> def gradient(f, *varargs, **kwargs):
<ide>
<ide> Or a non uniform one:
<ide>
<del> >>> x = np.array([0., 1., 1.5, 3.5, 4., 6.], dtype=np.float)
<add> >>> x = np.array([0., 1., 1.5, 3.5, 4., 6.], dtype=float)
<ide> >>> np.gradient(f, x)
<ide> array([ 1. , 3. , 3.5, 6.7, 6.9, 2.5])
<ide>
<ide> For two dimensional arrays, the return will be two arrays ordered by
<ide> axis. In this example the first array stands for the gradient in
<ide> rows and the second one in columns direction:
<ide>
<del> >>> np.gradient(np.array([[1, 2, 6], [3, 4, 5]], dtype=np.float))
<add> >>> np.gradient(np.array([[1, 2, 6], [3, 4, 5]], dtype=float))
<ide> [array([[ 2., 2., -1.],
<ide> [ 2., 2., -1.]]), array([[ 1. , 2.5, 4. ],
<ide> [ 1. , 1. , 1. ]])]
<ide> def gradient(f, *varargs, **kwargs):
<ide>
<ide> >>> dx = 2.
<ide> >>> y = [1., 1.5, 3.5]
<del> >>> np.gradient(np.array([[1, 2, 6], [3, 4, 5]], dtype=np.float), dx, y)
<add> >>> np.gradient(np.array([[1, 2, 6], [3, 4, 5]], dtype=float), dx, y)
<ide> [array([[ 1. , 1. , -0.5],
<ide> [ 1. , 1. , -0.5]]), array([[ 2. , 2. , 2. ],
<ide> [ 2. , 1.7, 0.5]])]
<ide> def gradient(f, *varargs, **kwargs):
<ide> The `axis` keyword can be used to specify a subset of axes of which the
<ide> gradient is calculated
<ide>
<del> >>> np.gradient(np.array([[1, 2, 6], [3, 4, 5]], dtype=np.float), axis=0)
<add> >>> np.gradient(np.array([[1, 2, 6], [3, 4, 5]], dtype=float), axis=0)
<ide> array([[ 2., 2., -1.],
<ide> [ 2., 2., -1.]])
<ide>
<ide> class vectorize(object):
<ide> >>> out = vfunc([1, 2, 3, 4], 2)
<ide> >>> type(out[0])
<ide> <type 'numpy.int32'>
<del> >>> vfunc = np.vectorize(myfunc, otypes=[np.float])
<add> >>> vfunc = np.vectorize(myfunc, otypes=[float])
<ide> >>> out = vfunc([1, 2, 3, 4], 2)
<ide> >>> type(out[0])
<ide> <type 'numpy.float64'>
<ide> def cov(m, y=None, rowvar=True, bias=False, ddof=None, fweights=None,
<ide> # Get the product of frequencies and weights
<ide> w = None
<ide> if fweights is not None:
<del> fweights = np.asarray(fweights, dtype=np.float)
<add> fweights = np.asarray(fweights, dtype=float)
<ide> if not np.all(fweights == np.around(fweights)):
<ide> raise TypeError(
<ide> "fweights must be integer")
<ide> def cov(m, y=None, rowvar=True, bias=False, ddof=None, fweights=None,
<ide> "fweights cannot be negative")
<ide> w = fweights
<ide> if aweights is not None:
<del> aweights = np.asarray(aweights, dtype=np.float)
<add> aweights = np.asarray(aweights, dtype=float)
<ide> if aweights.ndim > 1:
<ide> raise RuntimeError(
<ide> "cannot handle multidimensional aweights")
<ide><path>numpy/lib/index_tricks.py
<ide> def diag_indices(n, ndim=2):
<ide>
<ide> And use it to set the diagonal of an array of zeros to 1:
<ide>
<del> >>> a = np.zeros((2, 2, 2), dtype=np.int)
<add> >>> a = np.zeros((2, 2, 2), dtype=int)
<ide> >>> a[d3] = 1
<ide> >>> a
<ide> array([[[1, 0],
<ide><path>numpy/lib/npyio.py
<ide> def floatconv(x):
<ide> return np.longdouble
<ide> elif issubclass(typ, np.floating):
<ide> return floatconv
<del> elif issubclass(typ, np.complex):
<add> elif issubclass(typ, complex):
<ide> return lambda x: complex(asstr(x))
<ide> elif issubclass(typ, np.bytes_):
<ide> return asbytes
<ide> def genfromtxt(fname, dtype=float, comments='#', delimiter=None,
<ide> # If the dtype is uniform, don't define names, else use ''
<ide> base = set([c.type for c in converters if c._checked])
<ide> if len(base) == 1:
<del> (ddtype, mdtype) = (list(base)[0], np.bool)
<add> (ddtype, mdtype) = (list(base)[0], bool)
<ide> else:
<ide> ddtype = [(defaultfmt % i, dt)
<ide> for (i, dt) in enumerate(column_types)]
<ide> if usemask:
<del> mdtype = [(defaultfmt % i, np.bool)
<add> mdtype = [(defaultfmt % i, bool)
<ide> for (i, dt) in enumerate(column_types)]
<ide> else:
<ide> ddtype = list(zip(names, column_types))
<del> mdtype = list(zip(names, [np.bool] * len(column_types)))
<add> mdtype = list(zip(names, [bool] * len(column_types)))
<ide> output = np.array(data, dtype=ddtype)
<ide> if usemask:
<ide> outputmask = np.array(masks, dtype=mdtype)
<ide> def genfromtxt(fname, dtype=float, comments='#', delimiter=None,
<ide> # Now, process the rowmasks the same way
<ide> if usemask:
<ide> rowmasks = np.array(
<del> masks, dtype=np.dtype([('', np.bool) for t in dtype_flat]))
<add> masks, dtype=np.dtype([('', bool) for t in dtype_flat]))
<ide> # Construct the new dtype
<ide> mdtype = make_mask_descr(dtype)
<ide> outputmask = rowmasks.view(mdtype)
<ide> def genfromtxt(fname, dtype=float, comments='#', delimiter=None,
<ide> output = np.array(data, dtype)
<ide> if usemask:
<ide> if dtype.names:
<del> mdtype = [(_, np.bool) for _ in dtype.names]
<add> mdtype = [(_, bool) for _ in dtype.names]
<ide> else:
<del> mdtype = np.bool
<add> mdtype = bool
<ide> outputmask = np.array(masks, dtype=mdtype)
<ide> # Try to take care of the missing data we missed
<ide> names = output.dtype.names
<ide><path>numpy/lib/tests/test__iotools.py
<ide> class TestMiscFunctions(object):
<ide>
<ide> def test_has_nested_dtype(self):
<ide> "Test has_nested_dtype"
<del> ndtype = np.dtype(np.float)
<add> ndtype = np.dtype(float)
<ide> assert_equal(has_nested_fields(ndtype), False)
<ide> ndtype = np.dtype([('A', '|S3'), ('B', float)])
<ide> assert_equal(has_nested_fields(ndtype), False)
<ide><path>numpy/lib/tests/test_function_base.py
<ide> def test_right_left_behavior(self):
<ide>
<ide> incres = interp(incpts, xp, yp)
<ide> decres = interp(decpts, xp, yp)
<del> inctgt = np.array([1, 1, 1, 1], dtype=np.float)
<add> inctgt = np.array([1, 1, 1, 1], dtype=float)
<ide> dectgt = inctgt[::-1]
<ide> assert_equal(incres, inctgt)
<ide> assert_equal(decres, dectgt)
<ide>
<ide> incres = interp(incpts, xp, yp, left=0)
<ide> decres = interp(decpts, xp, yp, left=0)
<del> inctgt = np.array([0, 1, 1, 1], dtype=np.float)
<add> inctgt = np.array([0, 1, 1, 1], dtype=float)
<ide> dectgt = inctgt[::-1]
<ide> assert_equal(incres, inctgt)
<ide> assert_equal(decres, dectgt)
<ide>
<ide> incres = interp(incpts, xp, yp, right=2)
<ide> decres = interp(decpts, xp, yp, right=2)
<del> inctgt = np.array([1, 1, 1, 2], dtype=np.float)
<add> inctgt = np.array([1, 1, 1, 2], dtype=float)
<ide> dectgt = inctgt[::-1]
<ide> assert_equal(incres, inctgt)
<ide> assert_equal(decres, dectgt)
<ide>
<ide> incres = interp(incpts, xp, yp, left=0, right=2)
<ide> decres = interp(decpts, xp, yp, left=0, right=2)
<del> inctgt = np.array([0, 1, 1, 2], dtype=np.float)
<add> inctgt = np.array([0, 1, 1, 2], dtype=float)
<ide> dectgt = inctgt[::-1]
<ide> assert_equal(incres, inctgt)
<ide> assert_equal(decres, dectgt)
<ide><path>numpy/lib/tests/test_io.py
<ide> def test_header_footer(self):
<ide> # Test the functionality of the header and footer keyword argument.
<ide>
<ide> c = BytesIO()
<del> a = np.array([(1, 2), (3, 4)], dtype=np.int)
<add> a = np.array([(1, 2), (3, 4)], dtype=int)
<ide> test_header_footer = 'Test header / footer'
<ide> # Test the header keyword argument
<ide> np.savetxt(c, a, fmt='%1d', header=test_header_footer)
<ide> def test_array(self):
<ide> c.write('1 2\n3 4')
<ide>
<ide> c.seek(0)
<del> x = np.loadtxt(c, dtype=np.int)
<add> x = np.loadtxt(c, dtype=int)
<ide> a = np.array([[1, 2], [3, 4]], int)
<ide> assert_array_equal(x, a)
<ide>
<ide> def test_dtype_with_object(self):
<ide> # Test using an explicit dtype with an object
<ide> data = """ 1; 2001-01-01
<ide> 2; 2002-01-31 """
<del> ndtype = [('idx', int), ('code', np.object)]
<add> ndtype = [('idx', int), ('code', object)]
<ide> func = lambda s: strptime(s.strip(), "%Y-%m-%d")
<ide> converters = {1: func}
<ide> test = np.loadtxt(TextIO(data), delimiter=";", dtype=ndtype,
<ide> def test_from_float_hex(self):
<ide> # IEEE doubles and floats only, otherwise the float32
<ide> # conversion may fail.
<ide> tgt = np.logspace(-10, 10, 5).astype(np.float32)
<del> tgt = np.hstack((tgt, -tgt)).astype(np.float)
<add> tgt = np.hstack((tgt, -tgt)).astype(float)
<ide> inp = '\n'.join(map(float.hex, tgt))
<ide> c = TextIO()
<ide> c.write(inp)
<del> for dt in [np.float, np.float32]:
<add> for dt in [float, np.float32]:
<ide> c.seek(0)
<ide> res = np.loadtxt(c, dtype=dt)
<ide> assert_equal(res, tgt, err_msg="%s" % dt)
<ide> def test_from_complex(self):
<ide> c = TextIO()
<ide> c.write("%s %s" % tgt)
<ide> c.seek(0)
<del> res = np.loadtxt(c, dtype=np.complex)
<add> res = np.loadtxt(c, dtype=complex)
<ide> assert_equal(res, tgt)
<ide>
<ide> def test_universal_newline(self):
<ide> def test_dtype_with_object(self):
<ide> # Test using an explicit dtype with an object
<ide> data = """ 1; 2001-01-01
<ide> 2; 2002-01-31 """
<del> ndtype = [('idx', int), ('code', np.object)]
<add> ndtype = [('idx', int), ('code', object)]
<ide> func = lambda s: strptime(s.strip(), "%Y-%m-%d")
<ide> converters = {1: func}
<ide> test = np.genfromtxt(TextIO(data), delimiter=";", dtype=ndtype,
<ide> def test_dtype_with_object(self):
<ide> dtype=ndtype)
<ide> assert_equal(test, control)
<ide>
<del> ndtype = [('nest', [('idx', int), ('code', np.object)])]
<add> ndtype = [('nest', [('idx', int), ('code', object)])]
<ide> try:
<ide> test = np.genfromtxt(TextIO(data), delimiter=";",
<ide> dtype=ndtype, converters=converters)
<ide> def test_withmissing(self):
<ide> test = np.mafromtxt(data, dtype=None, **kwargs)
<ide> control = ma.array([(0, 1), (2, -1)],
<ide> mask=[(False, False), (False, True)],
<del> dtype=[('A', np.int), ('B', np.int)])
<add> dtype=[('A', int), ('B', int)])
<ide> assert_equal(test, control)
<ide> assert_equal(test.mask, control.mask)
<ide> #
<ide> data.seek(0)
<ide> test = np.mafromtxt(data, **kwargs)
<ide> control = ma.array([(0, 1), (2, -1)],
<ide> mask=[(False, False), (False, True)],
<del> dtype=[('A', np.float), ('B', np.float)])
<add> dtype=[('A', float), ('B', float)])
<ide> assert_equal(test, control)
<ide> assert_equal(test.mask, control.mask)
<ide>
<ide> def test_withmissing_float(self):
<ide> missing_values='-999.0', names=True,)
<ide> control = ma.array([(0, 1.5), (2, -1.)],
<ide> mask=[(False, False), (False, True)],
<del> dtype=[('A', np.int), ('B', np.float)])
<add> dtype=[('A', int), ('B', float)])
<ide> assert_equal(test, control)
<ide> assert_equal(test.mask, control.mask)
<ide>
<ide> def test_recfromtxt(self):
<ide> kwargs = dict(delimiter=",", missing_values="N/A", names=True)
<ide> test = np.recfromtxt(data, **kwargs)
<ide> control = np.array([(0, 1), (2, 3)],
<del> dtype=[('A', np.int), ('B', np.int)])
<add> dtype=[('A', int), ('B', int)])
<ide> assert_(isinstance(test, np.recarray))
<ide> assert_equal(test, control)
<ide> #
<ide> data = TextIO('A,B\n0,1\n2,N/A')
<ide> test = np.recfromtxt(data, dtype=None, usemask=True, **kwargs)
<ide> control = ma.array([(0, 1), (2, -1)],
<ide> mask=[(False, False), (False, True)],
<del> dtype=[('A', np.int), ('B', np.int)])
<add> dtype=[('A', int), ('B', int)])
<ide> assert_equal(test, control)
<ide> assert_equal(test.mask, control.mask)
<ide> assert_equal(test.A, [0, 2])
<ide> def test_recfromcsv(self):
<ide> kwargs = dict(missing_values="N/A", names=True, case_sensitive=True)
<ide> test = np.recfromcsv(data, dtype=None, **kwargs)
<ide> control = np.array([(0, 1), (2, 3)],
<del> dtype=[('A', np.int), ('B', np.int)])
<add> dtype=[('A', int), ('B', int)])
<ide> assert_(isinstance(test, np.recarray))
<ide> assert_equal(test, control)
<ide> #
<ide> data = TextIO('A,B\n0,1\n2,N/A')
<ide> test = np.recfromcsv(data, dtype=None, usemask=True, **kwargs)
<ide> control = ma.array([(0, 1), (2, -1)],
<ide> mask=[(False, False), (False, True)],
<del> dtype=[('A', np.int), ('B', np.int)])
<add> dtype=[('A', int), ('B', int)])
<ide> assert_equal(test, control)
<ide> assert_equal(test.mask, control.mask)
<ide> assert_equal(test.A, [0, 2])
<ide> #
<ide> data = TextIO('A,B\n0,1\n2,3')
<ide> test = np.recfromcsv(data, missing_values='N/A',)
<ide> control = np.array([(0, 1), (2, 3)],
<del> dtype=[('a', np.int), ('b', np.int)])
<add> dtype=[('a', int), ('b', int)])
<ide> assert_(isinstance(test, np.recarray))
<ide> assert_equal(test, control)
<ide> #
<ide> data = TextIO('A,B\n0,1\n2,3')
<del> dtype = [('a', np.int), ('b', np.float)]
<add> dtype = [('a', int), ('b', float)]
<ide> test = np.recfromcsv(data, missing_values='N/A', dtype=dtype)
<ide> control = np.array([(0, 1), (2, 3)],
<ide> dtype=dtype)
<ide> def test_auto_dtype_largeint(self):
<ide>
<ide> assert_equal(test.dtype.names, ['f0', 'f1', 'f2'])
<ide>
<del> assert_(test.dtype['f0'] == np.float)
<add> assert_(test.dtype['f0'] == float)
<ide> assert_(test.dtype['f1'] == np.int64)
<ide> assert_(test.dtype['f2'] == np.integer)
<ide>
<ide> def test_recfromtxt(self):
<ide> kwargs = dict(delimiter=",", missing_values="N/A", names=True)
<ide> test = np.recfromtxt(path, **kwargs)
<ide> control = np.array([(0, 1), (2, 3)],
<del> dtype=[('A', np.int), ('B', np.int)])
<add> dtype=[('A', int), ('B', int)])
<ide> assert_(isinstance(test, np.recarray))
<ide> assert_equal(test, control)
<ide>
<ide> def test_recfromcsv(self):
<ide> kwargs = dict(missing_values="N/A", names=True, case_sensitive=True)
<ide> test = np.recfromcsv(path, dtype=None, **kwargs)
<ide> control = np.array([(0, 1), (2, 3)],
<del> dtype=[('A', np.int), ('B', np.int)])
<add> dtype=[('A', int), ('B', int)])
<ide> assert_(isinstance(test, np.recarray))
<ide> assert_equal(test, control)
<ide>
<ide><path>numpy/lib/tests/test_regression.py
<ide> def test_polyfit_build(self):
<ide> def test_polydiv_type(self):
<ide> # Make polydiv work for complex types
<ide> msg = "Wrong type, should be complex"
<del> x = np.ones(3, dtype=np.complex)
<add> x = np.ones(3, dtype=complex)
<ide> q, r = np.polydiv(x, x)
<del> assert_(q.dtype == np.complex, msg)
<add> assert_(q.dtype == complex, msg)
<ide> msg = "Wrong type, should be float"
<del> x = np.ones(3, dtype=np.int)
<add> x = np.ones(3, dtype=int)
<ide> q, r = np.polydiv(x, x)
<del> assert_(q.dtype == np.float, msg)
<add> assert_(q.dtype == float, msg)
<ide>
<ide> def test_histogramdd_too_many_bins(self):
<ide> # Ticket 928.
<ide> def test_histogramdd_too_many_bins(self):
<ide> def test_polyint_type(self):
<ide> # Ticket #944
<ide> msg = "Wrong type, should be complex"
<del> x = np.ones(3, dtype=np.complex)
<del> assert_(np.polyint(x).dtype == np.complex, msg)
<add> x = np.ones(3, dtype=complex)
<add> assert_(np.polyint(x).dtype == complex, msg)
<ide> msg = "Wrong type, should be float"
<del> x = np.ones(3, dtype=np.int)
<del> assert_(np.polyint(x).dtype == np.float, msg)
<add> x = np.ones(3, dtype=int)
<add> assert_(np.polyint(x).dtype == float, msg)
<ide>
<ide> def test_ndenumerate_crash(self):
<ide> # Ticket 1140
<ide> def test_loadtxt_fields_subarrays(self):
<ide>
<ide> def test_nansum_with_boolean(self):
<ide> # gh-2978
<del> a = np.zeros(2, dtype=np.bool)
<add> a = np.zeros(2, dtype=bool)
<ide> try:
<ide> np.nansum(a)
<ide> except Exception:
<ide><path>numpy/lib/tests/test_type_check.py
<ide> def test_integer(self):
<ide> vals = nan_to_num(1)
<ide> assert_all(vals == 1)
<ide> vals = nan_to_num([1])
<del> assert_array_equal(vals, np.array([1], np.int))
<add> assert_array_equal(vals, np.array([1], int))
<ide>
<ide> def test_complex_good(self):
<ide> vals = nan_to_num(1+1j)
<ide> class TestArrayConversion(object):
<ide> def test_asfarray(self):
<ide> a = asfarray(np.array([1, 2, 3]))
<ide> assert_equal(a.__class__, np.ndarray)
<del> assert_(np.issubdtype(a.dtype, np.float))
<add> assert_(np.issubdtype(a.dtype, float))
<ide>
<ide> if __name__ == "__main__":
<ide> run_module_suite()
<ide><path>numpy/lib/type_check.py
<ide> def real_if_close(a,tol=100):
<ide> -----
<ide> Machine epsilon varies from machine to machine and between data types
<ide> but Python floats on most platforms have a machine epsilon equal to
<del> 2.2204460492503131e-16. You can use 'np.finfo(np.float).eps' to print
<add> 2.2204460492503131e-16. You can use 'np.finfo(float).eps' to print
<ide> out the machine epsilon for floats.
<ide>
<ide> Examples
<ide> --------
<del> >>> np.finfo(np.float).eps
<add> >>> np.finfo(float).eps
<ide> 2.2204460492503131e-16
<ide>
<ide> >>> np.real_if_close([2.1 + 4e-14j], tol=1000)
<ide><path>numpy/linalg/tests/test_linalg.py
<ide> def test_dynamic_programming_logic(self):
<ide> [0, 0, 0, 3, 3, 3],
<ide> [0, 0, 0, 0, 4, 5],
<ide> [0, 0, 0, 0, 0, 5],
<del> [0, 0, 0, 0, 0, 0]], dtype=np.int)
<add> [0, 0, 0, 0, 0, 0]], dtype=int)
<ide> s_expected -= 1 # Cormen uses 1-based index, python does not.
<ide>
<ide> s, m = _multi_dot_matrix_chain_order(arrays, return_costs=True)
<ide><path>numpy/ma/core.py
<ide> def _replace_dtype_fields_recursive(dtype, primitive_dtype):
<ide> descr.append((name, _recurse(field[0], primitive_dtype)))
<ide> new_dtype = np.dtype(descr)
<ide>
<del> # Is this some kind of composite a la (np.float,2)
<add> # Is this some kind of composite a la (float,2)
<ide> elif dtype.subdtype:
<ide> descr = list(dtype.subdtype)
<ide> descr[0] = _recurse(dtype.subdtype[0], primitive_dtype)
<ide> def make_mask_descr(ndtype):
<ide> --------
<ide> >>> import numpy.ma as ma
<ide> >>> dtype = np.dtype({'names':['foo', 'bar'],
<del> 'formats':[np.float32, np.int]})
<add> 'formats':[np.float32, int]})
<ide> >>> dtype
<ide> dtype([('foo', '<f4'), ('bar', '<i4')])
<ide> >>> ma.make_mask_descr(dtype)
<ide> def is_mask(m):
<ide> Arrays with complex dtypes don't return True.
<ide>
<ide> >>> dtype = np.dtype({'names':['monty', 'pithon'],
<del> 'formats':[np.bool, np.bool]})
<add> 'formats':[bool, bool]})
<ide> >>> dtype
<ide> dtype([('monty', '|b1'), ('pithon', '|b1')])
<ide> >>> m = np.array([(True, False), (False, True), (True, False)],
<ide> def make_mask(m, copy=False, shrink=True, dtype=MaskType):
<ide> >>> arr
<ide> [(1, 0), (0, 1), (1, 0), (1, 0)]
<ide> >>> dtype = np.dtype({'names':['man', 'mouse'],
<del> 'formats':[np.int, np.int]})
<add> 'formats':[int, int]})
<ide> >>> arr = np.array(arr, dtype=dtype)
<ide> >>> arr
<ide> array([(1, 0), (0, 1), (1, 0), (1, 0)],
<ide> def make_mask_none(newshape, dtype=None):
<ide> Defining a more complex dtype.
<ide>
<ide> >>> dtype = np.dtype({'names':['foo', 'bar'],
<del> 'formats':[np.float32, np.int]})
<add> 'formats':[np.float32, int]})
<ide> >>> dtype
<ide> dtype([('foo', '<f4'), ('bar', '<i4')])
<ide> >>> ma.make_mask_none((3,), dtype=dtype)
<ide> def flatten_mask(mask):
<ide>
<ide> Examples
<ide> --------
<del> >>> mask = np.array([0, 0, 1], dtype=np.bool)
<add> >>> mask = np.array([0, 0, 1], dtype=bool)
<ide> >>> flatten_mask(mask)
<ide> array([False, False, True], dtype=bool)
<ide>
<ide> def masked_invalid(a, copy=True):
<ide> Examples
<ide> --------
<ide> >>> import numpy.ma as ma
<del> >>> a = np.arange(5, dtype=np.float)
<add> >>> a = np.arange(5, dtype=float)
<ide> >>> a[2] = np.NaN
<ide> >>> a[3] = np.PINF
<ide> >>> a
<ide> def mask_rowcols(a, axis=None):
<ide> Examples
<ide> --------
<ide> >>> import numpy.ma as ma
<del> >>> a = np.zeros((3, 3), dtype=np.int)
<add> >>> a = np.zeros((3, 3), dtype=int)
<ide> >>> a[1, 1] = 1
<ide> >>> a
<ide> array([[0, 0, 0],
<ide> def _convolve_or_correlate(f, a, v, mode, propagate_mask):
<ide> if propagate_mask:
<ide> # results which are contributed to by either item in any pair being invalid
<ide> mask = (
<del> f(getmaskarray(a), np.ones(np.shape(v), dtype=np.bool), mode=mode)
<del> | f(np.ones(np.shape(a), dtype=np.bool), getmaskarray(v), mode=mode)
<add> f(getmaskarray(a), np.ones(np.shape(v), dtype=bool), mode=mode)
<add> | f(np.ones(np.shape(a), dtype=bool), getmaskarray(v), mode=mode)
<ide> )
<ide> data = f(getdata(a), getdata(v), mode=mode)
<ide> else:
<ide><path>numpy/ma/extras.py
<ide> def mask_rows(a, axis=None):
<ide> Examples
<ide> --------
<ide> >>> import numpy.ma as ma
<del> >>> a = np.zeros((3, 3), dtype=np.int)
<add> >>> a = np.zeros((3, 3), dtype=int)
<ide> >>> a[1, 1] = 1
<ide> >>> a
<ide> array([[0, 0, 0],
<ide> def mask_cols(a, axis=None):
<ide> Examples
<ide> --------
<ide> >>> import numpy.ma as ma
<del> >>> a = np.zeros((3, 3), dtype=np.int)
<add> >>> a = np.zeros((3, 3), dtype=int)
<ide> >>> a[1, 1] = 1
<ide> >>> a
<ide> array([[0, 0, 0],
<ide><path>numpy/ma/mrecords.py
<ide> def __getattribute__(self, attr):
<ide> except IndexError:
<ide> # Couldn't find a mask: use the default (nomask)
<ide> pass
<del> hasmasked = _mask.view((np.bool, (len(_mask.dtype) or 1))).any()
<add> hasmasked = _mask.view((bool, (len(_mask.dtype) or 1))).any()
<ide> if (obj.shape or hasmasked):
<ide> obj = obj.view(MaskedArray)
<ide> obj._baseclass = ndarray
<ide><path>numpy/ma/tests/test_core.py
<ide> def test_flatten_structured_array(self):
<ide> ndtype = [('a', int), ('b', float)]
<ide> a = np.array([(1, 1), (2, 2)], dtype=ndtype)
<ide> test = flatten_structured_array(a)
<del> control = np.array([[1., 1.], [2., 2.]], dtype=np.float)
<add> control = np.array([[1., 1.], [2., 2.]], dtype=float)
<ide> assert_equal(test, control)
<ide> assert_equal(test.dtype, control.dtype)
<ide> # On masked_array
<ide> a = array([(1, 1), (2, 2)], mask=[(0, 1), (1, 0)], dtype=ndtype)
<ide> test = flatten_structured_array(a)
<ide> control = array([[1., 1.], [2., 2.]],
<del> mask=[[0, 1], [1, 0]], dtype=np.float)
<add> mask=[[0, 1], [1, 0]], dtype=float)
<ide> assert_equal(test, control)
<ide> assert_equal(test.dtype, control.dtype)
<ide> assert_equal(test.mask, control.mask)
<ide> def test_flatten_structured_array(self):
<ide> mask=[(0, (1, 0)), (1, (0, 1))], dtype=ndtype)
<ide> test = flatten_structured_array(a)
<ide> control = array([[1., 1., 1.1], [2., 2., 2.2]],
<del> mask=[[0, 1, 0], [1, 0, 1]], dtype=np.float)
<add> mask=[[0, 1, 0], [1, 0, 1]], dtype=float)
<ide> assert_equal(test, control)
<ide> assert_equal(test.dtype, control.dtype)
<ide> assert_equal(test.mask, control.mask)
<ide> # Keeping the initial shape
<ide> ndtype = [('a', int), ('b', float)]
<ide> a = np.array([[(1, 1), ], [(2, 2), ]], dtype=ndtype)
<ide> test = flatten_structured_array(a)
<del> control = np.array([[[1., 1.], ], [[2., 2.], ]], dtype=np.float)
<add> control = np.array([[[1., 1.], ], [[2., 2.], ]], dtype=float)
<ide> assert_equal(test, control)
<ide> assert_equal(test.dtype, control.dtype)
<ide>
<ide> def test_ptp(self):
<ide> (x, X, XX, m, mx, mX, mXX, m2x, m2X, m2XX) = self.d
<ide> (n, m) = X.shape
<ide> assert_equal(mx.ptp(), mx.compressed().ptp())
<del> rows = np.zeros(n, np.float)
<del> cols = np.zeros(m, np.float)
<add> rows = np.zeros(n, float)
<add> cols = np.zeros(m, float)
<ide> for k in range(m):
<ide> cols[k] = mX[:, k].compressed().ptp()
<ide> for k in range(n):
<ide> def test_add_object(self):
<ide>
<ide> def test_sum_object(self):
<ide> # Test sum on object dtype
<del> a = masked_array([1, 2, 3], mask=[1, 0, 0], dtype=np.object)
<add> a = masked_array([1, 2, 3], mask=[1, 0, 0], dtype=object)
<ide> assert_equal(a.sum(), 5)
<ide> a = masked_array([[1, 2, 3], [4, 5, 6]], dtype=object)
<ide> assert_equal(a.sum(axis=0), [5, 7, 9])
<ide>
<ide> def test_prod_object(self):
<ide> # Test prod on object dtype
<del> a = masked_array([1, 2, 3], mask=[1, 0, 0], dtype=np.object)
<add> a = masked_array([1, 2, 3], mask=[1, 0, 0], dtype=object)
<ide> assert_equal(a.prod(), 2 * 3)
<ide> a = masked_array([[1, 2, 3], [4, 5, 6]], dtype=object)
<ide> assert_equal(a.prod(axis=0), [4, 10, 18])
<ide>
<ide> def test_meananom_object(self):
<ide> # Test mean/anom on object dtype
<del> a = masked_array([1, 2, 3], dtype=np.object)
<add> a = masked_array([1, 2, 3], dtype=object)
<ide> assert_equal(a.mean(), 2)
<ide> assert_equal(a.anom(), [-1, 0, 1])
<ide>
<ide> def test_reshape(self):
<ide>
<ide> def test_make_mask_descr(self):
<ide> # Flexible
<del> ntype = [('a', np.float), ('b', np.float)]
<add> ntype = [('a', float), ('b', float)]
<ide> test = make_mask_descr(ntype)
<del> assert_equal(test, [('a', np.bool), ('b', np.bool)])
<add> assert_equal(test, [('a', bool), ('b', bool)])
<ide> assert_(test is make_mask_descr(test))
<ide>
<ide> # Standard w/ shape
<del> ntype = (np.float, 2)
<add> ntype = (float, 2)
<ide> test = make_mask_descr(ntype)
<del> assert_equal(test, (np.bool, 2))
<add> assert_equal(test, (bool, 2))
<ide> assert_(test is make_mask_descr(test))
<ide>
<ide> # Standard standard
<del> ntype = np.float
<add> ntype = float
<ide> test = make_mask_descr(ntype)
<del> assert_equal(test, np.dtype(np.bool))
<add> assert_equal(test, np.dtype(bool))
<ide> assert_(test is make_mask_descr(test))
<ide>
<ide> # Nested
<del> ntype = [('a', np.float), ('b', [('ba', np.float), ('bb', np.float)])]
<add> ntype = [('a', float), ('b', [('ba', float), ('bb', float)])]
<ide> test = make_mask_descr(ntype)
<ide> control = np.dtype([('a', 'b1'), ('b', [('ba', 'b1'), ('bb', 'b1')])])
<ide> assert_equal(test, control)
<ide> assert_(test is make_mask_descr(test))
<ide>
<ide> # Named+ shape
<del> ntype = [('a', (np.float, 2))]
<add> ntype = [('a', (float, 2))]
<ide> test = make_mask_descr(ntype)
<del> assert_equal(test, np.dtype([('a', (np.bool, 2))]))
<add> assert_equal(test, np.dtype([('a', (bool, 2))]))
<ide> assert_(test is make_mask_descr(test))
<ide>
<ide> # 2 names
<ide> def test_make_mask(self):
<ide> assert_equal(test.dtype, MaskType)
<ide> assert_equal(test, [0, 1])
<ide> # w/ a ndarray as an input
<del> mask = np.array([0, 1], dtype=np.bool)
<add> mask = np.array([0, 1], dtype=bool)
<ide> test = make_mask(mask)
<ide> assert_equal(test.dtype, MaskType)
<ide> assert_equal(test, [0, 1])
<ide> # w/ a flexible-type ndarray as an input - use default
<del> mdtype = [('a', np.bool), ('b', np.bool)]
<add> mdtype = [('a', bool), ('b', bool)]
<ide> mask = np.array([(0, 0), (0, 1)], dtype=mdtype)
<ide> test = make_mask(mask)
<ide> assert_equal(test.dtype, MaskType)
<ide> assert_equal(test, [1, 1])
<ide> # w/ a flexible-type ndarray as an input - use input dtype
<del> mdtype = [('a', np.bool), ('b', np.bool)]
<add> mdtype = [('a', bool), ('b', bool)]
<ide> mask = np.array([(0, 0), (0, 1)], dtype=mdtype)
<ide> test = make_mask(mask, dtype=mask.dtype)
<ide> assert_equal(test.dtype, mdtype)
<ide> assert_equal(test, mask)
<ide> # w/ a flexible-type ndarray as an input - use input dtype
<del> mdtype = [('a', np.float), ('b', np.float)]
<del> bdtype = [('a', np.bool), ('b', np.bool)]
<add> mdtype = [('a', float), ('b', float)]
<add> bdtype = [('a', bool), ('b', bool)]
<ide> mask = np.array([(0, 0), (0, 1)], dtype=mdtype)
<ide> test = make_mask(mask, dtype=mask.dtype)
<ide> assert_equal(test.dtype, bdtype)
<ide> def test_make_mask(self):
<ide> assert_equal(test2, test)
<ide> # test that nomask is returned when m is nomask.
<ide> bools = [True, False]
<del> dtypes = [MaskType, np.float]
<add> dtypes = [MaskType, float]
<ide> msgformat = 'copy=%s, shrink=%s, dtype=%s'
<ide> for cpy, shr, dt in itertools.product(bools, bools, dtypes):
<ide> res = make_mask(nomask, copy=cpy, shrink=shr, dtype=dt)
<ide> assert_(res is nomask, msgformat % (cpy, shr, dt))
<ide>
<ide> def test_mask_or(self):
<ide> # Initialize
<del> mtype = [('a', np.bool), ('b', np.bool)]
<add> mtype = [('a', bool), ('b', bool)]
<ide> mask = np.array([(0, 0), (0, 1), (1, 0), (0, 0)], dtype=mtype)
<ide> # Test using nomask as input
<ide> test = mask_or(mask, nomask)
<ide> def test_mask_or(self):
<ide> control = np.array([(0, 1), (0, 1), (1, 1), (0, 1)], dtype=mtype)
<ide> assert_equal(test, control)
<ide> # Using another array w / a different dtype
<del> othertype = [('A', np.bool), ('B', np.bool)]
<add> othertype = [('A', bool), ('B', bool)]
<ide> other = np.array([(0, 1), (0, 1), (0, 1), (0, 1)], dtype=othertype)
<ide> try:
<ide> test = mask_or(mask, other)
<ide> except ValueError:
<ide> pass
<ide> # Using nested arrays
<del> dtype = [('a', np.bool), ('b', [('ba', np.bool), ('bb', np.bool)])]
<add> dtype = [('a', bool), ('b', [('ba', bool), ('bb', bool)])]
<ide> amask = np.array([(0, (1, 0)), (0, (1, 0))], dtype=dtype)
<ide> bmask = np.array([(1, (0, 1)), (0, (0, 0))], dtype=dtype)
<ide> cntrl = np.array([(1, (1, 1)), (0, (1, 0))], dtype=dtype)
<ide> def test_mask_or(self):
<ide> def test_flatten_mask(self):
<ide> # Tests flatten mask
<ide> # Standard dtype
<del> mask = np.array([0, 0, 1], dtype=np.bool)
<add> mask = np.array([0, 0, 1], dtype=bool)
<ide> assert_equal(flatten_mask(mask), mask)
<ide> # Flexible dtype
<ide> mask = np.array([(0, 0), (0, 1)], dtype=[('a', bool), ('b', bool)])
<ide><path>numpy/ma/tests/test_extras.py
<ide> def test_basic(self):
<ide> test = apply_over_axes(np.sum, a, [0, 2])
<ide> ctrl = np.array([[[60], [92], [124]]])
<ide> assert_equal(test, ctrl)
<del> a[(a % 2).astype(np.bool)] = masked
<add> a[(a % 2).astype(bool)] = masked
<ide> test = apply_over_axes(np.sum, a, [0, 2])
<ide> ctrl = np.array([[[28], [44], [60]]])
<ide> assert_equal(test, ctrl)
<ide> def test_single_non_masked_value_on_axis(self):
<ide> def test_nan(self):
<ide> with suppress_warnings() as w:
<ide> w.record(RuntimeWarning)
<del> for mask in (False, np.zeros(6, dtype=np.bool)):
<add> for mask in (False, np.zeros(6, dtype=bool)):
<ide> dm = np.ma.array([[1, np.nan, 3], [1, 2, 3]])
<ide> dm.mask = mask
<ide>
<ide><path>numpy/ma/tests/test_mrecords.py
<ide> class TestView(object):
<ide>
<ide> def setup(self):
<ide> (a, b) = (np.arange(10), np.random.rand(10))
<del> ndtype = [('a', np.float), ('b', np.float)]
<add> ndtype = [('a', float), ('b', float)]
<ide> arr = np.array(list(zip(a, b)), dtype=ndtype)
<ide>
<ide> mrec = fromarrays([a, b], dtype=ndtype, fill_value=(-9., -99.))
<ide> def test_view_by_itself(self):
<ide>
<ide> def test_view_simple_dtype(self):
<ide> (mrec, a, b, arr) = self.data
<del> ntype = (np.float, 2)
<add> ntype = (float, 2)
<ide> test = mrec.view(ntype)
<ide> assert_(isinstance(test, ma.MaskedArray))
<del> assert_equal(test, np.array(list(zip(a, b)), dtype=np.float))
<add> assert_equal(test, np.array(list(zip(a, b)), dtype=float))
<ide> assert_(test[3, 1] is ma.masked)
<ide>
<ide> def test_view_flexible_type(self):
<ide> (mrec, a, b, arr) = self.data
<del> alttype = [('A', np.float), ('B', np.float)]
<add> alttype = [('A', float), ('B', float)]
<ide> test = mrec.view(alttype)
<ide> assert_(isinstance(test, MaskedRecords))
<ide> assert_equal_records(test, arr.view(alttype))
<ide> def test_record_array_with_object_field():
<ide> y = ma.masked_array(
<ide> [(1, '2'), (3, '4')],
<ide> mask=[(0, 0), (0, 1)],
<del> dtype=[('a', int), ('b', np.object)])
<add> dtype=[('a', int), ('b', object)])
<ide> # getting an item used to fail
<ide> y[1]
<ide>
<ide><path>numpy/random/tests/test_random.py
<ide> def test_size(self):
<ide> (2, 2, 2))
<ide>
<ide> assert_raises(TypeError, np.random.multinomial, 1, p,
<del> np.float(1))
<add> float(1))
<ide>
<ide>
<ide> class TestSetState(object):
<ide> class TestRandint(object):
<ide> np.int32, np.uint32, np.int64, np.uint64]
<ide>
<ide> def test_unsupported_type(self):
<del> assert_raises(TypeError, self.rfunc, 1, dtype=np.float)
<add> assert_raises(TypeError, self.rfunc, 1, dtype=float)
<ide>
<ide> def test_bounds_checking(self):
<ide> for dt in self.itype:
<ide> def test_in_bounds_fuzz(self):
<ide> def test_repeatability(self):
<ide> import hashlib
<ide> # We use a md5 hash of generated sequences of 1000 samples
<del> # in the range [0, 6) for all but np.bool, where the range
<add> # in the range [0, 6) for all but bool, where the range
<ide> # is [0, 2). Hashes are for little endian numbers.
<ide> tgt = {'bool': '7dd3170d7aa461d201a65f8bcf3944b0',
<ide> 'int16': '1b7741b80964bb190c50d541dca1cac1',
<ide> def test_repeatability(self):
<ide>
<ide> # bools do not depend on endianess
<ide> np.random.seed(1234)
<del> val = self.rfunc(0, 2, size=1000, dtype=np.bool).view(np.int8)
<add> val = self.rfunc(0, 2, size=1000, dtype=bool).view(np.int8)
<ide> res = hashlib.md5(val).hexdigest()
<del> assert_(tgt[np.dtype(np.bool).name] == res)
<add> assert_(tgt[np.dtype(bool).name] == res)
<ide>
<ide> def test_int64_uint64_corner_case(self):
<ide> # When stored in Numpy arrays, `lbnd` is casted
<ide> def test_respect_dtype_singleton(self):
<ide> sample = self.rfunc(lbnd, ubnd, dtype=dt)
<ide> assert_equal(sample.dtype, np.dtype(dt))
<ide>
<del> for dt in (np.bool, np.int, np.long):
<del> lbnd = 0 if dt is np.bool else np.iinfo(dt).min
<del> ubnd = 2 if dt is np.bool else np.iinfo(dt).max + 1
<add> for dt in (bool, int, np.long):
<add> lbnd = 0 if dt is bool else np.iinfo(dt).min
<add> ubnd = 2 if dt is bool else np.iinfo(dt).max + 1
<ide>
<ide> # gh-7284: Ensure that we get Python data types
<ide> sample = self.rfunc(lbnd, ubnd, dtype=dt)
<ide> def test_dirichlet_size(self):
<ide> assert_equal(np.random.dirichlet(p, (2, 2)).shape, (2, 2, 2))
<ide> assert_equal(np.random.dirichlet(p, np.array((2, 2))).shape, (2, 2, 2))
<ide>
<del> assert_raises(TypeError, np.random.dirichlet, p, np.float(1))
<add> assert_raises(TypeError, np.random.dirichlet, p, float(1))
<ide>
<ide> def test_exponential(self):
<ide> np.random.seed(self.seed)
<ide> def test_two_arg_funcs(self):
<ide>
<ide> # TODO: Uncomment once randint can broadcast arguments
<ide> # def test_randint(self):
<del># itype = [np.bool, np.int8, np.uint8, np.int16, np.uint16,
<add># itype = [bool, np.int8, np.uint8, np.int16, np.uint16,
<ide> # np.int32, np.uint32, np.int64, np.uint64]
<ide> # func = np.random.randint
<ide> # high = np.array([1])
<ide><path>numpy/testing/tests/test_utils.py
<ide> def test_array_diffshape(self):
<ide>
<ide> def test_objarray(self):
<ide> """Test object arrays."""
<del> a = np.array([1, 1], dtype=np.object)
<add> a = np.array([1, 1], dtype=object)
<ide> self._test_equal(a, 1)
<ide>
<ide> def test_array_likes(self):
<ide> def test_string_arrays(self):
<ide>
<ide> def test_recarrays(self):
<ide> """Test record arrays."""
<del> a = np.empty(2, [('floupi', np.float), ('floupa', np.float)])
<add> a = np.empty(2, [('floupi', float), ('floupa', float)])
<ide> a['floupi'] = [1, 2]
<ide> a['floupa'] = [1, 2]
<ide> b = a.copy()
<ide>
<ide> self._test_equal(a, b)
<ide>
<del> c = np.empty(2, [('floupipi', np.float), ('floupa', np.float)])
<add> c = np.empty(2, [('floupipi', float), ('floupa', float)])
<ide> c['floupipi'] = a['floupi'].copy()
<ide> c['floupa'] = a['floupa'].copy()
<ide>
<ide><path>numpy/tests/test_matlib.py
<ide> def test_zeros():
<ide> assert_array_equal(numpy.matlib.zeros(2), np.matrix([[ 0., 0.]]))
<ide>
<ide> def test_identity():
<del> x = numpy.matlib.identity(2, dtype=np.int)
<add> x = numpy.matlib.identity(2, dtype=int)
<ide> assert_array_equal(x, np.matrix([[1, 0], [0, 1]]))
<ide>
<ide> def test_eye(): | 42 |
PHP | PHP | report closure observers instead of breaking | 6baf6c0b15f4374a50bdc72b1911cdb2791a203a | <ide><path>src/Illuminate/Foundation/Console/ShowModelCommand.php
<ide> protected function getObservers($model)
<ide> $formatted = [];
<ide>
<ide> foreach($listeners as $key => $observerMethods) {
<del> $formatted[] = ['event' => $extractVerb($key), 'observer' => $observerMethods];
<add> $formatted[] = [
<add> 'event' => $extractVerb($key),
<add> 'observer' => array_map(fn ($obs) => is_string($obs) ? $obs : 'Closure', $observerMethods),
<add> ];
<ide> }
<ide>
<ide> return collect($formatted); | 1 |
Python | Python | convert activations, constraints, noise, embedding | 4e519f7aa701dc435ce42ac5f6bcacf19f8efa09 | <ide><path>keras/constraints.py
<ide> def __init__(self, m=2):
<ide> self.m = m
<ide>
<ide> def __call__(self, p):
<del> norms = K.sqrt(K.sum(K.sqr(p), axis=0))
<add> norms = K.sqrt(K.sum(K.square(p), axis=0))
<ide> desired = K.clip(norms, 0, self.m)
<ide> p = p * (desired / (1e-7 + norms))
<ide> return p
<ide><path>keras/layers/advanced_activations.py
<ide> from .. import initializations
<ide> from ..layers.core import Layer, MaskedLayer
<del>from ..utils.theano_utils import shared_zeros, shared_ones, sharedX
<del>import theano.tensor as T
<add>from .. import backend as K
<ide> import numpy as np
<ide>
<ide>
<ide> def __init__(self, alpha=0.3, **kwargs):
<ide>
<ide> def get_output(self, train):
<ide> X = self.get_input(train)
<del> return T.nnet.relu(X, self.alpha)
<add> return K.relu(X, alpha=self.alpha)
<ide>
<ide> def get_config(self):
<ide> config = {"name": self.__class__.__name__,
<ide> def get_config(self):
<ide> class PReLU(MaskedLayer):
<ide> '''
<ide> Reference:
<del> Delving Deep into Rectifiers: Surpassing Human-Level Performance on ImageNet Classification
<add> Delving Deep into Rectifiers: Surpassing Human-Level
<add> Performance on ImageNet Classification
<ide> http://arxiv.org/pdf/1502.01852v1.pdf
<ide> '''
<ide> def __init__(self, init='zero', weights=None, **kwargs):
<ide> def build(self):
<ide>
<ide> def get_output(self, train):
<ide> X = self.get_input(train)
<del> pos = T.nnet.relu(X)
<add> pos = K.relu(X)
<ide> neg = self.alphas * (X - abs(X)) * 0.5
<ide> return pos + neg
<ide>
<ide> class ParametricSoftplus(MaskedLayer):
<ide> Parametric Softplus of the form: alpha * log(1 + exp(beta * X))
<ide>
<ide> Reference:
<del> Inferring Nonlinear Neuronal Computation Based on Physiologically Plausible Inputs
<add> Inferring Nonlinear Neuronal Computation
<add> Based on Physiologically Plausible Inputs
<ide> http://journals.plos.org/ploscompbiol/article?id=10.1371/journal.pcbi.1003143
<ide> '''
<ide> def __init__(self, alpha_init=0.2, beta_init=5.0,
<ide> def __init__(self, alpha_init=0.2, beta_init=5.0,
<ide>
<ide> def build(self):
<ide> input_shape = self.input_shape[1:]
<del> self.alphas = sharedX(self.alpha_init * np.ones(input_shape))
<del> self.betas = sharedX(self.beta_init * np.ones(input_shape))
<add> self.alphas = K.variable(self.alpha_init * np.ones(input_shape))
<add> self.betas = K.variable(self.beta_init * np.ones(input_shape))
<ide> self.params = [self.alphas, self.betas]
<ide>
<ide> if self.initial_weights is not None:
<ide> def build(self):
<ide>
<ide> def get_output(self, train):
<ide> X = self.get_input(train)
<del> return T.nnet.softplus(self.betas * X) * self.alphas
<add> return K.softplus(self.betas * X) * self.alphas
<ide>
<ide> def get_config(self):
<ide> config = {"name": self.__class__.__name__,
<ide> def __init__(self, theta=1.0, **kwargs):
<ide>
<ide> def get_output(self, train):
<ide> X = self.get_input(train)
<del> return T.switch(abs(X) < self.theta, 0, X)
<add> return K.switch(K.abs(X) < self.theta, 0, X)
<ide>
<ide> def get_config(self):
<ide> config = {"name": self.__class__.__name__,
<ide> def __init__(self, theta=1.0, **kwargs):
<ide>
<ide> def get_output(self, train):
<ide> X = self.get_input(train)
<del> return T.switch(X > self.theta, X, 0)
<add> return K.switch(X > self.theta, X, 0)
<ide>
<ide> def get_config(self):
<ide> config = {"name": self.__class__.__name__,
<ide><path>keras/layers/embeddings.py
<ide> from __future__ import absolute_import
<del>import theano
<del>import theano.tensor as T
<add>from .. import backend as K
<ide>
<ide> from .. import activations, initializations, regularizers, constraints
<ide> from ..layers.core import Layer, MaskedLayer
<del>from ..utils.theano_utils import sharedX
<ide>
<ide> from ..constraints import unitnorm
<ide>
<ide> def __init__(self, input_dim, output_dim, init='uniform', input_length=None,
<ide> super(Embedding, self).__init__(**kwargs)
<ide>
<ide> def build(self):
<del> self.input = T.imatrix()
<add> self.input = K.placeholder(ndim=2, dtype='int32')
<ide> self.W = self.init((self.input_dim, self.output_dim))
<ide> self.params = [self.W]
<ide> self.regularizers = []
<ide> def get_output_mask(self, train=None):
<ide> if not self.mask_zero:
<ide> return None
<ide> else:
<del> return T.ones_like(X) * (1 - T.eq(X, 0))
<add> return K.ones_like(X) * (1 - K.equal(X, 0))
<ide>
<ide> @property
<ide> def output_shape(self):
<ide> return (self.input_shape[0], self.input_length, self.output_dim)
<ide>
<ide> def get_output(self, train=False):
<ide> X = self.get_input(train)
<del> out = self.W[X]
<add> out = K.embedding(self.W, X)
<ide> return out
<ide>
<ide> def get_config(self):
<ide> def get_config(self):
<ide> "W_constraint": self.W_constraint.get_config() if self.W_constraint else None}
<ide> base_config = super(Embedding, self).get_config()
<ide> return dict(list(base_config.items()) + list(config.items()))
<del>
<del>
<del>class WordContextProduct(Layer):
<del> '''
<del> This layer turns a pair of words (a pivot word + a context word,
<del> ie. a word from the same context, or a random, out-of-context word),
<del> identified by their index in a vocabulary, into two dense representations
<del> (word representation and context representation).
<del>
<del> Then it returns activation(dot(pivot_embedding, context_embedding)),
<del> which can be trained to encode the probability
<del> of finding the context word in the context of the pivot word
<del> (or reciprocally depending on your training procedure).
<del>
<del> The layer ingests integer tensors of shape:
<del> (nb_samples, 2)
<del> and outputs a float tensor of shape
<del> (nb_samples, 1)
<del>
<del> The 2nd dimension encodes (pivot, context).
<del> input_dim is the size of the vocabulary.
<del>
<del> For more context, see Mikolov et al.:
<del> Efficient Estimation of Word representations in Vector Space
<del> http://arxiv.org/pdf/1301.3781v3.pdf
<del> '''
<del> input_ndim = 2
<del>
<del> def __init__(self, input_dim, proj_dim=128,
<del> init='uniform', activation='sigmoid', weights=None, **kwargs):
<del>
<del> super(WordContextProduct, self).__init__(**kwargs)
<del> self.input_dim = input_dim
<del> self.proj_dim = proj_dim
<del> self.init = initializations.get(init)
<del> self.activation = activations.get(activation)
<del>
<del> self.input = T.imatrix()
<del> # two different embeddings for pivot word and its context
<del> # because p(w|c) != p(c|w)
<del> self.W_w = self.init((input_dim, proj_dim))
<del> self.W_c = self.init((input_dim, proj_dim))
<del>
<del> self.params = [self.W_w, self.W_c]
<del>
<del> if weights is not None:
<del> self.set_weights(weights)
<del>
<del> @property
<del> def output_shape(self):
<del> return (self.input_shape[0], 1)
<del>
<del> def get_output(self, train=False):
<del> X = self.get_input(train)
<del> w = self.W_w[X[:, 0]] # nb_samples, proj_dim
<del> c = self.W_c[X[:, 1]] # nb_samples, proj_dim
<del>
<del> dot = T.sum(w * c, axis=1)
<del> dot = theano.tensor.reshape(dot, (X.shape[0], 1))
<del> return self.activation(dot)
<del>
<del> def get_config(self):
<del> config = {"name": self.__class__.__name__,
<del> "input_dim": self.input_dim,
<del> "proj_dim": self.proj_dim,
<del> "init": self.init.__name__,
<del> "activation": self.activation.__name__}
<del> base_config = super(WordContextProduct, self).get_config()
<del> return dict(list(base_config.items()) + list(config.items()))
<ide><path>keras/layers/noise.py
<ide> from __future__ import absolute_import
<del>import numpy as np
<ide> from .core import MaskedLayer
<del>import theano
<del>import theano.tensor as T
<del>from theano.sandbox.rng_mrg import MRG_RandomStreams as RandomStreams
<add>from .. import backend as K
<ide>
<ide>
<ide> class GaussianNoise(MaskedLayer):
<ide> class GaussianNoise(MaskedLayer):
<ide> def __init__(self, sigma, **kwargs):
<ide> super(GaussianNoise, self).__init__(**kwargs)
<ide> self.sigma = sigma
<del> self.srng = RandomStreams(seed=np.random.randint(10e6))
<ide>
<ide> def get_output(self, train=False):
<ide> X = self.get_input(train)
<ide> if not train or self.sigma == 0:
<ide> return X
<ide> else:
<del> return X + self.srng.normal(size=X.shape, avg=0.0, std=self.sigma,
<del> dtype=theano.config.floatX)
<add> return X + K.random_normal(shape=K.shape(X),
<add> mean=0.,
<add> std=self.sigma)
<ide>
<ide> def get_config(self):
<ide> config = {"name": self.__class__.__name__,
<ide> class GaussianDropout(MaskedLayer):
<ide> def __init__(self, p, **kwargs):
<ide> super(GaussianDropout, self).__init__(**kwargs)
<ide> self.p = p
<del> self.srng = RandomStreams(seed=np.random.randint(10e6))
<ide>
<ide> def get_output(self, train):
<ide> X = self.get_input(train)
<ide> if train:
<del> # self.p refers to drop probability rather than retain probability (as in paper) to match Dropout layer syntax
<del> X *= self.srng.normal(size=X.shape, avg=1.0, std=T.sqrt(self.p / (1.0 - self.p)), dtype=theano.config.floatX)
<add> # self.p refers to drop probability rather than
<add> # retain probability (as in paper), for consistency
<add> X *= K.random_normal(shape=K.shape(X), mean=1.0,
<add> std=self.p / (1.0 - self.p))
<ide> return X
<ide>
<ide> def get_config(self): | 4 |
Javascript | Javascript | fix typo in variable names | 4e96334b5c2a18204cd82fa121e2290906277b39 | <ide><path>src/ngSanitize/sanitize.js
<ide> function htmlParser( html, handler ) {
<ide>
<ide> var attrs = {};
<ide>
<del> rest.replace(ATTR_REGEXP, function(match, name, doubleQuotedValue, singleQoutedValue, unqoutedValue) {
<add> rest.replace(ATTR_REGEXP, function(match, name, doubleQuotedValue, singleQuotedValue, unquotedValue) {
<ide> var value = doubleQuotedValue
<del> || singleQoutedValue
<del> || unqoutedValue
<add> || singleQuotedValue
<add> || unquotedValue
<ide> || '';
<ide>
<ide> attrs[name] = decodeEntities(value); | 1 |
Text | Text | update readme to test extension updating | d52527d3f276b09188136ce00275ff8f1dbc011d | <ide><path>README.md
<ide> a "PDF Reference" from Adobe:
<ide>
<ide> Recommended chapters to read: "2. Overview", "3.4 File Structure",
<ide> "4.1 Graphics Objects" that lists the PDF commands.
<del> | 1 |
PHP | PHP | fix failing tests | c7432af560e8d34456470feb02231f25fddc5c4d | <ide><path>lib/Cake/Test/TestCase/View/Helper/CacheHelperTest.php
<ide> public function testAfterRenderConditions() {
<ide> ->with('posts/index', 'content')
<ide> ->will($this->returnValue(''));
<ide>
<del> $event = $this->getMock('Cake\Event\Event');
<add> $event = $this->getMock('Cake\Event\Event', [], ['View.afterRenderFile']);
<ide> $Cache->afterRenderFile($event, 'posts/index', 'content');
<ide> }
<ide>
<ide> public function testAfterLayoutConditions() {
<ide> ->with('posts/index', $View->fetch('content'))
<ide> ->will($this->returnValue(''));
<ide>
<del> $event = $this->getMock('Cake\Event\Event');
<add> $event = $this->getMock('Cake\Event\Event', [], ['View.afterLayout']);
<ide> $Cache->afterLayout($event, 'posts/index');
<ide>
<ide> Configure::write('Cache.check', false); | 1 |
Ruby | Ruby | use databaseconfig objects in dbconsole | a843301a58ab9a3fbf947c1c8a4997b068eea8e5 | <ide><path>railties/lib/rails/commands/dbconsole/dbconsole_command.rb
<ide> def initialize(options = {})
<ide> def start
<ide> ENV["RAILS_ENV"] ||= @options[:environment] || environment
<ide>
<del> case config[:adapter]
<add> case db_config.adapter
<ide> when /^(jdbc)?mysql/
<ide> args = {
<ide> host: "--host",
<ide> def start
<ide> args << "-p"
<ide> end
<ide>
<del> args << config[:database]
<add> args << db_config.database
<ide>
<ide> find_cmd_and_exec(["mysql", "mysql5"], *args)
<ide>
<ide> def start
<ide> ENV["PGHOST"] = config[:host] if config[:host]
<ide> ENV["PGPORT"] = config[:port].to_s if config[:port]
<ide> ENV["PGPASSWORD"] = config[:password].to_s if config[:password] && @options[:include_password]
<del> find_cmd_and_exec("psql", config[:database])
<add> find_cmd_and_exec("psql", db_config.database)
<ide>
<ide> when "sqlite3"
<ide> args = []
<ide>
<ide> args << "-#{@options[:mode]}" if @options[:mode]
<ide> args << "-header" if @options[:header]
<del> args << File.expand_path(config[:database], Rails.respond_to?(:root) ? Rails.root : nil)
<add> args << File.expand_path(db_config.database, Rails.respond_to?(:root) ? Rails.root : nil)
<ide>
<ide> find_cmd_and_exec("sqlite3", *args)
<ide>
<ide> def start
<ide> if config[:username]
<ide> logon = config[:username].dup
<ide> logon << "/#{config[:password]}" if config[:password] && @options[:include_password]
<del> logon << "@#{config[:database]}" if config[:database]
<add> logon << "@#{db_config.database}" if db_config.database
<ide> end
<ide>
<ide> find_cmd_and_exec("sqlplus", logon)
<ide>
<ide> when "sqlserver"
<ide> args = []
<ide>
<del> args += ["-D", "#{config[:database]}"] if config[:database]
<add> args += ["-D", "#{db_config.database}"] if db_config.database
<ide> args += ["-U", "#{config[:username]}"] if config[:username]
<ide> args += ["-P", "#{config[:password]}"] if config[:password]
<ide>
<ide> def start
<ide> find_cmd_and_exec("sqsh", *args)
<ide>
<ide> else
<del> abort "Unknown command-line client for #{config[:database]}."
<add> abort "Unknown command-line client for #{db_config.database}."
<ide> end
<ide> end
<ide>
<ide> def config
<del> @config ||= begin
<del> # We need to check whether the user passed the database the
<del> # first time around to show a consistent error message to people
<del> # relying on 2-level database configuration.
<del> if @options[:database] && configurations[database].blank?
<del> raise ActiveRecord::AdapterNotSpecified, "'#{database}' database is not configured. Available configuration: #{configurations.inspect}"
<del> elsif configurations[environment].blank? && configurations[database].blank?
<del> raise ActiveRecord::AdapterNotSpecified, "'#{environment}' database is not configured. Available configuration: #{configurations.inspect}"
<del> else
<del> (configurations[database] || configurations[environment].presence).symbolize_keys
<del> end
<add> db_config.configuration_hash
<add> end
<add>
<add> def db_config
<add> return @db_config if @db_config
<add>
<add> # We need to check whether the user passed the database the
<add> # first time around to show a consistent error message to people
<add> # relying on 2-level database configuration.
<add>
<add> @db_config = configurations.configs_for(env_name: environment, spec_name: database)
<add>
<add> unless @db_config
<add> raise ActiveRecord::AdapterNotSpecified,
<add> "'#{database}' database is not configured for '#{environment}'. Available configuration: #{configurations.inspect}"
<ide> end
<add>
<add> @db_config
<ide> end
<ide>
<ide> def environment
<ide><path>railties/test/commands/dbconsole_test.rb
<ide> require "minitest/mock"
<ide> require "rails/command"
<ide> require "rails/commands/dbconsole/dbconsole_command"
<add>require "active_record/database_configurations"
<ide>
<ide> class Rails::DBConsoleTest < ActiveSupport::TestCase
<ide> def setup
<ide> def test_specifying_a_missing_database
<ide> Rails::Command.invoke(:dbconsole, ["--db", "i_do_not_exist"])
<ide> end
<ide>
<del> assert_includes e.message, "'i_do_not_exist' database is not configured."
<add> assert_includes e.message, "'i_do_not_exist' database is not configured for 'test'."
<ide> end
<ide> end
<ide>
<ide> def test_specifying_a_missing_environment
<ide> Rails::Command.invoke(:dbconsole)
<ide> end
<ide>
<del> assert_includes e.message, "'test' database is not configured."
<add> assert_includes e.message, "'primary' database is not configured for 'test'."
<ide> end
<ide> end
<ide>
<ide> def find_cmd_and_exec(*args)
<ide> attr_reader :dbconsole
<ide>
<ide> def start(config = {}, argv = [])
<add> hash_config = ActiveRecord::DatabaseConfigurations::HashConfig.new("test", "primary", config)
<add>
<ide> @dbconsole = make_dbconsole.new(parse_arguments(argv))
<del> @dbconsole.stub(:config, config) do
<add> @dbconsole.stub(:db_config, hash_config) do
<ide> capture_abort { @dbconsole.start }
<ide> end
<ide> end | 2 |
PHP | PHP | add ipad to the list of mobile clients | dbea15650bd67a1ecd0714156456fd010f4cd105 | <ide><path>lib/Cake/Network/CakeRequest.php
<ide> class CakeRequest implements ArrayAccess {
<ide> 'ajax' => array('env' => 'HTTP_X_REQUESTED_WITH', 'value' => 'XMLHttpRequest'),
<ide> 'flash' => array('env' => 'HTTP_USER_AGENT', 'pattern' => '/^(Shockwave|Adobe) Flash/'),
<ide> 'mobile' => array('env' => 'HTTP_USER_AGENT', 'options' => array(
<del> 'Android', 'AvantGo', 'BlackBerry', 'DoCoMo', 'Fennec', 'iPod', 'iPhone',
<add> 'Android', 'AvantGo', 'BlackBerry', 'DoCoMo', 'Fennec', 'iPod', 'iPhone', 'iPad',
<ide> 'J2ME', 'MIDP', 'NetFront', 'Nokia', 'Opera Mini', 'Opera Mobi', 'PalmOS', 'PalmSource',
<ide> 'portalmmm', 'Plucker', 'ReqwirelessWeb', 'SonyEricsson', 'Symbian', 'UP\\.Browser',
<ide> 'webOS', 'Windows CE', 'Windows Phone OS', 'Xiino' | 1 |
Javascript | Javascript | replace fixturesdir with fixtures.path | 9e551ef7391e964c63300f16a5eecf8ead70106c | <ide><path>test/parallel/test-regress-GH-1899.js
<ide> 'use strict';
<del>const common = require('../common');
<del>const path = require('path');
<add>require('../common');
<add>const fixtures = require('../common/fixtures');
<ide> const assert = require('assert');
<ide> const spawn = require('child_process').spawn;
<ide>
<ide> const child = spawn(process.argv[0], [
<del> path.join(common.fixturesDir, 'GH-1899-output.js')
<add> fixtures.path('GH-1899-output.js')
<ide> ]);
<ide> let output = '';
<ide> | 1 |
PHP | PHP | fix issue with vendor imports being erased | 68c81e280f04dba2ad87e2305ee976746aaa04a2 | <ide><path>lib/Cake/Console/Command/UpgradeShell.php
<ide> protected function _replaceUses($file) {
<ide> 1,
<ide> Shell::VERBOSE
<ide> );
<del> return;
<add> return $matches[0];
<ide> } else {
<ide> $use = 'Cake\\' . str_replace('/', '\\', $matches[2]) . '\\' . $matches[1];
<ide> } | 1 |
Ruby | Ruby | use a case insensitive uri regexp for #asset_path | 8fc3427646e932c3a1fb9f9794364866f030595e | <ide><path>actionpack/lib/action_view/helpers/asset_url_helper.rb
<ide> module Helpers
<ide> # )
<ide> #
<ide> module AssetUrlHelper
<del> URI_REGEXP = %r{^[-a-z]+://|^(?:cid|data):|^//}
<add> URI_REGEXP = %r{^[-a-z]+://|^(?:cid|data):|^//}i
<ide>
<ide> # Computes the path to asset in public directory. If :type
<ide> # options is set, a file extension will be appended and scoped
<ide><path>actionpack/test/template/asset_tag_helper_test.rb
<ide> def url_for(*args)
<ide> %(asset_path("style.min")) => %(/style.min),
<ide> %(asset_path("style.min.css")) => %(/style.min.css),
<ide>
<add> %(asset_path("http://www.outside.com/image.jpg")) => %(http://www.outside.com/image.jpg),
<add> %(asset_path("HTTP://www.outside.com/image.jpg")) => %(HTTP://www.outside.com/image.jpg),
<add>
<ide> %(asset_path("style", type: :stylesheet)) => %(/stylesheets/style.css),
<ide> %(asset_path("xmlhr", type: :javascript)) => %(/javascripts/xmlhr.js),
<ide> %(asset_path("xml.png", type: :image)) => %(/images/xml.png)
<ide> def test_image_alt
<ide> [nil, '/', '/foo/bar/', 'foo/bar/'].each do |prefix|
<ide> assert_equal 'Rails', image_alt("#{prefix}rails.png")
<ide> assert_equal 'Rails', image_alt("#{prefix}rails-9c0a079bdd7701d7e729bd956823d153.png")
<del> assert_equal 'Long file name with hyphens', image_alt("#{prefix}long-file-name-with-hyphens.png")
<del> assert_equal 'Long file name with underscores', image_alt("#{prefix}long_file_name_with_underscores.png")
<add> assert_equal 'Long file name with hyphens', image_alt("#{prefix}long-file-name-with-hyphens.png")
<add> assert_equal 'Long file name with underscores', image_alt("#{prefix}long_file_name_with_underscores.png")
<ide> end
<ide> end
<ide> | 2 |
Python | Python | fix the ci | ac99217e92c43066af7ec96554054d75532565d7 | <ide><path>tests/test_modeling_common.py
<ide> def _prepare_for_class(self, inputs_dict, model_class):
<ide> if model_class in MODEL_FOR_MULTIPLE_CHOICE_MAPPING.values():
<ide> return {
<ide> k: v.unsqueeze(1).expand(-1, self.model_tester.num_choices, -1).contiguous()
<add> if isinstance(v, torch.Tensor) and v.ndim != 0
<add> else v
<ide> for k, v in inputs_dict.items()
<ide> }
<ide> return inputs_dict
<ide> def test_attention_outputs(self):
<ide> model.to(torch_device)
<ide> model.eval()
<ide> with torch.no_grad():
<del> outputs = model(**inputs_dict)
<add> outputs = model(**self._prepare_for_class(inputs_dict, model_class))
<ide> attentions = outputs[-1]
<ide> self.assertEqual(model.config.output_hidden_states, False)
<ide> self.assertEqual(len(attentions), self.model_tester.num_hidden_layers) | 1 |
Text | Text | fix a small typo. | 827d2503860d28df1a415b8294723f04bfd5e46c | <ide><path>research/README.md
<ide> installation](https://www.tensorflow.org/install).
<ide> for visual navigation.
<ide> - [compression](compression): compressing and decompressing images using a
<ide> pre-trained Residual GRU network.
<del>- [deeplab](deeplab): deep labelling for semantic image segmentation.
<add>- [deeplab](deeplab): deep labeling for semantic image segmentation.
<ide> - [delf](delf): deep local features for image matching and retrieval.
<ide> - [differential_privacy](differential_privacy): differential privacy for training
<ide> data. | 1 |
Ruby | Ruby | update the filestore documentation for clear | b50bd49aa2d2d01ab05a58674557987386b13774 | <ide><path>activesupport/lib/active_support/cache/file_store.rb
<ide> def initialize(cache_path, options = nil)
<ide> extend Strategy::LocalCache
<ide> end
<ide>
<add> # Deletes all items from the cache. In this case it deletes all the entries in the specified
<add> # file store directory except for .gitkeep. Be careful which directory is specified in your
<add> # config file when using +FileStore+ because everything in that directory will be deleted.
<ide> def clear(options = nil)
<ide> root_dirs = Dir.entries(cache_path).reject {|f| (EXCLUDED_DIRS + [".gitkeep"]).include?(f)}
<ide> FileUtils.rm_r(root_dirs.collect{|f| File.join(cache_path, f)}) | 1 |
Text | Text | update examples at headers documentation | 790261682bb4b62c1504d79ecb14f38add2074c0 | <ide><path>docs/api-reference/next.config.js/headers.md
<ide> module.exports = {
<ide> },
<ide> ],
<ide> },
<del> ],
<add> ]
<ide> },
<ide> }
<ide> ```
<ide> module.exports = {
<ide> },
<ide> ],
<ide> },
<del> ],
<add> ]
<ide> },
<ide> }
<ide> ```
<ide> module.exports = {
<ide> },
<ide> ],
<ide> },
<del> ],
<add> ]
<ide> },
<ide> }
<ide> ```
<ide> module.exports = {
<ide> },
<ide> ],
<ide> },
<del> ],
<add> ]
<ide> },
<ide> }
<ide> ``` | 1 |
Python | Python | add tokenizer exception for "gonna" (fixes #691) | d8d50a0334740babf1891cae09dcfb19e27d324d | <ide><path>spacy/en/language_data.py
<ide> def get_time_exc(hours):
<ide> {ORTH: "ma"}
<ide> ],
<ide>
<add> "gonna": [
<add> {ORTH: "gon", LEMMA: "go"},
<add> {ORTH: "na", LEMMA: "to"}
<add> ],
<add>
<add> "Gonna": [
<add> {ORTH: "Gon", LEMMA: "go"},
<add> {ORTH: "na", LEMMA: "to"}
<add> ],
<add>
<ide> "whats": [
<ide> {ORTH: "what"},
<ide> {ORTH: "s"} | 1 |
Python | Python | move dependecies list to hubconf | c8bd026ef6a1eb6f431d158e76cbdd8d5938ac39 | <ide><path>hubconf.py
<add>dependencies = ['torch', 'tqdm', 'boto3', 'requests', 'regex', 'ftfy', 'spacy']
<add>
<ide> from hubconfs.bert_hubconf import (
<ide> bertTokenizer,
<ide> bertModel,
<ide><path>hubconfs/bert_hubconf.py
<ide> BertForTokenClassification,
<ide> )
<ide>
<del>dependencies = ['torch', 'tqdm', 'boto3', 'requests', 'regex']
<del>
<ide> # A lot of models share the same param doc. Use a decorator
<ide> # to save typing
<ide> bert_docstring = """
<ide><path>hubconfs/gpt_hubconf.py
<ide> OpenAIGPTDoubleHeadsModel
<ide> )
<ide>
<del>dependencies = ['torch', 'tqdm', 'boto3', 'requests', 'regex', 'ftfy', 'spacy']
<del>
<ide> # A lot of models share the same param doc. Use a decorator
<ide> # to save typing
<ide> gpt_docstring = """ | 3 |
Ruby | Ruby | fix formatting of `primary_key` [ci skip] | ee708cf402ac9ad8bba4ad4808c01266433883a5 | <ide><path>activerecord/lib/active_record/connection_adapters/postgresql/schema_definitions.rb
<ide> module ColumnMethods
<ide> # t.timestamps
<ide> # end
<ide> #
<del> # By default, this will use the +gen_random_uuid()+ function from the
<add> # By default, this will use the <tt>gen_random_uuid()</tt> function from the
<ide> # +pgcrypto+ extension. As that extension is only available in
<ide> # PostgreSQL 9.4+, for earlier versions an explicit default can be set
<del> # to use +uuid_generate_v4()+ from the +uuid-ossp+ extension instead:
<add> # to use <tt>uuid_generate_v4()</tt> from the +uuid-ossp+ extension instead:
<ide> #
<ide> # create_table :stuffs, id: false do |t|
<ide> # t.primary_key :id, :uuid, default: "uuid_generate_v4()" | 1 |
PHP | PHP | add path for the database that we tried to load | 246265839b40a595a56a491a23f9a88480a9f2eb | <ide><path>src/Illuminate/Database/Connectors/SQLiteConnector.php
<ide> public function connect(array $config)
<ide> // as the developer probably wants to know if the database exists and this
<ide> // SQLite driver will not throw any exception if it does not by default.
<ide> if ($path === false) {
<del> throw new InvalidArgumentException('Database does not exist.');
<add> throw new InvalidArgumentException("Database (${config['database']}) does not exist.");
<ide> }
<ide>
<ide> return $this->createConnection("sqlite:{$path}", $config, $options); | 1 |
Go | Go | remove checksum field from image.image struct | 3414307306dc1780f80c5ca5e9dd7a8822e27eec | <ide><path>graph/service.go
<ide> func (s *TagStore) CmdLookup(job *engine.Job) engine.Status {
<ide> out.Set("Os", image.OS)
<ide> out.SetInt64("Size", image.Size)
<ide> out.SetInt64("VirtualSize", image.GetParentsSize(0)+image.Size)
<del> out.Set("Checksum", image.Checksum)
<ide> if _, err = out.WriteTo(job.Stdout); err != nil {
<ide> return job.Error(err)
<ide> }
<ide><path>image/image.go
<ide> type Image struct {
<ide> Config *runconfig.Config `json:"config,omitempty"`
<ide> Architecture string `json:"architecture,omitempty"`
<ide> OS string `json:"os,omitempty"`
<del> Checksum string `json:"checksum"`
<ide> Size int64
<ide>
<ide> graph Graph | 2 |
Javascript | Javascript | fix minor typo | 5fea3471e80e22db0bb79b67956a0143d31dace1 | <ide><path>src/ng/sniffer.js
<ide> function $SnifferProvider() {
<ide> // http://code.google.com/p/android/issues/detail?id=17471
<ide> // https://github.com/angular/angular.js/issues/904
<ide>
<del> // older webit browser (533.9) on Boxee box has exactly the same problem as Android has
<add> // older webkit browser (533.9) on Boxee box has exactly the same problem as Android has
<ide> // so let's not use the history API also
<ide> // We are purposefully using `!(android < 4)` to cover the case when `android` is undefined
<ide> // jshint -W018 | 1 |
PHP | PHP | reset distinctvalues after each check | 6ea332b642f480faf3ea9931057506e2c7a5ba25 | <ide><path>src/Illuminate/Validation/Validator.php
<ide> public function after($callback)
<ide> public function passes()
<ide> {
<ide> $this->messages = new MessageBag;
<add> $this->distinctValues = [];
<ide>
<ide> // We'll spin through each rule, validating the attributes attached to that
<ide> // rule. Any error messages will be added to the containers with each of
<ide><path>tests/Validation/ValidationValidatorTest.php
<ide> public function testValidateDistinct()
<ide> $this->assertFalse($v->passes());
<ide> $this->assertCount(4, $v->messages());
<ide>
<del> $v = new Validator($trans, ['foo' => ['foo', 'bar'], 'bar' => ['foo', 'bar']], ['foo.*' => 'distinct', 'bar.*' => 'distinct']);
<add> $v->setData(['foo' => ['foo', 'bar'], 'bar' => ['foo', 'bar']]);
<ide> $this->assertTrue($v->passes());
<ide>
<ide> $v = new Validator($trans, ['foo' => ['foo', 'foo']], ['foo.*' => 'distinct'], ['foo.*.distinct' => 'There is a duplication!']); | 2 |
Text | Text | add experimental instructions to release readme | 3059ab3523d2462635afe4e53629b640b8ef9560 | <ide><path>scripts/release/README.md
<ide> The high level process of creating releases is [documented below](#process). Ind
<ide>
<ide> # Process
<ide>
<add>If this is your first time running the release scripts, go to the `scripts/release` directory and run `yarn` to install the dependencies.
<add>
<ide> ## Publishing a Canary
<ide>
<ide> Canaries are meant to be lightweight and published often. In most cases, canaries can be published using artifacts built by Circle CI.
<ide>
<ide> To prepare a canary for a particular commit:
<ide> 1. Choose a commit from [the commit log](https://github.com/facebook/react/commits/master).
<ide> 2. Click the "“✓" icon and click the Circle CI "Details" link.
<add>3. Select the `build` job (**not** the `build_experimental` job; see the next section). If it's still pending, you'll need to wait for it to finish. (Note: This is the most awkward part of cutting a release right now. We have plans to improve it.)
<ide> 4. Copy the build ID from the URL (e.g. the build ID for [circleci.com/gh/facebook/react/13471](https://circleci.com/gh/facebook/react/13471) is **13471**).
<ide> 5. Run the [`prepare-canary`](#prepare-canary) script with the build ID you found <sup>1</sup>:
<ide> ```sh
<ide> scripts/release/publish.js --tags canary
<ide>
<ide> <sup>1: You can omit the `build` param if you just want to release the latest commit as a canary.</sup>
<ide>
<add>## Publishing an Experimental Canary
<add>
<add>Experimental canaries are special releases with additional features turned on.
<add>
<add>The steps for publishing an experimental canary are almost the same as for publishing a normal canary, except in step 3 you should choose the `build_experimental` job instead of `build`. (I know this is awkward; we have plans to make it less so. Ideally these canaries would get published by a cron job.)
<add>
<add>When publishing an experimental canary, use the `experimental` tag:
<add>
<add>```sh
<add>scripts/release/publish.js --tags experimental
<add>```
<add>
<ide> ## Publishing a Stable Release
<ide>
<ide> Stable releases should always be created from a previously-released canary. This encourages better testing of the actual release artifacts and reduces the chance of unintended changes accidentally being included in a stable release. | 1 |
Text | Text | fix typo in readme.md | d838b6c5507cc7a02d08d212ed62b9db8c9c83bc | <ide><path>README.md
<del># [React Native](https://facebook.github.io/react-native/) · [](https://circleci.com/gh/facebook/react-native) [](https://ci.appveyor.com/project/facebok/react-native/branch/master) [](https://badge.fury.io/js/react-native) [](CONTRIBUTING.md#pull-requests)
<add># [React Native](https://facebook.github.io/react-native/) · [](https://circleci.com/gh/facebook/react-native) [](https://ci.appveyor.com/project/facebook/react-native/branch/master) [](https://badge.fury.io/js/react-native) [](CONTRIBUTING.md#pull-requests)
<ide>
<ide> Learn once, write anywhere: Build mobile apps with React.
<ide> | 1 |
Javascript | Javascript | add a newline at the end of component.json | 34ba8b6cb110f6869db89bc27f31065387895074 | <ide><path>tasks/component.js
<ide> module.exports = function (grunt) {
<ide> config.files = grunt.file.expand('locale/*.js');
<ide> config.files.unshift('moment.js');
<ide>
<del> grunt.file.write('component.json', JSON.stringify(config, true, 2));
<add> grunt.file.write('component.json', JSON.stringify(config, true, 2) + '\n');
<ide> });
<ide> } | 1 |
Javascript | Javascript | change var to let in string_decoder | f61882bce450fa4c1c626eb621eedb2596732440 | <ide><path>lib/string_decoder.js
<ide> function normalizeEncoding(enc) {
<ide> }
<ide>
<ide> const encodingsMap = {};
<del>for (var i = 0; i < encodings.length; ++i)
<add>for (let i = 0; i < encodings.length; ++i)
<ide> encodingsMap[encodings[i]] = i;
<ide>
<ide> // StringDecoder provides an interface for efficiently splitting a series of | 1 |
Javascript | Javascript | create `reactnativecomponent` abstract class | 3f75ea8cdc537e189eb43158128a5a0295103211 | <ide><path>src/renderers/native/ReactNativeComponent.js
<add>/**
<add> * Copyright (c) 2013-present, Facebook, Inc.
<add> * All rights reserved.
<add> *
<add> * This source code is licensed under the BSD-style license found in the
<add> * LICENSE file in the root directory of this source tree. An additional grant
<add> * of patent rights can be found in the PATENTS file in the same directory.
<add> *
<add> * @providesModule ReactNativeComponent
<add> * @flow
<add> * @format
<add> */
<add>
<add>'use strict';
<add>
<add>const React = require('react');
<add>const ReactNativeAttributePayload = require('ReactNativeAttributePayload');
<add>const ReactNativeFeatureFlags = require('ReactNativeFeatureFlags');
<add>const TextInputState = require('TextInputState');
<add>const UIManager = require('UIManager');
<add>
<add>const findNodeHandle = require('findNodeHandle');
<add>
<add>const {mountSafeCallback} = require('NativeMethodsMixinUtils');
<add>
<add>import type {
<add> MeasureInWindowOnSuccessCallback,
<add> MeasureLayoutOnSuccessCallback,
<add> MeasureOnSuccessCallback,
<add> NativeMethodsMixinType,
<add>} from 'ReactNativeTypes';
<add>import type {
<add> ReactNativeBaseComponentViewConfig,
<add>} from 'ReactNativeViewConfigRegistry';
<add>
<add>const findNumericNodeHandle = ReactNativeFeatureFlags.useFiber
<add> ? require('findNumericNodeHandleFiber')
<add> : require('findNumericNodeHandleStack');
<add>
<add>/**
<add> * Superclass that provides methods to access the underlying native component.
<add> * This can be useful when you want to focus a view or measure its dimensions.
<add> *
<add> * Methods implemented by this class are available on most default components
<add> * provided by React Native. However, they are *not* available on composite
<add> * components that are not directly backed by a native view. For more
<add> * information, see [Direct Manipulation](docs/direct-manipulation.html).
<add> *
<add> * @abstract
<add> */
<add>class ReactNativeComponent<DefaultProps, Props, State>
<add> extends React.Component<DefaultProps, Props, State> {
<add> static defaultProps: $Abstract<DefaultProps>;
<add> props: Props;
<add> state: $Abstract<State>;
<add>
<add> /**
<add> * Removes focus. This is the opposite of `focus()`.
<add> */
<add> blur(): void {
<add> TextInputState.blurTextInput(findNumericNodeHandle(this));
<add> }
<add>
<add> /**
<add> * Requests focus. The exact behavior depends on the platform and view.
<add> */
<add> focus(): void {
<add> TextInputState.focusTextInput(findNumericNodeHandle(this));
<add> }
<add>
<add> /**
<add> * Measures the on-screen location and dimensions. If successful, the callback
<add> * will be called asynchronously with the following arguments:
<add> *
<add> * - x
<add> * - y
<add> * - width
<add> * - height
<add> * - pageX
<add> * - pageY
<add> *
<add> * These values are not available until after natives rendering completes. If
<add> * you need the measurements as soon as possible, consider using the
<add> * [`onLayout` prop](docs/view.html#onlayout) instead.
<add> */
<add> measure(callback: MeasureOnSuccessCallback): void {
<add> UIManager.measure(
<add> findNumericNodeHandle(this),
<add> mountSafeCallback(this, callback),
<add> );
<add> }
<add>
<add> /**
<add> * Measures the on-screen location and dimensions. Even if the React Native
<add> * root view is embedded within another native view, this method will give you
<add> * the absolute coordinates measured from the window. If successful, the
<add> * callback will be called asynchronously with the following arguments:
<add> *
<add> * - x
<add> * - y
<add> * - width
<add> * - height
<add> *
<add> * These values are not available until after natives rendering completes.
<add> */
<add> measureInWindow(callback: MeasureInWindowOnSuccessCallback): void {
<add> UIManager.measureInWindow(
<add> findNumericNodeHandle(this),
<add> mountSafeCallback(this, callback),
<add> );
<add> }
<add>
<add> /**
<add> * Similar to [`measure()`](#measure), but the resulting location will be
<add> * relative to the supplied ancestor's location.
<add> *
<add> * Obtain a native node handle with `ReactNative.findNodeHandle(component)`.
<add> */
<add> measureLayout(
<add> relativeToNativeNode: number,
<add> onSuccess: MeasureLayoutOnSuccessCallback,
<add> onFail: () => void /* currently unused */,
<add> ): void {
<add> UIManager.measureLayout(
<add> findNumericNodeHandle(this),
<add> relativeToNativeNode,
<add> mountSafeCallback(this, onFail),
<add> mountSafeCallback(this, onSuccess),
<add> );
<add> }
<add>
<add> /**
<add> * This function sends props straight to native. They will not participate in
<add> * future diff process - this means that if you do not include them in the
<add> * next render, they will remain active (see [Direct
<add> * Manipulation](docs/direct-manipulation.html)).
<add> */
<add> setNativeProps(nativeProps: Object): void {
<add> injectedSetNativeProps(this, nativeProps);
<add> }
<add>}
<add>
<add>// eslint-disable-next-line no-unused-expressions
<add>(ReactNativeComponent.prototype: NativeMethodsMixinType);
<add>
<add>// TODO (bvaughn) Inline this once ReactNativeStack is dropped.
<add>function setNativePropsFiber(componentOrHandle: any, nativeProps: Object) {
<add> // Class components don't have viewConfig -> validateAttributes.
<add> // Nor does it make sense to set native props on a non-native component.
<add> // Instead, find the nearest host component and set props on it.
<add> // Use findNodeHandle() rather than ReactNative.findNodeHandle() because
<add> // We want the instance/wrapper (not the native tag).
<add> let maybeInstance;
<add>
<add> // Fiber errors if findNodeHandle is called for an umounted component.
<add> // Tests using ReactTestRenderer will trigger this case indirectly.
<add> // Mimicking stack behavior, we should silently ignore this case.
<add> // TODO Fix ReactTestRenderer so we can remove this try/catch.
<add> try {
<add> maybeInstance = findNodeHandle(componentOrHandle);
<add> } catch (error) {}
<add>
<add> // If there is no host component beneath this we should fail silently.
<add> // This is not an error; it could mean a class component rendered null.
<add> if (maybeInstance == null) {
<add> return;
<add> }
<add>
<add> const viewConfig: ReactNativeBaseComponentViewConfig =
<add> maybeInstance.viewConfig;
<add>
<add> var updatePayload = ReactNativeAttributePayload.create(
<add> nativeProps,
<add> viewConfig.validAttributes,
<add> );
<add>
<add> UIManager.updateView(
<add> maybeInstance._nativeTag,
<add> viewConfig.uiViewClassName,
<add> updatePayload,
<add> );
<add>}
<add>
<add>// TODO (bvaughn) Remove this once ReactNativeStack is dropped.
<add>function setNativePropsStack(componentOrHandle: any, nativeProps: Object) {
<add> // Class components don't have viewConfig -> validateAttributes.
<add> // Nor does it make sense to set native props on a non-native component.
<add> // Instead, find the nearest host component and set props on it.
<add> // Use findNodeHandle() rather than ReactNative.findNodeHandle() because
<add> // We want the instance/wrapper (not the native tag).
<add> let maybeInstance = findNodeHandle(componentOrHandle);
<add>
<add> // If there is no host component beneath this we should fail silently.
<add> // This is not an error; it could mean a class component rendered null.
<add> if (maybeInstance == null) {
<add> return;
<add> }
<add>
<add> let viewConfig: ReactNativeBaseComponentViewConfig;
<add> if (maybeInstance.viewConfig !== undefined) {
<add> // ReactNativeBaseComponent
<add> viewConfig = maybeInstance.viewConfig;
<add> } else if (
<add> maybeInstance._instance !== undefined &&
<add> maybeInstance._instance.viewConfig !== undefined
<add> ) {
<add> // ReactCompositeComponentWrapper
<add> // Some instances (eg Text) define their own viewConfig
<add> viewConfig = maybeInstance._instance.viewConfig;
<add> } else {
<add> // ReactCompositeComponentWrapper
<add> // Other instances (eg TextInput) defer to their children's viewConfig
<add> while (maybeInstance._renderedComponent !== undefined) {
<add> maybeInstance = maybeInstance._renderedComponent;
<add> }
<add> viewConfig = maybeInstance.viewConfig;
<add> }
<add>
<add> const tag: number = typeof maybeInstance.getHostNode === 'function'
<add> ? maybeInstance.getHostNode()
<add> : maybeInstance._rootNodeID;
<add>
<add> var updatePayload = ReactNativeAttributePayload.create(
<add> nativeProps,
<add> viewConfig.validAttributes,
<add> );
<add>
<add> UIManager.updateView(tag, viewConfig.uiViewClassName, updatePayload);
<add>}
<add>
<add>// Switching based on fiber vs stack to avoid a lot of inline checks at runtime.
<add>// HACK Normally this injection would be done by the renderer, but in this case
<add>// that would result in a cycle between ReactNative and NativeMethodsMixin.
<add>// We avoid requiring additional code for this injection so it's probably ok?
<add>// TODO (bvaughn) Remove this once ReactNativeStack is gone.
<add>let injectedSetNativeProps: (
<add> componentOrHandle: any,
<add> nativeProps: Object,
<add>) => void;
<add>if (ReactNativeFeatureFlags.useFiber) {
<add> injectedSetNativeProps = setNativePropsFiber;
<add>} else {
<add> injectedSetNativeProps = setNativePropsStack;
<add>}
<add>
<add>module.exports = ReactNativeComponent;
<ide><path>src/renderers/native/ReactNativeFiber.js
<ide> ReactFiberErrorLogger.injection.injectDialog(
<ide> ReactNativeFiberErrorDialog.showDialog,
<ide> );
<ide>
<del>var ReactNative: ReactNativeType = {
<add>const ReactNative: ReactNativeType = {
<add> NativeComponent: require('ReactNativeComponent'),
<add>
<ide> findNodeHandle: findNumericNodeHandle,
<ide>
<ide> render(element: Element<any>, containerTag: any, callback: ?Function) {
<ide><path>src/renderers/native/ReactNativeStack.js
<ide> var render = function(
<ide> };
<ide>
<ide> var ReactNative: ReactNativeType = {
<add> NativeComponent: require('ReactNativeComponent'),
<add>
<ide> hasReactNativeInitialized: false,
<ide>
<ide> findNodeHandle: findNumericNodeHandle,
<ide><path>src/renderers/native/ReactNativeTypes.js
<ide> type SecretInternalsType = {
<ide> };
<ide>
<ide> /**
<del> * Flat ReactNative renderer bundles are too big for Flow to parse effeciently.
<del> * Provide minimal Flow typing for the high-level RN API and call it a day.
<del> */
<add> * Flat ReactNative renderer bundles are too big for Flow to parse efficiently.
<add> * Provide minimal Flow typing for the high-level RN API and call it a day.
<add> */
<ide> export type ReactNativeType = {
<add> NativeComponent: any,
<ide> findNodeHandle(componentOrHandle: any): ?number,
<ide> render(
<ide> element: React.Element<any>, | 4 |
Go | Go | remove unused helpers | a0c9089971b6c3cdc9ac1233f3c5e27a0a723214 | <ide><path>pkg/testutil/helpers.go
<ide> package testutil
<ide>
<ide> import (
<del> "strings"
<del> "unicode"
<del>
<ide> "github.com/stretchr/testify/assert"
<ide> "github.com/stretchr/testify/require"
<ide> )
<ide> func ErrorContains(t require.TestingT, err error, expectedError string) {
<ide> require.Error(t, err)
<ide> assert.Contains(t, err.Error(), expectedError)
<ide> }
<del>
<del>// EqualNormalizedString compare the actual value to the expected value after applying the specified
<del>// transform function. It fails the test if these two transformed string are not equal.
<del>// For example `EqualNormalizedString(t, RemoveSpace, "foo\n", "foo")` wouldn't fail the test as
<del>// spaces (and thus '\n') are removed before comparing the string.
<del>func EqualNormalizedString(t require.TestingT, transformFun func(rune) rune, actual, expected string) {
<del> require.Equal(t, strings.Map(transformFun, expected), strings.Map(transformFun, actual))
<del>}
<del>
<del>// RemoveSpace returns -1 if the specified runes is considered as a space (unicode)
<del>// and the rune itself otherwise.
<del>func RemoveSpace(r rune) rune {
<del> if unicode.IsSpace(r) {
<del> return -1
<del> }
<del> return r
<del>} | 1 |
Java | Java | improve error handling in webutils.isvalidorigin() | 40cbede7f36e4551189b2b0d60cc70aacec5f347 | <ide><path>spring-web/src/main/java/org/springframework/web/util/WebUtils.java
<ide> import javax.servlet.http.HttpServletResponse;
<ide> import javax.servlet.http.HttpSession;
<ide>
<add>import org.apache.commons.logging.Log;
<add>import org.apache.commons.logging.LogFactory;
<add>
<ide> import org.springframework.http.HttpRequest;
<ide> import org.springframework.util.Assert;
<ide> import org.springframework.util.LinkedMultiValueMap;
<ide> public abstract class WebUtils {
<ide> /** Key for the mutex session attribute */
<ide> public static final String SESSION_MUTEX_ATTRIBUTE = WebUtils.class.getName() + ".MUTEX";
<ide>
<add> private static final Log logger = LogFactory.getLog(WebUtils.class);
<add>
<ide>
<ide> /**
<ide> * Set a system property to the web application root directory.
<ide> public static boolean isValidOrigin(HttpRequest request, Collection<String> allo
<ide> return true;
<ide> }
<ide> else if (allowedOrigins.isEmpty()) {
<del> UriComponents originComponents = UriComponentsBuilder.fromHttpUrl(origin).build();
<add> UriComponents originComponents;
<add> try {
<add> originComponents = UriComponentsBuilder.fromHttpUrl(origin).build();
<add> }
<add> catch (IllegalArgumentException ex) {
<add> logger.error("Failed to parse Origin header value [" + origin + "]");
<add> return false;
<add> }
<ide> UriComponents requestComponents = UriComponentsBuilder.fromHttpRequest(request).build();
<ide> int originPort = getPort(originComponents);
<ide> int requestPort = getPort(requestComponents);
<ide><path>spring-web/src/test/java/org/springframework/web/util/WebUtilsTests.java
<ide> public void isValidOrigin() {
<ide> request.getHeaders().set(HttpHeaders.ORIGIN, "https://mydomain1.com");
<ide> assertFalse(WebUtils.isValidOrigin(request, allowedOrigins));
<ide>
<add> servletRequest.setServerName("invalid-origin");
<add> request.getHeaders().set(HttpHeaders.ORIGIN, "invalid-origin");
<add> assertFalse(WebUtils.isValidOrigin(request, allowedOrigins));
<add>
<ide> allowedOrigins = Arrays.asList("*");
<ide> servletRequest.setServerName("mydomain1.com");
<ide> request.getHeaders().set(HttpHeaders.ORIGIN, "http://mydomain2.com"); | 2 |
Text | Text | move dnlup to emeriti | 84000f18bafa7904275a2f8180e939a552813412 | <ide><path>README.md
<ide> For information about the governance of the Node.js project, see
<ide> **Gus Caplan** <<me@gus.host>> (they/them)
<ide> * [dmabupt](https://github.com/dmabupt) -
<ide> **Xu Meng** <<dmabupt@gmail.com>> (he/him)
<del>* [dnlup](https://github.com/dnlup)
<del> **Daniele Belardi** <<dwon.dnl@gmail.com>> (he/him)
<ide> * [edsadr](https://github.com/edsadr) -
<ide> **Adrian Estrada** <<edsadr@gmail.com>> (he/him)
<ide> * [erickwendel](https://github.com/erickwendel) -
<ide> For information about the governance of the Node.js project, see
<ide> **Jamie Davis** <<davisjam@vt.edu>> (he/him)
<ide> * [digitalinfinity](https://github.com/digitalinfinity) -
<ide> **Hitesh Kanwathirtha** <<digitalinfinity@gmail.com>> (he/him)
<add>* [dnlup](https://github.com/dnlup)
<add> **dnlup** <<dnlup.dev@gmail.com>>
<ide> * [eljefedelrodeodeljefe](https://github.com/eljefedelrodeodeljefe) -
<ide> **Robert Jefe Lindstaedt** <<robert.lindstaedt@gmail.com>>
<ide> * [estliberitas](https://github.com/estliberitas) - | 1 |
Python | Python | add function for websocket uri creation | c60300a15d7f7fdf718452469c94a165f82046be | <ide><path>libcloud/container/drivers/lxd.py
<ide> def __init__(self, key='', secret='', secure=False,
<ide> self.connection.port = port
<ide> self.version = self._get_api_version()
<ide>
<add> def build_operation_websocket_url(self, uuid, w_secret):
<add>
<add> uri = 'wss://%s:%s/%s/operations/%s/' \
<add> 'websocket?secret=%s' % (self.connection.host,
<add> self.connection.port,
<add> self.version,
<add> uuid, w_secret)
<add> return uri
<add>
<ide> def ex_get_api_endpoints(self):
<ide> """
<ide> Description: List of supported APIs | 1 |
Javascript | Javascript | update internalformat for webgl2.0 | c1ff8fcbd2f1d9550239bfa0acc38da8d679fb61 | <ide><path>src/renderers/webgl/WebGLTextures.js
<ide> function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
<ide> var image = cubeImage[ 0 ],
<ide> isPowerOfTwoImage = isPowerOfTwo( image ),
<ide> glFormat = utils.convert( texture.format ),
<del> glType = utils.convert( texture.type );
<add> glType = utils.convert( texture.type ),
<add> glInternalFormat = getInternalFormat( glFormat, glType );
<ide>
<ide> setTextureParameters( _gl.TEXTURE_CUBE_MAP, texture, isPowerOfTwoImage );
<ide>
<ide> function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
<ide>
<ide> if ( isDataTexture ) {
<ide>
<del> state.texImage2D( _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, 0, glFormat, cubeImage[ i ].width, cubeImage[ i ].height, 0, glFormat, glType, cubeImage[ i ].data );
<add> state.texImage2D( _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, 0, glInternalFormat, cubeImage[ i ].width, cubeImage[ i ].height, 0, glFormat, glType, cubeImage[ i ].data );
<ide>
<ide> } else {
<ide>
<del> state.texImage2D( _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, 0, glFormat, glFormat, glType, cubeImage[ i ] );
<add> state.texImage2D( _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, 0, glInternalFormat, glFormat, glType, cubeImage[ i ] );
<ide>
<ide> }
<ide>
<ide> function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
<ide>
<ide> if ( state.getCompressedTextureFormats().indexOf( glFormat ) > - 1 ) {
<ide>
<del> state.compressedTexImage2D( _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, j, glFormat, mipmap.width, mipmap.height, 0, mipmap.data );
<add> state.compressedTexImage2D( _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, j, glInternalFormat, mipmap.width, mipmap.height, 0, mipmap.data );
<ide>
<ide> } else {
<ide>
<ide> function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
<ide>
<ide> } else {
<ide>
<del> state.texImage2D( _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, j, glFormat, mipmap.width, mipmap.height, 0, glFormat, glType, mipmap.data );
<add> state.texImage2D( _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, j, glInternalFormat, mipmap.width, mipmap.height, 0, glFormat, glType, mipmap.data );
<ide>
<ide> }
<ide>
<ide> function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
<ide>
<ide> var isPowerOfTwoImage = isPowerOfTwo( image ),
<ide> glFormat = utils.convert( texture.format ),
<del> glType = utils.convert( texture.type );
<del>
<del> var internalFormat = getInternalFormat( glFormat, glType );
<add> glType = utils.convert( texture.type ),
<add> glInternalFormat = getInternalFormat( glFormat, glType );
<ide>
<ide> setTextureParameters( _gl.TEXTURE_2D, texture, isPowerOfTwoImage );
<ide>
<ide> function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
<ide>
<ide> // populate depth texture with dummy data
<ide>
<del> internalFormat = _gl.DEPTH_COMPONENT;
<add> glInternalFormat = _gl.DEPTH_COMPONENT;
<ide>
<ide> if ( texture.type === FloatType ) {
<ide>
<ide> if ( ! _isWebGL2 ) throw new Error( 'Float Depth Texture only supported in WebGL2.0' );
<del> internalFormat = _gl.DEPTH_COMPONENT32F;
<add> glInternalFormat = _gl.DEPTH_COMPONENT32F;
<ide>
<ide> } else if ( _isWebGL2 ) {
<ide>
<ide> // WebGL 2.0 requires signed internalformat for glTexImage2D
<del> internalFormat = _gl.DEPTH_COMPONENT16;
<add> glInternalFormat = _gl.DEPTH_COMPONENT16;
<ide>
<ide> }
<ide>
<del> if ( texture.format === DepthFormat && internalFormat === _gl.DEPTH_COMPONENT ) {
<add> if ( texture.format === DepthFormat && glInternalFormat === _gl.DEPTH_COMPONENT ) {
<ide>
<ide> // The error INVALID_OPERATION is generated by texImage2D if format and internalformat are
<ide> // DEPTH_COMPONENT and type is not UNSIGNED_SHORT or UNSIGNED_INT
<ide> function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
<ide> // (https://www.khronos.org/registry/webgl/extensions/WEBGL_depth_texture/)
<ide> if ( texture.format === DepthStencilFormat ) {
<ide>
<del> internalFormat = _gl.DEPTH_STENCIL;
<add> glInternalFormat = _gl.DEPTH_STENCIL;
<ide>
<ide> // The error INVALID_OPERATION is generated by texImage2D if format and internalformat are
<ide> // DEPTH_STENCIL and type is not UNSIGNED_INT_24_8_WEBGL.
<ide> function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
<ide>
<ide> }
<ide>
<del> state.texImage2D( _gl.TEXTURE_2D, 0, internalFormat, image.width, image.height, 0, glFormat, glType, null );
<add> state.texImage2D( _gl.TEXTURE_2D, 0, glInternalFormat, image.width, image.height, 0, glFormat, glType, null );
<ide>
<ide> } else if ( texture.isDataTexture ) {
<ide>
<ide> function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
<ide> for ( var i = 0, il = mipmaps.length; i < il; i ++ ) {
<ide>
<ide> mipmap = mipmaps[ i ];
<del> state.texImage2D( _gl.TEXTURE_2D, i, internalFormat, mipmap.width, mipmap.height, 0, glFormat, glType, mipmap.data );
<add> state.texImage2D( _gl.TEXTURE_2D, i, glInternalFormat, mipmap.width, mipmap.height, 0, glFormat, glType, mipmap.data );
<ide>
<ide> }
<ide>
<ide> function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
<ide>
<ide> } else {
<ide>
<del> state.texImage2D( _gl.TEXTURE_2D, 0, internalFormat, image.width, image.height, 0, glFormat, glType, image.data );
<add> state.texImage2D( _gl.TEXTURE_2D, 0, glInternalFormat, image.width, image.height, 0, glFormat, glType, image.data );
<ide> textureProperties.__maxMipLevel = 0;
<ide>
<ide> }
<ide> function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
<ide>
<ide> if ( state.getCompressedTextureFormats().indexOf( glFormat ) > - 1 ) {
<ide>
<del> state.compressedTexImage2D( _gl.TEXTURE_2D, i, internalFormat, mipmap.width, mipmap.height, 0, mipmap.data );
<add> state.compressedTexImage2D( _gl.TEXTURE_2D, i, glInternalFormat, mipmap.width, mipmap.height, 0, mipmap.data );
<ide>
<ide> } else {
<ide>
<ide> function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
<ide>
<ide> } else {
<ide>
<del> state.texImage2D( _gl.TEXTURE_2D, i, internalFormat, mipmap.width, mipmap.height, 0, glFormat, glType, mipmap.data );
<add> state.texImage2D( _gl.TEXTURE_2D, i, glInternalFormat, mipmap.width, mipmap.height, 0, glFormat, glType, mipmap.data );
<ide>
<ide> }
<ide>
<ide> function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
<ide> for ( var i = 0, il = mipmaps.length; i < il; i ++ ) {
<ide>
<ide> mipmap = mipmaps[ i ];
<del> state.texImage2D( _gl.TEXTURE_2D, i, internalFormat, glFormat, glType, mipmap );
<add> state.texImage2D( _gl.TEXTURE_2D, i, glInternalFormat, glFormat, glType, mipmap );
<ide>
<ide> }
<ide>
<ide> function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
<ide>
<ide> } else {
<ide>
<del> state.texImage2D( _gl.TEXTURE_2D, 0, internalFormat, glFormat, glType, image );
<add> state.texImage2D( _gl.TEXTURE_2D, 0, glInternalFormat, glFormat, glType, image );
<ide> textureProperties.__maxMipLevel = 0;
<ide>
<ide> } | 1 |
Python | Python | fix tf longformer | 83eec97ec6ac1a021b997d704672610bc57260c2 | <ide><path>src/transformers/models/longformer/modeling_tf_longformer.py
<ide> def _compute_global_attention_mask(input_ids_shape, sep_token_indices, before_se
<ide> True` else after `sep_token_id`.
<ide> """
<ide>
<del> assert sep_token_indices.shape[1] == 2, "`input_ids` should have two dimensions"
<add> assert shape_list(sep_token_indices)[1] == 2, "`input_ids` should have two dimensions"
<ide> question_end_index = tf.reshape(sep_token_indices, (input_ids_shape[0], 3, 2))[:, 0, 1]
<ide> question_end_index = tf.cast(question_end_index[:, None], tf.dtypes.int32) # size: batch_size x 1
<ide> # bool attention mask with True in locations of global attention
<ide> def _mask_invalid_locations(input_tensor, window_overlap):
<ide> )
<ide>
<ide> # pad to full matrix
<del> padding = tf.constant(
<add> padding = tf.convert_to_tensor(
<ide> [[0, shape_list(input_tensor)[1] - window_overlap], [0, shape_list(input_tensor)[3] - window_overlap - 1]]
<ide> )
<ide>
<ide> def call(
<ide> training=False,
<ide> ):
<ide> all_hidden_states = () if output_hidden_states else None
<del> all_attentions = () if output_attentions else None
<del> all_global_attentions = () if (output_attentions and is_global_attn) else None
<add> all_attentions = all_global_attentions = () if output_attentions else None
<ide>
<ide> for i, layer_module in enumerate(self.layer):
<ide> if output_hidden_states:
<ide> def call(
<ide> # bzs x seq_len x num_attn_heads x (num_global_attn + attention_window_len + 1) => bzs x num_attn_heads x seq_len x (num_global_attn + attention_window_len + 1)
<ide> all_attentions = all_attentions + (tf.transpose(layer_outputs[1], (0, 2, 1, 3)),)
<ide>
<del> if is_global_attn:
<del> # bzs x num_attn_heads x num_global_attn x seq_len => bzs x num_attn_heads x seq_len x num_global_attn
<del> all_global_attentions = all_global_attentions + (tf.transpose(layer_outputs[2], (0, 1, 3, 2)))
<add> # bzs x num_attn_heads x num_global_attn x seq_len => bzs x num_attn_heads x seq_len x num_global_attn
<add> all_global_attentions = all_global_attentions + (tf.transpose(layer_outputs[2], (0, 1, 3, 2)))
<ide>
<ide> # Add last layer
<ide> if output_hidden_states:
<ide> def _pad_to_window_size(
<ide> )
<ide> )
<ide>
<del> paddings = tf.constant([[0, 0], [0, padding_len]])
<add> paddings = tf.convert_to_tensor([[0, 0], [0, padding_len]])
<ide>
<del> if input_ids is not None:
<del> input_ids = tf.pad(input_ids, paddings, constant_values=pad_token_id)
<add> if input_ids is not None:
<add> input_ids = tf.pad(input_ids, paddings, constant_values=pad_token_id)
<add>
<add> if position_ids is not None:
<add> # pad with position_id = pad_token_id as in modeling_roberta.RobertaEmbeddings
<add> position_ids = tf.pad(position_ids, paddings, constant_values=pad_token_id)
<ide>
<del> if position_ids is not None:
<del> # pad with position_id = pad_token_id as in modeling_roberta.RobertaEmbeddings
<del> position_ids = tf.pad(position_ids, paddings, constant_values=pad_token_id)
<add> if inputs_embeds is not None:
<ide>
<del> if inputs_embeds is not None:
<add> def pad_embeddings():
<ide> input_ids_padding = tf.fill((batch_size, padding_len), self.pad_token_id)
<ide> inputs_embeds_padding = self.embeddings(input_ids_padding)
<del> inputs_embeds = tf.concat([inputs_embeds, inputs_embeds_padding], axis=-2)
<add> return tf.concat([inputs_embeds, inputs_embeds_padding], axis=-2)
<ide>
<del> attention_mask = tf.pad(
<del> attention_mask, paddings, constant_values=False
<del> ) # no attention on the padding tokens
<del> token_type_ids = tf.pad(token_type_ids, paddings, constant_values=0) # pad with token_type_id = 0
<add> inputs_embeds = tf.cond(padding_len > 0, pad_embeddings, lambda: inputs_embeds)
<add>
<add> attention_mask = tf.pad(attention_mask, paddings, constant_values=False) # no attention on the padding tokens
<add> token_type_ids = tf.pad(token_type_ids, paddings, constant_values=0) # pad with token_type_id = 0
<ide>
<ide> return (
<ide> padding_len,
<ide> def call(
<ide>
<ide> # set global attention on question tokens
<ide> if inputs["global_attention_mask"] is None and inputs["input_ids"] is not None:
<del> if inputs["input_ids"] is None:
<del> logger.warning(
<del> "It is not possible to automatically generate the `global_attention_mask`. Please make sure that it is correctly set."
<del> )
<del> elif (
<del> tf.where(inputs["input_ids"] == self.config.sep_token_id).shape[0] != 3 * inputs["input_ids"].shape[0]
<add> if (
<add> shape_list(tf.where(inputs["input_ids"] == self.config.sep_token_id))[0]
<add> != 3 * shape_list(inputs["input_ids"])[0]
<ide> ):
<ide> logger.warning(
<del> f"There should be exactly three separator tokens: {self.config.sep_token_id} in every sample for questions answering. You might also consider to set `global_attention_mask` manually in the forward function to avoid this. This is most likely an error."
<add> f"There should be exactly three separator tokens: {self.config.sep_token_id} in every sample for questions answering. You might also consider to set `global_attention_mask` manually in the forward function to avoid this. This is most likely an error. The global attention is disabled for this forward pass."
<ide> )
<add> inputs["global_attention_mask"] = tf.fill(shape_list(inputs["input_ids"]), value=0)
<ide> else:
<ide> logger.info("Initializing global attention on question tokens...")
<ide> # put global attention on all tokens until `config.sep_token_id` is reached
<ide> def call(
<ide> inputs["global_attention_mask"] = tf.zeros_like(inputs["input_ids"])
<ide> inputs["global_attention_mask"] = tf.tensor_scatter_nd_update(
<ide> inputs["global_attention_mask"],
<del> [[i, 0] for i in range(inputs["input_ids"].shape[0])],
<del> [1 for _ in range(inputs["input_ids"].shape[0])],
<add> [[i, 0] for i in range(shape_list(inputs["input_ids"])[0])],
<add> [1 for _ in range(shape_list(inputs["input_ids"])[0])],
<ide> )
<ide>
<ide> outputs = self.longformer(
<ide> def call(
<ide> tf.reshape(inputs["position_ids"], (-1, seq_length)) if inputs["position_ids"] is not None else None
<ide> )
<ide> flat_global_attention_mask = (
<del> tf.reshape(inputs["global_attention_mask"], (-1, inputs["global_attention_mask"].shape[-1]))
<add> tf.reshape(inputs["global_attention_mask"], (-1, shape_list(inputs["global_attention_mask"])[-1]))
<ide> if inputs["global_attention_mask"] is not None
<ide> else None
<ide> ) | 1 |
Ruby | Ruby | add a method to generate a temp podspec | eebc829b23d87290603103595380a8069c8f7cef | <ide><path>scripts/react_native_pods.rb
<ide> # This source code is licensed under the MIT license found in the
<ide> # LICENSE file in the root directory of this source tree.
<ide>
<add>$CODEGEN_TEMP_DIR = 'build/generated'
<add>
<ide> def use_react_native! (options={})
<ide> # The prefix to react-native
<ide> prefix = options[:path] ||= "../node_modules/react-native"
<ide> def react_native_post_install(installer)
<ide> fix_library_search_paths(installer)
<ide> end
<ide>
<add>
<add>def generate_temp_pod_spec_for_codegen!()
<add> output_dir = "#{Pod::Config.instance.installation_root}/#{$CODEGEN_TEMP_DIR}"
<add> Pod::Executable.execute_command("mkdir", ["-p", output_dir]);
<add>
<add> package = JSON.parse(File.read(File.join(__dir__, "..", "package.json")))
<add> version = package['version']
<add>
<add> folly_compiler_flags = '-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -Wno-comma -Wno-shorten-64-to-32'
<add> folly_version = '2021.06.28.00'
<add> boost_version = '1.76.0'
<add> boost_compiler_flags = '-Wno-documentation'
<add>
<add> spec = {
<add> 'name' => "ReactNative-Codegen",
<add> 'version' => version,
<add> 'summary' => 'Temp pod for generated files for React Native',
<add> 'homepage' => 'https://facebook.com/',
<add> 'license' => 'Unlicense',
<add> 'authors' => 'Facebook',
<add> 'compiler_flags' => "#{folly_compiler_flags} #{boost_compiler_flags} -Wno-nullability-completeness",
<add> 'source' => { :git => '' },
<add> 'platforms' => {
<add> 'ios' => '11.0',
<add> },
<add> 'source_files' => "**/*.{h,mm,cpp}",
<add> 'pod_target_xcconfig' => { "HEADER_SEARCH_PATHS" =>
<add> [
<add> "\"$(PODS_ROOT)/boost\"",
<add> "\"$(PODS_ROOT)/RCT-Folly\"",
<add> "\"$(PODS_ROOT)/Headers/Private/React-Fabric\""
<add> ].join(' ')
<add> },
<add> 'dependencies': {
<add> "React-graphics": [version],
<add> "React-jsiexecutor": [version],
<add> "RCT-Folly": [folly_version],
<add> "RCTRequired": [version],
<add> "RCTTypeSafety": [version],
<add> "React-Core": [version],
<add> "React-jsi": [version],
<add> "ReactCommon/turbomodule/core": [version]
<add> }
<add> }
<add> podspec_path = File.join(output_dir, 'ReactNative-Codegen.podspec.json')
<add> Pod::UI.puts "[Codegene] Generating #{podspec_path}"
<add>
<add> File.open(podspec_path, 'w') do |f|
<add> f.write(spec.to_json)
<add> f.fsync
<add> end
<add>
<add> return {
<add> "spec" => spec,
<add> "path" => output_dir,
<add> }
<add>end
<add>
<add>
<ide> def use_react_native_codegen!(spec, options={})
<ide> return if ENV['DISABLE_CODEGEN'] == '1'
<ide> | 1 |
Python | Python | fix warning message in electraforcausallm | 65f9653ed069076fd2b3bdcdfffecbd43c2d2a39 | <ide><path>src/transformers/models/electra/modeling_electra.py
<ide> def __init__(self, config):
<ide> super().__init__(config)
<ide>
<ide> if not config.is_decoder:
<del> logger.warning("If you want to use `ElectraLMHeadModel` as a standalone, add `is_decoder=True.`")
<add> logger.warning("If you want to use `ElectraForCausalLM` as a standalone, add `is_decoder=True.`")
<ide>
<ide> self.electra = ElectraModel(config)
<ide> self.generator_predictions = ElectraGeneratorPredictions(config) | 1 |
Text | Text | update the as changelog | d9fc52cc7bb626d46d84fcd0a226b33ddd3b8608 | <ide><path>activesupport/CHANGELOG.md
<add>* `ActiveSupport::Dependencies` no longer installs a `const_missing` hook. Before this, you could push to the autoload paths and have constants autoloaded. This feature, known as the `classic` autoloader, has been removed.
<add>
<add> *Xavier Noria*
<add>
<add>* Private internal classes of `ActiveSupport::Dependencies` have been deleted, like `ActiveSupport::Dependencies::Reference`, `ActiveSupport::Dependencies::Blamable`, and others.
<add>
<add> *Xavier Noria*
<add>
<add>* The private API of `ActiveSupport::Dependencies` has been deleted. That includes methods like `hook!`, `unhook!`, `depend_on`, `require_or_load`, `mechanism`, and many others.
<add>
<add> *Xavier Noria*
<add>
<ide> * Improves the performance of ActiveSupport::NumberHelper formatters by avoiding the use of
<ide> exceptions as flow control.
<ide>
<ide>
<ide> Previously, if you provided a `error_handler` to `redis_cache_store`, any errors thrown by
<ide> the error handler would be rescued and logged only. Removed the `rescue` clause from `handle_exception`
<del> to allow these to be thrown.
<del>
<add> to allow these to be thrown.
<add>
<ide> *Nicholas A. Stuart*
<ide>
<ide> * Allow entirely opting out of deprecation warnings. | 1 |
PHP | PHP | add tests for behaviortask | 0923322761f94dda27a8d8569d8fbdea1edd0ec8 | <ide><path>tests/TestCase/Console/Command/Task/BehaviorTaskTest.php
<add><?php
<add>/**
<add> * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
<add> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<add> *
<add> * Licensed under The MIT License
<add> * For full copyright and license information, please see the LICENSE.txt
<add> * Redistributions of files must retain the above copyright notice.
<add> *
<add> * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
<add> * @link http://cakephp.org CakePHP(tm) Project
<add> * @since 1.3.0
<add> * @license http://www.opensource.org/licenses/mit-license.php MIT License
<add> */
<add>namespace Cake\Test\TestCase\Console\Command\Task;
<add>
<add>use Cake\Console\Command\Task\TemplateTask;
<add>use Cake\Core\Configure;
<add>use Cake\Core\Plugin;
<add>use Cake\TestSuite\TestCase;
<add>
<add>/**
<add> * BehaviorTaskTest class
<add> *
<add> */
<add>class BehaviorTaskTest extends TestCase {
<add>
<add>/**
<add> * setup method
<add> *
<add> * @return void
<add> */
<add> public function setUp() {
<add> parent::setUp();
<add> $out = $this->getMock('Cake\Console\ConsoleOutput', [], [], '', false);
<add> $in = $this->getMock('Cake\Console\ConsoleInput', [], [], '', false);
<add>
<add> $this->Task = $this->getMock('Cake\Console\Command\Task\BehaviorTask',
<add> ['in', 'err', 'createFile', '_stop', 'clear'],
<add> [$out, $out, $in]
<add> );
<add> $this->Task->Test = $this->getMock('Cake\Console\Command\Task\TestTask',
<add> [],
<add> [$out, $out, $in]
<add> );
<add> $this->Task->Template = new TemplateTask($out, $out, $in);
<add> $this->Task->Template->initialize();
<add> $this->Task->path = '/app/Model/Behavior/';
<add> }
<add>
<add>/**
<add> * Test the excute method.
<add> *
<add> * @return void
<add> */
<add> public function testExecute() {
<add> $this->Task->args = ['Example'];
<add> $this->Task->expects($this->once())
<add> ->method('createFile')
<add> ->with(
<add> '/app/Model/Behavior/ExampleBehavior.php',
<add> $this->stringContains('class ExampleBehavior extends Behavior')
<add> );
<add> $this->Task->Test->expects($this->once())
<add> ->method('bake')
<add> ->with('Behavior', 'Example');
<add>
<add> $this->Task->execute();
<add> }
<add>
<add>/**
<add> * Test generating code.
<add> *
<add> * @return void
<add> */
<add> public function testBake() {
<add> Configure::write('App.namespace', 'TestApp');
<add>
<add> $this->Task->expects($this->once())
<add> ->method('createFile')
<add> ->with(
<add> '/app/Model/Behavior/ExampleBehavior.php',
<add> $this->stringContains('class ExampleBehavior extends Behavior')
<add> );
<add>
<add> $result = $this->Task->bake('Example');
<add> $this->assertContains('namespace TestApp\Model\Behavior;', $result);
<add> $this->assertContains('use Cake\ORM\Behavior;', $result);
<add> $this->assertContains('class ExampleBehavior extends Behavior {', $result);
<add> }
<add>
<add>/**
<add> * Test bakeTest
<add> *
<add> * @return void
<add> */
<add> public function testBakeTest() {
<add> $this->Task->plugin = 'TestPlugin';
<add> $this->Task->Test->expects($this->once())
<add> ->method('bake')
<add> ->with('Behavior', 'Example');
<add>
<add> $this->Task->bakeTest('Example');
<add> $this->assertEquals($this->Task->plugin, $this->Task->Test->plugin);
<add> }
<add>
<add>/**
<add> * Test the no-test option.
<add> *
<add> * @return void
<add> */
<add> public function testBakeTestNoTest() {
<add> $this->Task->params['no-test'] = true;
<add> $this->Task->Test->expects($this->never())
<add> ->method('bake');
<add>
<add> $result = $this->Task->bakeTest('Example');
<add> }
<add>
<add>/**
<add> * Test baking within a plugin.
<add> *
<add> * @return void
<add> */
<add> public function testBakePlugin() {
<add> Plugin::load('TestPlugin');
<add>
<add> $path = Plugin::path('TestPlugin');
<add>
<add> $this->Task->plugin = 'TestPlugin';
<add> $this->Task->expects($this->once())
<add> ->method('createFile')
<add> ->with(
<add> $path . 'Model/Behavior/ExampleBehavior.php',
<add> $this->stringContains('class ExampleBehavior extends Behavior')
<add> );
<add>
<add> $result = $this->Task->bake('Example');
<add> $this->assertContains('namespace TestPlugin\Model\Behavior;', $result);
<add> $this->assertContains('use Cake\ORM\Behavior;', $result);
<add> $this->assertContains('class ExampleBehavior extends Behavior {', $result);
<add> }
<add>
<add>} | 1 |
Go | Go | send truncated external responses to the client | b2603e895acf3ed0449a8db8434db9e8bcf0685d | <ide><path>libnetwork/resolver.go
<ide> func (r *resolver) ServeDNS(w dns.ResponseWriter, query *dns.Msg) {
<ide> // read again
<ide> resp, err = co.ReadMsg()
<ide> if err != nil {
<add> // Truncated DNS replies should be sent to the client so that the
<add> // client can retry over TCP
<add> if err == dns.ErrTruncated && resp != nil {
<add> break
<add> }
<ide> if nerr, ok := err.(net.Error); ok && nerr.Timeout() {
<ide> r.addQueryToGC(w, query)
<ide> } | 1 |
Javascript | Javascript | handle null completer graciously | 92d4ed397bc9cd6591b245c8e4be3c28cf207c28 | <ide><path>lib/readline.js
<ide> function Interface(input, output, completer) {
<ide> }
<ide> EventEmitter.call(this);
<ide>
<add> completer = completer || function() { return []; };
<add>
<add> if (typeof completer !== 'function') {
<add> throw new TypeError("Argument 'completer' must be a function");
<add> }
<add>
<ide> var self = this;
<ide>
<ide> this.output = output;
<ide> Interface.prototype._ttyWrite = function(s, key) {
<ide> break;
<ide>
<ide> case 'tab': // tab completion
<del> if (this.completer) {
<del> this._tabComplete();
<del> }
<add> this._tabComplete();
<ide> break;
<ide>
<ide> case 'left': | 1 |
Python | Python | fix mypy at prims_algo_2 | 95862303a6527f4bf111e6f3f783fd66b7b426f3 | <ide><path>graphs/minimum_spanning_tree_prims2.py
<ide> """
<ide>
<ide> from sys import maxsize
<del>from typing import Dict, Optional, Tuple, Union
<add>from typing import Generic, Optional, TypeVar
<add>
<add>T = TypeVar("T")
<ide>
<ide>
<ide> def get_parent_position(position: int) -> int:
<ide> def get_child_right_position(position: int) -> int:
<ide> return (2 * position) + 2
<ide>
<ide>
<del>class MinPriorityQueue:
<add>class MinPriorityQueue(Generic[T]):
<ide> """
<ide> Minimum Priority Queue Class
<ide>
<ide> class MinPriorityQueue:
<ide> """
<ide>
<ide> def __init__(self) -> None:
<del> self.heap = []
<del> self.position_map = {}
<del> self.elements = 0
<add> self.heap: list[tuple[T, int]] = []
<add> self.position_map: dict[T, int] = {}
<add> self.elements: int = 0
<ide>
<ide> def __len__(self) -> int:
<ide> return self.elements
<ide> def is_empty(self) -> bool:
<ide> # Check if the priority queue is empty
<ide> return self.elements == 0
<ide>
<del> def push(self, elem: Union[int, str], weight: int) -> None:
<add> def push(self, elem: T, weight: int) -> None:
<ide> # Add an element with given priority to the queue
<ide> self.heap.append((elem, weight))
<ide> self.position_map[elem] = self.elements
<ide> self.elements += 1
<ide> self._bubble_up(elem)
<ide>
<del> def extract_min(self) -> Union[int, str]:
<add> def extract_min(self) -> T:
<ide> # Remove and return the element with lowest weight (highest priority)
<ide> if self.elements > 1:
<ide> self._swap_nodes(0, self.elements - 1)
<ide> def extract_min(self) -> Union[int, str]:
<ide> self._bubble_down(bubble_down_elem)
<ide> return elem
<ide>
<del> def update_key(self, elem: Union[int, str], weight: int) -> None:
<add> def update_key(self, elem: T, weight: int) -> None:
<ide> # Update the weight of the given key
<ide> position = self.position_map[elem]
<ide> self.heap[position] = (elem, weight)
<ide> def update_key(self, elem: Union[int, str], weight: int) -> None:
<ide> else:
<ide> self._bubble_down(elem)
<ide>
<del> def _bubble_up(self, elem: Union[int, str]) -> None:
<add> def _bubble_up(self, elem: T) -> None:
<ide> # Place a node at the proper position (upward movement) [to be used internally
<ide> # only]
<ide> curr_pos = self.position_map[elem]
<ide> def _bubble_up(self, elem: Union[int, str]) -> None:
<ide> return self._bubble_up(elem)
<ide> return
<ide>
<del> def _bubble_down(self, elem: Union[int, str]) -> None:
<add> def _bubble_down(self, elem: T) -> None:
<ide> # Place a node at the proper position (downward movement) [to be used
<ide> # internally only]
<ide> curr_pos = self.position_map[elem]
<ide> def _swap_nodes(self, node1_pos: int, node2_pos: int) -> None:
<ide> self.position_map[node2_elem] = node1_pos
<ide>
<ide>
<del>class GraphUndirectedWeighted:
<add>class GraphUndirectedWeighted(Generic[T]):
<ide> """
<ide> Graph Undirected Weighted Class
<ide>
<ide> class GraphUndirectedWeighted:
<ide> """
<ide>
<ide> def __init__(self) -> None:
<del> self.connections = {}
<del> self.nodes = 0
<add> self.connections: dict[T, dict[T, int]] = {}
<add> self.nodes: int = 0
<ide>
<ide> def __repr__(self) -> str:
<ide> return str(self.connections)
<ide>
<ide> def __len__(self) -> int:
<ide> return self.nodes
<ide>
<del> def add_node(self, node: Union[int, str]) -> None:
<add> def add_node(self, node: T) -> None:
<ide> # Add a node in the graph if it is not in the graph
<ide> if node not in self.connections:
<ide> self.connections[node] = {}
<ide> self.nodes += 1
<ide>
<del> def add_edge(
<del> self, node1: Union[int, str], node2: Union[int, str], weight: int
<del> ) -> None:
<add> def add_edge(self, node1: T, node2: T, weight: int) -> None:
<ide> # Add an edge between 2 nodes in the graph
<ide> self.add_node(node1)
<ide> self.add_node(node2)
<ide> def add_edge(
<ide>
<ide>
<ide> def prims_algo(
<del> graph: GraphUndirectedWeighted,
<del>) -> Tuple[Dict[str, int], Dict[str, Optional[str]]]:
<add> graph: GraphUndirectedWeighted[T],
<add>) -> tuple[dict[T, int], dict[T, Optional[T]]]:
<ide> """
<ide> >>> graph = GraphUndirectedWeighted()
<ide>
<ide> def prims_algo(
<ide> 13
<ide> """
<ide> # prim's algorithm for minimum spanning tree
<del> dist = {node: maxsize for node in graph.connections}
<del> parent = {node: None for node in graph.connections}
<del> priority_queue = MinPriorityQueue()
<del> [priority_queue.push(node, weight) for node, weight in dist.items()]
<add> dist: dict[T, int] = {node: maxsize for node in graph.connections}
<add> parent: dict[T, Optional[T]] = {node: None for node in graph.connections}
<add>
<add> priority_queue: MinPriorityQueue[T] = MinPriorityQueue()
<add> for node, weight in dist.items():
<add> priority_queue.push(node, weight)
<add>
<ide> if priority_queue.is_empty():
<ide> return dist, parent
<ide>
<ide> def prims_algo(
<ide> dist[neighbour] = dist[node] + graph.connections[node][neighbour]
<ide> priority_queue.update_key(neighbour, dist[neighbour])
<ide> parent[neighbour] = node
<add>
<ide> # running prim's algorithm
<ide> while not priority_queue.is_empty():
<ide> node = priority_queue.extract_min()
<ide> def prims_algo(
<ide> priority_queue.update_key(neighbour, dist[neighbour])
<ide> parent[neighbour] = node
<ide> return dist, parent
<del>
<del>
<del>if __name__ == "__main__":
<del> from doctest import testmod
<del>
<del> testmod() | 1 |
Text | Text | add #update_columns entry to ar changelog | bca66a3547ac166eccac3e8cfead3d93b3d0921b | <ide><path>activerecord/CHANGELOG.md
<ide> ## Rails 4.0.0 (unreleased) ##
<ide>
<add>* Added `#update_columns` method which updates the attributes from
<add> the passed-in hash without calling save, hence skipping validations and
<add> callbacks. `ActiveRecordError` will be raised when called on new objects
<add> or when at least one of the attributes is marked as read only.
<add>
<add> post.attributes # => {"id"=>2, "title"=>"My title", "body"=>"My content", "author"=>"Peter"}
<add> post.update_columns({title: 'New title', author: 'Sebastian'}) # => true
<add> post.attributes # => {"id"=>2, "title"=>"New title", "body"=>"My content", "author"=>"Sebastian"}
<add>
<add> *Sebastian Martinez*
<add>
<ide> * Allow before and after validations to take an array of lifecycle events
<ide>
<ide> *John Foley* | 1 |
Mixed | Javascript | add loop property | e92ce38cf1a770e5eaf3b2dbf485d90f9f7d90bf | <ide><path>docs/docs/ref-04-tags-and-attributes.md
<ide> accept accessKey action allowFullScreen allowTransparency alt autoCapitalize
<ide> autoComplete autoFocus autoPlay cellPadding cellSpacing charSet checked
<ide> className colSpan content contentEditable contextMenu controls data dateTime
<ide> dir disabled draggable encType form frameBorder height hidden href htmlFor
<del>httpEquiv icon id label lang list max maxLength method min multiple name
<add>httpEquiv icon id label lang list loop max maxLength method min multiple name
<ide> pattern placeholder poster preload radioGroup readOnly rel required role
<ide> rowSpan scrollLeft scrollTop selected size spellCheck src step style tabIndex
<ide> target title type value width wmode
<ide><path>src/dom/DefaultDOMPropertyConfig.js
<ide> var DefaultDOMPropertyConfig = {
<ide> label: null,
<ide> lang: null,
<ide> list: null,
<add> loop: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
<ide> max: null,
<ide> maxLength: MUST_USE_ATTRIBUTE,
<ide> method: null, | 2 |
Python | Python | fix deletion of dag with rescheduled tasks | 078ff765dbde1a47a0f9bcbd605c711e96201f79 | <ide><path>airflow/migrations/versions/4ebbffe0a39a_merge_heads.py
<add>#
<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>"""Merge heads
<add>
<add>Revision ID: 4ebbffe0a39a
<add>Revises: dd4ecb8fbee3, cf5dc11e79ad, a56c9515abdc
<add>Create Date: 2019-02-04 20:19:50.628137
<add>
<add>"""
<add>
<add># revision identifiers, used by Alembic.
<add>revision = '4ebbffe0a39a'
<add>down_revision = ('dd4ecb8fbee3', 'cf5dc11e79ad', 'a56c9515abdc')
<add>branch_labels = None
<add>depends_on = None
<add>
<add>
<add>def upgrade():
<add> pass
<add>
<add>
<add>def downgrade():
<add> pass
<ide><path>airflow/migrations/versions/939bb1e647c8_task_reschedule_fk_on_cascade_delete.py
<add>#
<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>"""task reschedule fk on cascade delete
<add>
<add>Revision ID: 939bb1e647c8
<add>Revises: 4ebbffe0a39a
<add>Create Date: 2019-02-04 20:21:50.669751
<add>
<add>"""
<add>
<add>from alembic import op
<add>
<add># revision identifiers, used by Alembic.
<add>revision = '939bb1e647c8'
<add>down_revision = '4ebbffe0a39a'
<add>branch_labels = None
<add>depends_on = None
<add>
<add>
<add>def upgrade():
<add> with op.batch_alter_table('task_reschedule') as batch_op:
<add> batch_op.drop_constraint(
<add> 'task_reschedule_dag_task_date_fkey',
<add> type_='foreignkey'
<add> )
<add> batch_op.create_foreign_key(
<add> 'task_reschedule_dag_task_date_fkey',
<add> 'task_instance',
<add> ['task_id', 'dag_id', 'execution_date'],
<add> ['task_id', 'dag_id', 'execution_date'],
<add> ondelete='CASCADE'
<add> )
<add>
<add>
<add>def downgrade():
<add> with op.batch_alter_table('task_reschedule') as batch_op:
<add> batch_op.drop_constraint(
<add> 'task_reschedule_dag_task_date_fkey',
<add> type_='foreignkey'
<add> )
<add> batch_op.create_foreign_key(
<add> 'task_reschedule_dag_task_date_fkey',
<add> 'task_instance',
<add> ['task_id', 'dag_id', 'execution_date'],
<add> ['task_id', 'dag_id', 'execution_date']
<add> )
<ide><path>airflow/models/taskreschedule.py
<ide> class TaskReschedule(Base):
<ide> ForeignKeyConstraint([task_id, dag_id, execution_date],
<ide> ['task_instance.task_id', 'task_instance.dag_id',
<ide> 'task_instance.execution_date'],
<del> name='task_reschedule_dag_task_date_fkey')
<add> name='task_reschedule_dag_task_date_fkey',
<add> ondelete='CASCADE')
<ide> )
<ide>
<ide> def __init__(self, task, execution_date, try_number, start_date, end_date,
<ide><path>tests/api/common/experimental/test_delete_dag.py
<ide> import unittest
<ide>
<ide> from airflow import models
<del>from airflow import settings
<ide> from airflow.api.common.experimental.delete_dag import delete_dag
<ide> from airflow.exceptions import DagNotFound, DagFileExists
<ide> from airflow.operators.dummy_operator import DummyOperator
<ide> from airflow.utils.dates import days_ago
<add>from airflow.utils.db import create_session
<ide> from airflow.utils.state import State
<ide>
<ide> DM = models.DagModel
<ide> DR = models.DagRun
<ide> TI = models.TaskInstance
<ide> LOG = models.log.Log
<add>TF = models.taskfail.TaskFail
<add>TR = models.taskreschedule.TaskReschedule
<ide>
<ide>
<ide> class TestDeleteDAGCatchError(unittest.TestCase):
<ide>
<ide> def setUp(self):
<del> self.session = settings.Session()
<ide> self.dagbag = models.DagBag(include_examples=True)
<ide> self.dag_id = 'example_bash_operator'
<ide> self.dag = self.dagbag.dags[self.dag_id]
<ide>
<ide> def tearDown(self):
<ide> self.dag.clear()
<del> self.session.close()
<ide>
<ide> def test_delete_dag_non_existent_dag(self):
<ide> with self.assertRaises(DagNotFound):
<ide> delete_dag("non-existent DAG")
<ide>
<ide> def test_delete_dag_dag_still_in_dagbag(self):
<del> models_to_check = ['DagModel', 'DagRun', 'TaskInstance']
<del> record_counts = {}
<add> with create_session() as session:
<add> models_to_check = ['DagModel', 'DagRun', 'TaskInstance']
<add> record_counts = {}
<ide>
<del> for model_name in models_to_check:
<del> m = getattr(models, model_name)
<del> record_counts[model_name] = self.session.query(m).filter(m.dag_id == self.dag_id).count()
<add> for model_name in models_to_check:
<add> m = getattr(models, model_name)
<add> record_counts[model_name] = session.query(m).filter(m.dag_id == self.dag_id).count()
<ide>
<del> with self.assertRaises(DagFileExists):
<del> delete_dag(self.dag_id)
<add> with self.assertRaises(DagFileExists):
<add> delete_dag(self.dag_id)
<ide>
<del> # No change should happen in DB
<del> for model_name in models_to_check:
<del> m = getattr(models, model_name)
<del> self.assertEqual(
<del> self.session.query(m).filter(
<del> m.dag_id == self.dag_id
<del> ).count(),
<del> record_counts[model_name]
<del> )
<add> # No change should happen in DB
<add> for model_name in models_to_check:
<add> m = getattr(models, model_name)
<add> self.assertEqual(
<add> session.query(m).filter(
<add> m.dag_id == self.dag_id
<add> ).count(),
<add> record_counts[model_name]
<add> )
<ide>
<ide>
<ide> class TestDeleteDAGSuccessfulDelete(unittest.TestCase):
<ide>
<ide> def setUp(self):
<del> self.session = settings.Session()
<ide> self.key = "test_dag_id"
<ide>
<ide> task = DummyOperator(task_id='dummy',
<ide> dag=models.DAG(dag_id=self.key,
<ide> default_args={'start_date': days_ago(2)}),
<ide> owner='airflow')
<ide>
<del> self.session.add(DM(dag_id=self.key))
<del> self.session.add(DR(dag_id=self.key))
<del> self.session.add(TI(task=task,
<del> execution_date=days_ago(1),
<del> state=State.SUCCESS))
<del> self.session.add(LOG(dag_id=self.key, task_id=None, task_instance=None,
<del> execution_date=days_ago(1), event="varimport"))
<del>
<del> self.session.commit()
<add> d = days_ago(1)
<add> with create_session() as session:
<add> session.add(DM(dag_id=self.key))
<add> session.add(DR(dag_id=self.key))
<add> session.add(TI(task=task,
<add> execution_date=d,
<add> state=State.SUCCESS))
<add> # flush to ensure task instance if written before
<add> # task reschedule because of FK constraint
<add> session.flush()
<add> session.add(LOG(dag_id=self.key, task_id=None, task_instance=None,
<add> execution_date=d, event="varimport"))
<add> session.add(TF(task=task, execution_date=d,
<add> start_date=d, end_date=d))
<add> session.add(TR(task=task, execution_date=d,
<add> start_date=d, end_date=d,
<add> try_number=1, reschedule_date=d))
<ide>
<ide> def tearDown(self):
<del> self.session.query(DM).filter(DM.dag_id == self.key).delete()
<del> self.session.query(DR).filter(DR.dag_id == self.key).delete()
<del> self.session.query(TI).filter(TI.dag_id == self.key).delete()
<del> self.session.query(LOG).filter(LOG.dag_id == self.key).delete()
<del> self.session.commit()
<del>
<del> self.session.close()
<add> with create_session() as session:
<add> session.query(TR).filter(TR.dag_id == self.key).delete()
<add> session.query(TF).filter(TF.dag_id == self.key).delete()
<add> session.query(TI).filter(TI.dag_id == self.key).delete()
<add> session.query(DR).filter(DR.dag_id == self.key).delete()
<add> session.query(DM).filter(DM.dag_id == self.key).delete()
<add> session.query(LOG).filter(LOG.dag_id == self.key).delete()
<ide>
<ide> def test_delete_dag_successful_delete(self):
<del>
<del> self.assertEqual(self.session.query(DM).filter(DM.dag_id == self.key).count(), 1)
<del> self.assertEqual(self.session.query(DR).filter(DR.dag_id == self.key).count(), 1)
<del> self.assertEqual(self.session.query(TI).filter(TI.dag_id == self.key).count(), 1)
<del> self.assertEqual(self.session.query(LOG).filter(LOG.dag_id == self.key).count(), 1)
<add> with create_session() as session:
<add> self.assertEqual(session.query(DM).filter(DM.dag_id == self.key).count(), 1)
<add> self.assertEqual(session.query(DR).filter(DR.dag_id == self.key).count(), 1)
<add> self.assertEqual(session.query(TI).filter(TI.dag_id == self.key).count(), 1)
<add> self.assertEqual(session.query(TF).filter(TF.dag_id == self.key).count(), 1)
<add> self.assertEqual(session.query(TR).filter(TR.dag_id == self.key).count(), 1)
<add> self.assertEqual(session.query(LOG).filter(LOG.dag_id == self.key).count(), 1)
<ide>
<ide> delete_dag(dag_id=self.key)
<ide>
<del> self.assertEqual(self.session.query(DM).filter(DM.dag_id == self.key).count(), 0)
<del> self.assertEqual(self.session.query(DR).filter(DR.dag_id == self.key).count(), 0)
<del> self.assertEqual(self.session.query(TI).filter(TI.dag_id == self.key).count(), 0)
<del> self.assertEqual(self.session.query(LOG).filter(LOG.dag_id == self.key).count(), 1)
<add> with create_session() as session:
<add> self.assertEqual(session.query(DM).filter(DM.dag_id == self.key).count(), 0)
<add> self.assertEqual(session.query(DR).filter(DR.dag_id == self.key).count(), 0)
<add> self.assertEqual(session.query(TI).filter(TI.dag_id == self.key).count(), 0)
<add> self.assertEqual(session.query(TF).filter(TF.dag_id == self.key).count(), 0)
<add> self.assertEqual(session.query(TR).filter(TR.dag_id == self.key).count(), 0)
<add> self.assertEqual(session.query(LOG).filter(LOG.dag_id == self.key).count(), 1)
<ide>
<ide> def test_delete_dag_successful_delete_not_keeping_records_in_log(self):
<ide>
<del> self.assertEqual(self.session.query(DM).filter(DM.dag_id == self.key).count(), 1)
<del> self.assertEqual(self.session.query(DR).filter(DR.dag_id == self.key).count(), 1)
<del> self.assertEqual(self.session.query(TI).filter(TI.dag_id == self.key).count(), 1)
<del> self.assertEqual(self.session.query(LOG).filter(LOG.dag_id == self.key).count(), 1)
<add> with create_session() as session:
<add> self.assertEqual(session.query(DM).filter(DM.dag_id == self.key).count(), 1)
<add> self.assertEqual(session.query(DR).filter(DR.dag_id == self.key).count(), 1)
<add> self.assertEqual(session.query(TI).filter(TI.dag_id == self.key).count(), 1)
<add> self.assertEqual(session.query(TF).filter(TF.dag_id == self.key).count(), 1)
<add> self.assertEqual(session.query(TR).filter(TR.dag_id == self.key).count(), 1)
<add> self.assertEqual(session.query(LOG).filter(LOG.dag_id == self.key).count(), 1)
<ide>
<ide> delete_dag(dag_id=self.key, keep_records_in_log=False)
<ide>
<del> self.assertEqual(self.session.query(DM).filter(DM.dag_id == self.key).count(), 0)
<del> self.assertEqual(self.session.query(DR).filter(DR.dag_id == self.key).count(), 0)
<del> self.assertEqual(self.session.query(TI).filter(TI.dag_id == self.key).count(), 0)
<del> self.assertEqual(self.session.query(LOG).filter(LOG.dag_id == self.key).count(), 0)
<add> with create_session() as session:
<add> self.assertEqual(session.query(DM).filter(DM.dag_id == self.key).count(), 0)
<add> self.assertEqual(session.query(DR).filter(DR.dag_id == self.key).count(), 0)
<add> self.assertEqual(session.query(TI).filter(TI.dag_id == self.key).count(), 0)
<add> self.assertEqual(session.query(TF).filter(TF.dag_id == self.key).count(), 0)
<add> self.assertEqual(session.query(TR).filter(TR.dag_id == self.key).count(), 0)
<add> self.assertEqual(session.query(LOG).filter(LOG.dag_id == self.key).count(), 0)
<ide>
<ide>
<ide> if __name__ == '__main__': | 4 |
Ruby | Ruby | adjust argv tests | e251e5e4ecd0e2c6ce10cc6ef9b6d9c28ff6390e | <ide><path>Library/Homebrew/test/test_ARGV.rb
<ide> def reset
<ide> class ARGVTests < Test::Unit::TestCase
<ide>
<ide> def test_ARGV
<del> assert_raises(FormulaUnspecifiedError) { ARGV.formulae }
<del> assert_raises(KegUnspecifiedError) { ARGV.kegs }
<ide> assert ARGV.named.empty?
<ide>
<ide> (HOMEBREW_CELLAR+'mxcl/10.0').mkpath | 1 |
Javascript | Javascript | remove more mentions of indexset | 3d2ba75dc7d381b63347e44934457f1a36669300 | <ide><path>packages/ember-runtime/lib/mixins/mutable_array.js
<ide> Ember.MutableArray = Ember.Mixin.create(Ember.Array, Ember.MutableEnumerable,
<ide>
<ide> /**
<ide> Remove an object at the specified index using the replace() primitive
<del> method. You can pass either a single index, a start and a length or an
<del> index set.
<add> method. You can pass either a single index, or a start and a length.
<ide>
<del> If you pass a single index or a start and length that is beyond the
<add> If you pass a start and length that is beyond the
<ide> length this method will throw an Ember.OUT_OF_RANGE_EXCEPTION
<ide>
<del> @param {Number|Ember.IndexSet} start index, start of range, or index set
<add> @param {Number} start index, start of range
<ide> @param {Number} len length of passing range
<ide> @returns {Object} receiver
<ide> */
<ide><path>packages/ember-runtime/lib/mixins/mutable_enumerable.js
<ide> Ember.MutableEnumerable = Ember.Mixin.create(Ember.Enumerable,
<ide> already present in the collection. If the object is present, this method
<ide> has no effect.
<ide>
<del> If the passed object is of a type not supported by the receiver (for
<del> example if you pass an object to an IndexSet) then this method should
<del> raise an exception.
<add> If the passed object is of a type not supported by the receiver
<add> then this method should raise an exception.
<ide>
<ide> @param {Object} object
<ide> The object to add to the enumerable.
<ide> Ember.MutableEnumerable = Ember.Mixin.create(Ember.Enumerable,
<ide> object is in present in the collection. If the object is not present,
<ide> this method has no effect.
<ide>
<del> If the passed object is of a type not supported by the receiver (for
<del> example if you pass an object to an IndexSet) then this method should
<del> raise an exception.
<add> If the passed object is of a type not supported by the receiver
<add> then this method should raise an exception.
<ide>
<ide> @param {Object} object
<ide> The object to remove from the enumerable. | 2 |
Javascript | Javascript | fix broken ellipses | 47ef34ec9dd5d2684348a25c35263ed8a18ccb0e | <ide><path>src/extras/core/Path.js
<ide> THREE.Path.prototype.ellipse = function ( aX, aY, xRadius, yRadius,
<ide> THREE.Path.prototype.absellipse = function ( aX, aY, xRadius, yRadius,
<ide> aStartAngle, aEndAngle, aClockwise, aRotation ) {
<ide>
<del> var args = Array.prototype.slice.call( arguments );
<add> var args = [
<add> aX, aY,
<add> xRadius, yRadius,
<add> aStartAngle, aEndAngle,
<add> aClockwise,
<add> aRotation || 0 // aRotation is optional.
<add> ];
<ide> var curve = new THREE.EllipseCurve( aX, aY, xRadius, yRadius,
<ide> aStartAngle, aEndAngle, aClockwise, aRotation );
<ide> this.curves.push( curve );
<ide> THREE.Path.prototype.getPoints = function( divisions, closedPath ) {
<ide> yRadius = args[ 3 ],
<ide> aStartAngle = args[ 4 ], aEndAngle = args[ 5 ],
<ide> aClockwise = !! args[ 6 ],
<del> aRotation = args[ 7 ] || 0;
<add> aRotation = args[ 7 ];
<ide>
<ide>
<ide> var deltaAngle = aEndAngle - aStartAngle;
<ide> THREE.Path.prototype.getPoints = function( divisions, closedPath ) {
<ide>
<ide> if ( aRotation !== 0 ) {
<ide>
<add> var x = tx, y = ty;
<add>
<ide> // Rotate the point about the center of the ellipse.
<del> tx = ( tx - aX ) * cos - ( ty - aY ) * sin + aX;
<del> ty = ( tx - aX ) * sin + ( ty - aY ) * cos + aY;
<add> tx = ( x - aX ) * cos - ( y - aY ) * sin + aX;
<add> ty = ( x - aX ) * sin + ( y - aY ) * cos + aY;
<ide>
<ide> }
<ide>
<ide><path>src/extras/curves/EllipseCurve.js
<ide> THREE.EllipseCurve.prototype.getPoint = function ( t ) {
<ide> var cos = Math.cos( this.aRotation );
<ide> var sin = Math.sin( this.aRotation );
<ide>
<add> var tx = x, ty = y;
<add>
<ide> // Rotate the point about the center of the ellipse.
<del> x = ( x - this.aX ) * cos - ( y - this.aY ) * sin + this.aX;
<del> y = ( x - this.aX ) * sin + ( y - this.aY ) * cos + this.aY;
<add> x = ( tx - this.aX ) * cos - ( ty - this.aY ) * sin + this.aX;
<add> y = ( tx - this.aX ) * sin + ( ty - this.aY ) * cos + this.aY;
<ide>
<ide> }
<ide> | 2 |
Javascript | Javascript | add optionaltarget argument to color#gethsl() | 4e36b7b64c86dd1457cf584b6b367dc2bb3d947f | <ide><path>src/math/Color.js
<ide> THREE.Color.prototype = {
<ide>
<ide> },
<ide>
<del> getHSL: function () {
<add> getHSL: function ( optionalTarget ) {
<ide>
<ide> // h,s,l ranges are in 0.0 - 1.0
<ide>
<add> var hsl = optionalTarget || { h: 0, s: 0, l: 0 };
<add>
<ide> var r = this.r, g = this.g, b = this.b;
<ide>
<ide> var max = Math.max( r, g, b );
<ide> THREE.Color.prototype = {
<ide>
<ide> }
<ide>
<del> return {
<del> h: hue,
<del> s: saturation,
<del> l: lightness
<del> };
<add> hsl.h = hue;
<add> hsl.s = saturation;
<add> hsl.l = lightness;
<add>
<add> return hsl;
<ide>
<ide> },
<ide> | 1 |
PHP | PHP | use sha256 consistently | 07959ee08e8cabe0f1b8ac99d1ae9bf784441730 | <ide><path>src/Auth/DigestAuthenticate.php
<ide> protected function validNonce($nonce)
<ide> if ($expires < microtime(true)) {
<ide> return false;
<ide> }
<del> $check = hash_hmac('sha1', $expires . ':' . $this->getConfig('secret'), $this->getConfig('secret'));
<add> $check = hash_hmac('sha256', $expires . ':' . $this->getConfig('secret'), $this->getConfig('secret'));
<ide>
<ide> return hash_equals($check, $checksum);
<ide> }
<ide><path>tests/TestCase/Auth/DigestAuthenticateTest.php
<ide> protected function generateNonce($secret = null, $expires = 300, $time = null)
<ide> $secret = $secret ?: Configure::read('Security.salt');
<ide> $time = $time ?: microtime(true);
<ide> $expiryTime = $time + $expires;
<del> $signatureValue = hash_hmac('sha1', $expiryTime . ':' . $secret, $secret);
<add> $signatureValue = hash_hmac('sha256', $expiryTime . ':' . $secret, $secret);
<ide> $nonceValue = $expiryTime . ':' . $signatureValue;
<ide>
<ide> return base64_encode($nonceValue); | 2 |
Text | Text | translate the description in french | 87c97f21ac72d78210b479809874b15cac4e2b6e | <ide><path>threejs/lessons/fr/threejs-textures.md
<del>Title: Three.js Textures
<del>Description: Using textures in three.js
<add>Title: Les textures dans Three.js
<add>Description: Comment utiliser les textures dans Three.js
<ide> TOC: Textures
<ide>
<ide> Cet article fait partie d'une série consacrée à Three.js. | 1 |
Mixed | Go | add logpath to docker inspect | 06c01b02f5d8149407028324e751df5c0a92fd14 | <ide><path>daemon/container.go
<ide> type Container struct {
<ide> ResolvConfPath string
<ide> HostnamePath string
<ide> HostsPath string
<add> LogPath string
<ide> Name string
<ide> Driver string
<ide> ExecDriver string
<ide> func (container *Container) setupWorkingDirectory() error {
<ide>
<ide> func (container *Container) startLoggingToDisk() error {
<ide> // Setup logging of stdout and stderr to disk
<del> pth, err := container.logPath("json")
<add> logPath, err := container.logPath("json")
<ide> if err != nil {
<ide> return err
<ide> }
<add> container.LogPath = logPath
<ide>
<del> if err := container.daemon.LogToDisk(container.stdout, pth, "stdout"); err != nil {
<add> if err := container.daemon.LogToDisk(container.stdout, container.LogPath, "stdout"); err != nil {
<ide> return err
<ide> }
<ide>
<del> if err := container.daemon.LogToDisk(container.stderr, pth, "stderr"); err != nil {
<add> if err := container.daemon.LogToDisk(container.stderr, container.LogPath, "stderr"); err != nil {
<ide> return err
<ide> }
<ide>
<ide><path>daemon/inspect.go
<ide> func (daemon *Daemon) ContainerInspect(job *engine.Job) engine.Status {
<ide> out.Set("ResolvConfPath", container.ResolvConfPath)
<ide> out.Set("HostnamePath", container.HostnamePath)
<ide> out.Set("HostsPath", container.HostsPath)
<add> out.Set("LogPath", container.LogPath)
<ide> out.SetJson("Name", container.Name)
<ide> out.SetInt("RestartCount", container.RestartCount)
<ide> out.Set("Driver", container.Driver)
<ide><path>docs/man/docker-inspect.1.md
<ide> To get information on a container use it's ID or instance name:
<ide> "ResolvConfPath": "/etc/resolv.conf",
<ide> "HostnamePath": "/var/lib/docker/containers/1eb5fabf5a03807136561b3c00adcd2992b535d624d5e18b6cdc6a6844d9767b/hostname",
<ide> "HostsPath": "/var/lib/docker/containers/1eb5fabf5a03807136561b3c00adcd2992b535d624d5e18b6cdc6a6844d9767b/hosts",
<add> "LogPath": "/var/lib/docker/containers/1eb5fabf5a03807136561b3c00adcd2992b535d624d5e18b6cdc6a6844d9767b/1eb5fabf5a03807136561b3c00adcd2992b535d624d5e18b6cdc6a6844d9767b-json.log",
<ide> "Name": "/ecstatic_ptolemy",
<ide> "Driver": "devicemapper",
<ide> "ExecDriver": "native-0.1",
<ide><path>docs/sources/reference/api/docker_remote_api_v1.18.md
<ide> Return low-level information on the container `id`
<ide> },
<ide> "HostnamePath": "/var/lib/docker/containers/ba033ac4401106a3b513bc9d639eee123ad78ca3616b921167cd74b20e25ed39/hostname",
<ide> "HostsPath": "/var/lib/docker/containers/ba033ac4401106a3b513bc9d639eee123ad78ca3616b921167cd74b20e25ed39/hosts",
<add> "LogPath": "/var/lib/docker/containers/1eb5fabf5a03807136561b3c00adcd2992b535d624d5e18b6cdc6a6844d9767b/1eb5fabf5a03807136561b3c00adcd2992b535d624d5e18b6cdc6a6844d9767b-json.log",
<ide> "Id": "ba033ac4401106a3b513bc9d639eee123ad78ca3616b921167cd74b20e25ed39",
<ide> "Image": "04c5d3b7b0656168630d3ba35d8889bd0e9caafcaeb3004d2bfbc47e7c5d35d2",
<ide> "MountLabel": "",
<ide> Return low-level information about the exec command `id`.
<ide> "ResolvConfPath" : "/var/lib/docker/containers/8f177a186b977fb451136e0fdf182abff5599a08b3c7f6ef0d36a55aaf89634c/resolv.conf",
<ide> "HostnamePath" : "/var/lib/docker/containers/8f177a186b977fb451136e0fdf182abff5599a08b3c7f6ef0d36a55aaf89634c/hostname",
<ide> "HostsPath" : "/var/lib/docker/containers/8f177a186b977fb451136e0fdf182abff5599a08b3c7f6ef0d36a55aaf89634c/hosts",
<add> "LogPath": "/var/lib/docker/containers/1eb5fabf5a03807136561b3c00adcd2992b535d624d5e18b6cdc6a6844d9767b/1eb5fabf5a03807136561b3c00adcd2992b535d624d5e18b6cdc6a6844d9767b-json.log",
<ide> "Name" : "/test",
<ide> "Driver" : "aufs",
<ide> "ExecDriver" : "native-0.2",
<ide><path>docs/sources/reference/commandline/cli.md
<ide> straightforward manner.
<ide>
<ide> $ sudo docker inspect --format='{{.NetworkSettings.MacAddress}}' $INSTANCE_ID
<ide>
<add>**Get an instance's log path:**
<add>
<add> $ sudo docker inspect --format='{{.LogPath}}' $INSTANCE_ID
<add>
<ide> **List All Port Bindings:**
<ide>
<ide> One can loop over arrays and maps in the results to produce simple text
<ide><path>integration-cli/docker_api_inspect_test.go
<ide> func TestInspectApiContainerResponse(t *testing.T) {
<ide> t.Fatalf("unable to unmarshal body for %s version: %v", testVersion, err)
<ide> }
<ide>
<del> keys := []string{"State", "Created", "Path", "Args", "Config", "Image", "NetworkSettings", "ResolvConfPath", "HostnamePath", "HostsPath", "Name", "Driver", "ExecDriver", "MountLabel", "ProcessLabel", "Volumes", "VolumesRW"}
<add> keys := []string{"State", "Created", "Path", "Args", "Config", "Image", "NetworkSettings", "ResolvConfPath", "HostnamePath", "HostsPath", "LogPath", "Name", "Driver", "ExecDriver", "MountLabel", "ProcessLabel", "Volumes", "VolumesRW"}
<ide>
<ide> if testVersion == "v1.11" {
<ide> keys = append(keys, "ID") | 6 |
Ruby | Ruby | use bintray package naming | e773d0c3b915edfc490c0c6f57f2f1cead88c64e | <ide><path>Library/Homebrew/cmd/pull.rb
<ide> def pull
<ide> bintray_key = ENV["BINTRAY_KEY"]
<ide>
<ide> if bintray_user && bintray_key
<del> bintray_repo = Bintray.repository(tap_name)
<add> repo = Bintray.repository(tap_name)
<ide> changed_formulae.each do |f|
<ide> next unless `git show --oneline --no-patch` =~ /: add .+ bottle./
<ide> ohai "Publishing on Bintray:"
<add> package = Bintray.package f.name
<ide> version = Bintray.version(f.bottle.url)
<ide> curl "--silent", "--fail",
<ide> "-u#{bintray_user}:#{bintray_key}", "-X", "POST",
<del> "https://api.bintray.com/content/homebrew/#{bintray_repo}/#{f.name}/#{version}/publish"
<add> "https://api.bintray.com/content/homebrew/#{repo}/#{package}/#{version}/publish"
<ide> puts
<ide> end
<ide> end | 1 |
Javascript | Javascript | improve assert message | b6a87dbe13c85a3441ce63fd16d5e2bba085250b | <ide><path>test/parallel/test-cluster-worker-destroy.js
<ide> if (cluster.isMaster) {
<ide> });
<ide>
<ide> const w = cluster.worker.disconnect();
<del> assert.strictEqual(w, cluster.worker, 'did not return a reference');
<add> assert.strictEqual(w, cluster.worker);
<ide> } else {
<ide> // Call destroy when worker is not disconnected yet
<ide> cluster.worker.destroy(); | 1 |
PHP | PHP | use settimeout() instead of writing a key twice | 71829612d73ba94da343eeabce55d4c997a3e97d | <ide><path>src/Cache/Engine/RedisEngine.php
<ide> public function add($key, $value)
<ide> $value = serialize($value);
<ide> }
<ide>
<del> // setnx() doesn't have an expiry option, so overwrite the key with one
<add> // setnx() doesn't have an expiry option, so follow up with an expiry
<ide> if ($this->_Redis->setnx($key, $value)) {
<del> return $this->_Redis->setex($key, $duration, $value);
<add> return $this->_Redis->setTimeout($key, $duration);
<ide> }
<ide>
<ide> return false; | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.