Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 331 for dict (0.23 sec)

  1. docs/de/docs/tutorial/extra-models.md

    ```Python
    UserInDB(
        username = user_dict["username"],
        password = user_dict["password"],
        email = user_dict["email"],
        full_name = user_dict["full_name"],
    )
    ```
    
    #### Ein Pydantic-Modell aus den Inhalten eines anderen erstellen.
    
    Da wir in obigem Beispiel `user_dict` mittels `user_in.dict()` erzeugt haben, ist dieser Code:
    
    ```Python
    user_dict = user_in.dict()
    UserInDB(**user_dict)
    ```
    
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Sat Mar 30 20:26:47 GMT 2024
    - 8.7K bytes
    - Viewed (0)
  2. docs/ja/docs/tutorial/extra-models.md

    そして呼び出すと:
    
    ```Python
    print(user_dict)
    ```
    
    以下のようなPythonの`dict`を得ることができます:
    
    ```Python
    {
        'username': 'john',
        'password': 'secret',
        'email': '******@****.***',
        'full_name': None,
    }
    ```
    
    #### `dict`の展開
    
    `user_dict`のような`dict`を受け取り、それを`**user_dict`を持つ関数(またはクラス)に渡すと、Pythonはそれを「展開」します。これは`user_dict`のキーと値を直接キー・バリューの引数として渡します。
    
    そこで上述の`user_dict`の続きを以下のように書くと:
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Mon Jan 15 15:36:32 GMT 2024
    - 6.7K bytes
    - Viewed (0)
  3. docs/zh/docs/tutorial/extra-models.md

    )
    ```
    
    或更精准,直接把可能会用到的内容与 `user_dict` 一起使用:
    
    ```Python
    UserInDB(
        username = user_dict["username"],
        password = user_dict["password"],
        email = user_dict["email"],
        full_name = user_dict["full_name"],
    )
    ```
    
    #### 用其它模型中的内容生成 Pydantic 模型
    
    上例中 ,从 `user_in.dict()` 中得到了 `user_dict`,下面的代码:
    
    ```Python
    user_dict = user_in.dict()
    UserInDB(**user_dict)
    ```
    
    等效于:
    
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Mon Apr 01 01:15:53 GMT 2024
    - 6.7K bytes
    - Viewed (0)
  4. fastapi/openapi/utils.py

        if license_info:
            info["license"] = license_info
        output: Dict[str, Any] = {"openapi": openapi_version, "info": info}
        if servers:
            output["servers"] = servers
        components: Dict[str, Dict[str, Any]] = {}
        paths: Dict[str, Dict[str, Any]] = {}
        webhook_paths: Dict[str, Dict[str, Any]] = {}
        operation_ids: Set[str] = set()
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Apr 18 19:40:57 GMT 2024
    - 21.8K bytes
    - Viewed (0)
  5. fastapi/types.py

    import types
    from enum import Enum
    from typing import Any, Callable, Dict, Set, Type, TypeVar, Union
    
    from pydantic import BaseModel
    
    DecoratedCallable = TypeVar("DecoratedCallable", bound=Callable[..., Any])
    UnionType = getattr(types, "UnionType", Union)
    ModelNameMap = Dict[Union[Type[BaseModel], Type[Enum]], str]
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Tue Dec 12 00:29:03 GMT 2023
    - 383 bytes
    - Viewed (0)
  6. docs/de/docs/advanced/additional-responses.md

    In diesen Fällen können Sie die Python-Technik zum „Entpacken“ eines `dict`s mit `**dict_to_unpack` verwenden:
    
    ```Python
    old_dict = {
        "old key": "old value",
        "second old key": "second old value",
    }
    new_dict = {**old_dict, "new key": "new value"}
    ```
    
    Hier wird `new_dict` alle Schlüssel-Wert-Paare von `old_dict` plus das neue Schlüssel-Wert-Paar enthalten:
    
    ```Python
    {
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Sat Mar 30 20:19:26 GMT 2024
    - 9.6K bytes
    - Viewed (0)
  7. docs/en/docs/advanced/additional-responses.md

    For those cases, you can use the Python technique of "unpacking" a `dict` with `**dict_to_unpack`:
    
    ```Python
    old_dict = {
        "old key": "old value",
        "second old key": "second old value",
    }
    new_dict = {**old_dict, "new key": "new value"}
    ```
    
    Here, `new_dict` will contain all the key-value pairs from `old_dict` plus the new key-value pair:
    
    ```Python
    {
        "old key": "old value",
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Jan 11 16:31:18 GMT 2024
    - 8.8K bytes
    - Viewed (0)
  8. docs/zh/docs/advanced/async-sql-databases.md

    ### 关于 `{**note.dict(), "id": last_record_id}`
    
    `note` 是 Pydantic `Note` 对象:
    
    `note.dict()` 返回包含如下数据的**字典**:
    
    ```Python
    {
        "text": "Some note",
        "completed": False,
    }
    ```
    
    但它不包含 `id` 字段。
    
    因此要新建一个包含 `note.dict()` 键值对的**字典**:
    
    ```Python
    {**note.dict()}
    ```
    
    `**note.dict()` 直接**解包**键值对, 因此,`{**note.dict()}` 是 `note.dict()` 的副本。
    
    Plain Text
    - Registered: Sun Mar 31 07:19:09 GMT 2024
    - Last Modified: Sat Mar 30 22:44:40 GMT 2024
    - 4.3K bytes
    - Viewed (0)
  9. scripts/docs.py

            # removed or not.
        else:
            dist_path = site_path / lang
            shutil.rmtree(dist_path, ignore_errors=True)
        current_dir = os.getcwd()
        os.chdir(lang_path)
        shutil.rmtree(build_site_dist_path, ignore_errors=True)
        subprocess.run(["mkdocs", "build", "--site-dir", build_site_dist_path], check=True)
        shutil.copytree(build_site_dist_path, dist_path, dirs_exist_ok=True)
        os.chdir(current_dir)
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Mon Jan 22 19:26:14 GMT 2024
    - 10.9K bytes
    - Viewed (1)
  10. docs/pt/docs/python-types.md

    * A variável `items_s` é um `set`, e cada um de seus itens é do tipo `bytes`.
    
    #### `Dict`
    
    Para definir um `dict`, você passa 2 parâmetros de tipo, separados por vírgulas.
    
    O primeiro parâmetro de tipo é para as chaves do `dict`.
    
    O segundo parâmetro de tipo é para os valores do `dict`:
    
    ```Python hl_lines="1 4"
    {!../../../docs_src/python_types/tutorial008.py!}
    ```
    
    Isso significa que:
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri Mar 22 01:42:11 GMT 2024
    - 9.6K bytes
    - Viewed (0)
Back to top