Search Options

Display Count
Sort
Preferred Language
Advanced Search

Results 781 - 790 of 1,096 for sltr (0.02 seconds)

  1. docs/zh-hant/docs/tutorial/dependencies/classes-as-dependencies.md

    ```
    
    那它就是一個「callable」。
    
    ## 以類別作為相依性 { #classes-as-dependencies_1 }
    
    你可能已經注意到,建立一個 Python 類別的實例時,你用的語法也是一樣的。
    
    例如:
    
    ```Python
    class Cat:
        def __init__(self, name: str):
            self.name = name
    
    
    fluffy = Cat(name="Mr Fluffy")
    ```
    
    在這個例子中,`fluffy` 是 `Cat` 類別的一個實例。
    
    而要建立 `fluffy`,你其實是在「呼叫」`Cat`。
    
    所以,Python 類別本身也是一種 **callable**。
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Sat Feb 14 08:15:26 GMT 2026
    - 6.7K bytes
    - Click Count (0)
  2. docs/zh-hant/docs/tutorial/path-params-numeric-validations.md

    路徑參數一定是必填,因為它必須是路徑的一部分。即使你將其宣告為 `None` 或設定預設值,也不會有任何影響,它仍然是必填。
    
    ///
    
    ## 依需求調整參數順序 { #order-the-parameters-as-you-need }
    
    /// tip
    
    如果你使用 `Annotated`,這點大概沒那麼重要或必要。
    
    ///
    
    假設你想把查詢參數 `q` 宣告為必要的 `str`。
    
    而你不需要為該參數宣告其他內容,所以其實不需要用 `Query`。
    
    但你仍需要為路徑參數 `item_id` 使用 `Path`,而且基於某些理由你不想用 `Annotated`。
    
    如果你把有「預設值」的參數放在沒有「預設值」的參數之前,Python 會抱怨。
    
    但你可以調整它們的順序,先放沒有預設值(查詢參數 `q`)的參數。
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Fri Mar 20 17:05:38 GMT 2026
    - 5.8K bytes
    - Click Count (0)
  3. docs/zh/docs/advanced/custom-response.md

    ///
    
    ### `Response` { #response }
    
    其他全部的响应都继承自主类 `Response`。
    
    你可以直接返回它。
    
    `Response` 类接受如下参数:
    
    * `content` - 一个 `str` 或者 `bytes`。
    * `status_code` - 一个 `int` 类型的 HTTP 状态码。
    * `headers` - 一个由字符串组成的 `dict`。
    * `media_type` - 一个给出媒体类型的 `str`,比如 `"text/html"`。
    
    FastAPI(实际上是 Starlette)将自动包含 Content-Length 的头。它还将包含一个基于 `media_type` 的 Content-Type 头,并为文本类型附加一个字符集。
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Fri Mar 20 17:06:37 GMT 2026
    - 10.4K bytes
    - Click Count (0)
  4. guava-tests/test/com/google/common/collect/ImmutableSetMultimapTest.java

      }
    
      public void testFlatteningToImmutableSetMultimap() {
        Collector<String, ?, ImmutableSetMultimap<Character, Character>> collector =
            flatteningToImmutableSetMultimap(
                str -> str.charAt(0), str -> asList(str.substring(1).toCharArray()).stream());
        BiPredicate<Multimap<?, ?>, Multimap<?, ?>> equivalence =
            Equivalence.equals()
    Created: Fri Apr 03 12:43:13 GMT 2026
    - Last Modified: Fri Mar 13 13:01:07 GMT 2026
    - 28.9K bytes
    - Click Count (0)
  5. docs/fr/docs/tutorial/response-model.md

    {* ../../docs_src/response_model/tutorial004_py310.py hl[9,11:12] *}
    
    * `description: Union[str, None] = None` (ou `str | None = None` en Python 3.10) a une valeur par défaut `None`.
    * `tax: float = 10.5` a une valeur par défaut `10.5`.
    * `tags: List[str] = []` a une valeur par défaut de liste vide : `[]`.
    
    mais vous pourriez vouloir les omettre du résultat si elles n'ont pas été réellement stockées.
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Thu Mar 19 18:37:13 GMT 2026
    - 18.1K bytes
    - Click Count (0)
  6. docs/ja/docs/features.md

    型を使った標準的な Python を記述します:
    
    ```Python
    from datetime import date
    
    from pydantic import BaseModel
    
    # Declare a variable as a str
    # and get editor support inside the function
    def main(user_id: str):
        return user_id
    
    
    # A Pydantic model
    class User(BaseModel):
        id: int
        name: str
        joined: date
    ```
    
    これは次のように使えます:
    
    ```Python
    my_user: User = User(id=3, name="John Doe", joined="2018-07-19")
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Fri Mar 20 14:07:17 GMT 2026
    - 11.6K bytes
    - Click Count (0)
  7. README.md

    from pydantic import BaseModel
    
    app = FastAPI()
    
    
    class Item(BaseModel):
        name: str
        price: float
        is_offer: bool | None = None
    
    
    @app.get("/")
    def read_root():
        return {"Hello": "World"}
    
    
    @app.get("/items/{item_id}")
    def read_item(item_id: int, q: str | None = None):
        return {"item_id": item_id, "q": q}
    
    
    @app.put("/items/{item_id}")
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Sat Mar 07 09:29:03 GMT 2026
    - 24.3K bytes
    - Click Count (0)
  8. docs/zh-hant/docs/index.md

    from pydantic import BaseModel
    
    app = FastAPI()
    
    
    class Item(BaseModel):
        name: str
        price: float
        is_offer: bool | None = None
    
    
    @app.get("/")
    def read_root():
        return {"Hello": "World"}
    
    
    @app.get("/items/{item_id}")
    def read_item(item_id: int, q: str | None = None):
        return {"item_id": item_id, "q": q}
    
    
    @app.put("/items/{item_id}")
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Fri Mar 20 17:05:38 GMT 2026
    - 20.8K bytes
    - Click Count (0)
  9. docs/es/docs/tutorial/security/first-steps.md

    Si no ve un header `Authorization`, o el valor no tiene un token `Bearer `, responderá directamente con un error de código de estado 401 (`UNAUTHORIZED`).
    
    Ni siquiera tienes que verificar si el token existe para devolver un error. Puedes estar seguro de que si tu función se ejecuta, tendrá un `str` en ese token.
    
    Puedes probarlo ya en los docs interactivos:
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Thu Mar 19 18:15:55 GMT 2026
    - 8.8K bytes
    - Click Count (0)
  10. docs/pt/docs/tutorial/security/first-steps.md

    Se não houver um header `Authorization`, ou se o valor não tiver um token `Bearer `, ele responderá diretamente com um erro de status 401 (`UNAUTHORIZED`).
    
    Você nem precisa verificar se o token existe para retornar um erro. Você pode ter certeza de que, se sua função for executada, ela terá uma `str` nesse token.
    
    Você já pode experimentar na documentação interativa:
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Thu Mar 19 18:20:43 GMT 2026
    - 8.7K bytes
    - Click Count (0)
Back to Top