Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 24 for age (0.12 sec)

  1. docs_src/graphql/tutorial001.py

    import strawberry
    from fastapi import FastAPI
    from strawberry.asgi import GraphQL
    
    
    @strawberry.type
    class User:
        name: str
        age: int
    
    
    @strawberry.type
    class Query:
        @strawberry.field
        def user(self) -> User:
            return User(name="Patrick", age=100)
    
    
    schema = strawberry.Schema(query=Query)
    
    
    graphql_app = GraphQL(schema)
    
    app = FastAPI()
    app.add_route("/graphql", graphql_app)
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Sun Oct 03 18:00:28 GMT 2021
    - 446 bytes
    - Viewed (0)
  2. tests/test_union_inherited_body.py

    class Item(BaseModel):
        name: Optional[str] = None
    
    
    class ExtendedItem(Item):
        age: int
    
    
    @app.post("/items/")
    def save_union_different_body(item: Union[ExtendedItem, Item]):
        return {"item": item}
    
    
    client = TestClient(app)
    
    
    def test_post_extended_item():
        response = client.post("/items/", json={"name": "Foo", "age": 5})
        assert response.status_code == 200, response.text
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri Jul 07 17:12:13 GMT 2023
    - 5.2K bytes
    - Viewed (0)
  3. docs/ru/docs/python-types.md

    ```
    
    Поскольку редактор знает типы переменных, вы получаете не только дополнение, но и проверки ошибок:
    
    <img src="/img/python-types/image04.png">
    
    Теперь вы знаете, что вам нужно исправить, преобразовав `age` в строку с `str(age)`:
    
    ```Python hl_lines="2"
    {!../../../docs_src/python_types/tutorial004.py!}
    ```
    
    ## Объявление типов
    
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Fri Mar 22 01:42:11 GMT 2024
    - 14.6K bytes
    - Viewed (0)
  4. docs/uk/docs/python-types.md

    Оскільки редактор знає типи змінних, ви не тільки отримаєте автозаповнення, ви також отримаєте перевірку помилок:
    
    <img src="/img/python-types/image04.png">
    
    Тепер ви знаєте, щоб виправити це, вам потрібно перетворити `age` у строку з допомогою `str(age)`:
    
    ```Python hl_lines="2"
    {!../../../docs_src/python_types/tutorial004.py!}
    ```
    
    ## Оголошення типів
    
    Щойно ви побачили основне місце для оголошення анотацій типу. Як параметри функції.
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Thu Apr 18 19:53:19 GMT 2024
    - 19.7K bytes
    - Viewed (0)
  5. docs/ko/docs/tutorial/cors.md

    * `allow_credentials` - 교차-출처 요청시 쿠키 지원 여부를 설정합니다. 기본값은 `False` 입니다. 또한 해당 항목을 허용할 경우 `allow_origins` 는 `['*']` 로 설정할 수 없으며, 출처를 반드시 특정해야 합니다.
    * `expose_headers` - 브라우저에 접근할 수 있어야 하는 모든 응답 헤더를 가리킵니다. 기본값은 `[]` 입니다.
    * `max_age` - 브라우저가 CORS 응답을 캐시에 저장하는 최대 시간을 초 단위로 설정합니다. 기본값은 `600` 입니다.
    
    미들웨어는 두가지 특정한 종류의 HTTP 요청에 응답합니다...
    
    ### CORS 사전 요청
    
    `Origin` 및 `Access-Control-Request-Method` 헤더와 함께 전송하는 모든 `OPTIONS` 요청입니다.
    
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Sat Jan 07 14:21:23 GMT 2023
    - 5.8K bytes
    - Viewed (0)
  6. tests/test_response_model_include_exclude.py

    from pydantic import BaseModel
    
    
    class Model1(BaseModel):
        foo: str
        bar: str
    
    
    class Model2(BaseModel):
        ref: Model1
        baz: str
    
    
    class Model3(BaseModel):
        name: str
        age: int
        ref2: Model2
    
    
    app = FastAPI()
    
    
    @app.get(
        "/simple_include",
        response_model=Model2,
        response_model_include={"baz": ..., "ref": {"foo"}},
    )
    def simple_include():
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Mon Jul 19 19:14:58 GMT 2021
    - 4K bytes
    - Viewed (0)
  7. tests/test_multi_body_errors.py

                        "loc": ["body", 0, "age"],
                        "msg": "ensure this value is greater than 0",
                        "type": "value_error.number.not_gt",
                    }
                ]
            }
        )
    
    
    def test_put_incorrect_body_multiple():
        response = client.post("/items/", json=[{"age": "five"}, {"age": "six"}])
        assert response.status_code == 422, response.text
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Thu Apr 18 19:40:57 GMT 2024
    - 7.6K bytes
    - Viewed (0)
  8. docs_src/python_types/tutorial012.py

    from typing import Optional
    
    from pydantic import BaseModel
    
    
    class User(BaseModel):
        name: str
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Sat May 14 11:59:59 GMT 2022
    - 122 bytes
    - Viewed (0)
  9. docs/en/docs/python-types.md

    ```
    
    Because the editor knows the types of the variables, you don't only get completion, you also get error checks:
    
    <img src="/img/python-types/image04.png">
    
    Now you know that you have to fix it, convert `age` to a string with `str(age)`:
    
    ```Python hl_lines="2"
    {!../../../docs_src/python_types/tutorial004.py!}
    ```
    
    ## Declaring types
    
    You just saw the main place to declare type hints. As function parameters.
    
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Thu Apr 18 19:53:19 GMT 2024
    - 17K bytes
    - Viewed (0)
  10. docs/ru/docs/tutorial/cors.md

    * `expose_headers` - Указывает любые заголовки ответа, которые должны быть доступны браузеру. По умолчанию равно `[]`.
    * `max_age` - Устанавливает максимальное время в секундах, в течение которого браузер кэширует CORS-ответы. По умолчанию равно `600`.
    
    `CORSMiddleware` отвечает на два типа HTTP-запросов...
    
    ### CORS-запросы с предварительной проверкой
    
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Thu Jun 22 14:29:56 GMT 2023
    - 8.3K bytes
    - Viewed (0)
Back to top