Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 13 for Galaxy (0.08 sec)

  1. docs_src/query_params_str_validations/tutorial015_an_py310.py

    import random
    from typing import Annotated
    
    from fastapi import FastAPI
    from pydantic import AfterValidator
    
    app = FastAPI()
    
    data = {
        "isbn-9781529046137": "The Hitchhiker's Guide to the Galaxy",
        "imdb-tt0371724": "The Hitchhiker's Guide to the Galaxy",
        "isbn-9781439512982": "Isaac Asimov: The Complete Stories, Vol. 2",
    }
    
    
    def check_valid_id(id: str):
        if not id.startswith(("isbn-", "imdb-")):
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sat Mar 01 22:02:35 UTC 2025
    - 768 bytes
    - Viewed (0)
  2. docs_src/query_params_str_validations/tutorial015_an_py39.py

    from typing import Annotated, Union
    
    from fastapi import FastAPI
    from pydantic import AfterValidator
    
    app = FastAPI()
    
    data = {
        "isbn-9781529046137": "The Hitchhiker's Guide to the Galaxy",
        "imdb-tt0371724": "The Hitchhiker's Guide to the Galaxy",
        "isbn-9781439512982": "Isaac Asimov: The Complete Stories, Vol. 2",
    }
    
    
    def check_valid_id(id: str):
        if not id.startswith(("isbn-", "imdb-")):
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sat Mar 01 22:02:35 UTC 2025
    - 781 bytes
    - Viewed (0)
  3. tests/test_tutorial/test_query_params_str_validations/test_tutorial015.py

        response = client.get("/items?id=isbn-9781529046137")
        assert response.status_code == 200, response.text
        assert response.json() == {
            "id": "isbn-9781529046137",
            "name": "The Hitchhiker's Guide to the Galaxy",
        }
    
    
    def test_get_item_does_not_exist(client: TestClient):
        response = client.get("/items?id=isbn-nope")
        assert response.status_code == 200, response.text
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sat Dec 20 15:55:38 UTC 2025
    - 5K bytes
    - Viewed (0)
  4. docs/en/docs/tutorial/query-params-str-validations.md

    Then with `random.choice()` we can get a **random value** from the list, so, we get a tuple with `(id, name)`. It will be something like `("imdb-tt0371724", "The Hitchhiker's Guide to the Galaxy")`.
    
    Then we **assign those two values** of the tuple to the variables `id` and `name`.
    
    So, if the user didn't provide an item ID, they will still receive a random suggestion.
    
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sat Dec 20 15:55:38 UTC 2025
    - 16.7K bytes
    - Viewed (0)
  5. docs/uk/docs/tutorial/query-params-str-validations.md

    Потім, використовуючи `random.choice()`, ми можемо отримати випадкове значення зі списку, тобто отримуємо кортеж із `(id, name)`. Це може бути щось на зразок `("imdb-tt0371724", "The Hitchhiker's Guide to the Galaxy")`.
    
    Далі ми **присвоюємо ці два значення** кортежу змінним `id` і `name`.
    
    Тож, якщо користувач не вказав ID елемента, він все одно отримає випадкову рекомендацію.
    
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Fri May 30 14:17:24 UTC 2025
    - 26.1K bytes
    - Viewed (0)
  6. docs/ru/docs/tutorial/query-params-str-validations.md

    Затем с `random.choice()` можно получить **случайное значение** из списка — то есть кортеж вида `(id, name)`. Это будет что‑то вроде `("imdb-tt0371724", "The Hitchhiker's Guide to the Galaxy")`.
    
    После этого мы **распаковываем** эти два значения кортежа в переменные `id` и `name`.
    
    Так что, если пользователь не передал ID элемента, он всё равно получит случайную рекомендацию.
    
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 17 20:41:43 UTC 2025
    - 26.2K bytes
    - Viewed (0)
  7. docs/de/docs/tutorial/query-params-str-validations.md

    Dann können wir mit `random.choice()` einen **zufälligen Wert** aus der Liste erhalten, also bekommen wir ein Tuple mit `(id, name)`. Es wird etwas wie `("imdb-tt0371724", "The Hitchhiker's Guide to the Galaxy")` sein.
    
    Dann **weisen wir diese beiden Werte** des Tupels den Variablen `id` und `name` zu.
    
    Wenn der Benutzer also keine Artikel-ID bereitgestellt hat, erhält er trotzdem einen zufälligen Vorschlag.
    
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 24 10:28:19 UTC 2025
    - 19.1K bytes
    - Viewed (0)
  8. docs/pt/docs/tutorial/query-params-str-validations.md

    Em seguida, com `random.choice()` podemos obter um **valor aleatório** da lista, então obtemos uma tupla com `(id, name)`. Será algo como `("imdb-tt0371724", "The Hitchhiker's Guide to the Galaxy")`.
    
    Depois **atribuímos esses dois valores** da tupla às variáveis `id` e `name`.
    
    Assim, se o usuário não fornecer um ID de item, ele ainda receberá uma sugestão aleatória.
    
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 17 20:41:43 UTC 2025
    - 18.2K bytes
    - Viewed (0)
  9. docs/es/docs/tutorial/query-params-str-validations.md

    Luego con `random.choice()` podemos obtener un **valor aleatorio** de la lista, así que obtenemos una tupla con `(id, name)`. Será algo como `("imdb-tt0371724", "The Hitchhiker's Guide to the Galaxy")`.
    
    Luego **asignamos esos dos valores** de la tupla a las variables `id` y `name`.
    
    Así, si el usuario no proporcionó un ID de ítem, aún recibirá una sugerencia aleatoria.
    
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 17 20:41:43 UTC 2025
    - 18.4K bytes
    - Viewed (0)
  10. tests/migrate_test.go

    	type UserMigrateColumn struct {
    		ID       uint
    		Name     string
    		Salary   float64
    		Birthday time.Time `gorm:"precision:4"`
    	}
    
    	DB.Migrator().DropTable(&UserMigrateColumn{})
    
    	DB.AutoMigrate(&UserMigrateColumn{})
    
    	type UserMigrateColumn2 struct {
    		ID                  uint
    		Name                string    `gorm:"size:128"`
    		Salary              float64   `gorm:"precision:2"`
    Registered: Sun Dec 28 09:35:17 UTC 2025
    - Last Modified: Wed Aug 20 04:51:17 UTC 2025
    - 65.2K bytes
    - Viewed (0)
Back to top