Search Options

Display Count
Sort
Preferred Language
Advanced Search

Results 641 - 650 of 1,083 for str (0.02 seconds)

  1. docs/zh-hant/docs/features.md

    如果你寫帶有 Python 型別的程式碼:
    
    ```Python
    from datetime import date
    
    from pydantic import BaseModel
    
    # 宣告一個變數為 string
    # 並在函式中獲得 editor support
    def main(user_id: str):
        return user_id
    
    
    # 宣告一個 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")
    
    second_user_data = {
        "id": 4,
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Fri Mar 20 17:05:38 GMT 2026
    - 9.2K bytes
    - Click Count (0)
  2. tests/test_regex_deprecated_params.py

    from .utils import needs_py310
    
    
    def get_client():
        app = FastAPI()
        with pytest.warns(FastAPIDeprecationWarning):
    
            @app.get("/items/")
            async def read_items(
                q: Annotated[str | None, Query(regex="^fixedquery$")] = None,
            ):
                if q:
                    return f"Hello {q}"
                else:
                    return "Hello World"
    
        client = TestClient(app)
        return client
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Sun Feb 08 10:18:38 GMT 2026
    - 5.1K bytes
    - Click Count (0)
  3. docs/ja/docs/tutorial/body-updates.md

    項目を更新するには[HTTPの`PUT`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/PUT)操作を使用することができます。
    
    `jsonable_encoder`を用いて、入力データをJSONとして保存できるデータに変換することができます(例:NoSQLデータベース)。例えば、`datetime`を`str`に変換します。
    
    {* ../../docs_src/body_updates/tutorial001_py310.py hl[28:33] *}
    
    `PUT`は、既存のデータを置き換えるべきデータを受け取るために使用されます。
    
    ### 置換についての注意 { #warning-about-replacing }
    
    つまり、`PUT`を使用して以下のボディで項目`bar`を更新したい場合は:
    
    ```Python
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Fri Mar 20 14:07:17 GMT 2026
    - 5.2K bytes
    - Click Count (0)
  4. tests/test_regex_deprecated_body.py

    from .utils import needs_py310
    
    
    def get_client():
        app = FastAPI()
        with pytest.warns(FastAPIDeprecationWarning):
    
            @app.post("/items/")
            async def read_items(
                q: Annotated[str | None, Form(regex="^fixedquery$")] = None,
            ):
                if q:
                    return f"Hello {q}"
                else:
                    return "Hello World"
    
        client = TestClient(app)
        return client
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Wed Feb 04 14:34:02 GMT 2026
    - 5.4K bytes
    - Click Count (0)
  5. src/bufio/bufio_test.go

    	b.ReportAllocs()
    	str := strings.Repeat("x", 16<<10)
    	for i := 0; i < b.N; i++ {
    		br := NewReader(strings.NewReader(str))
    		n, err := io.Copy(io.Discard, br)
    		if err != nil {
    			b.Fatal(err)
    		}
    		if n != int64(len(str)) {
    			b.Fatal("wrong length")
    		}
    	}
    }
    
    func BenchmarkWriterEmpty(b *testing.B) {
    	b.ReportAllocs()
    	str := strings.Repeat("x", 1<<10)
    Created: Tue Apr 07 11:13:11 GMT 2026
    - Last Modified: Fri Feb 07 01:08:54 GMT 2025
    - 51.6K bytes
    - Click Count (0)
  6. tensorflow/c/eager/c_api_experimental.cc

          tensorflow::unwrap(ctx)->HostCPUParsedName());
      auto str = tensorflow::DeviceNameUtils::ParsedNameToString(address_space);
      void* data = tensorflow::port::Malloc(str.length());
      str.copy(static_cast<char*>(data), str.length(), 0);
      buf->data = data;
      buf->length = str.length();
      buf->data_deallocator = [](void* data, size_t length) {
        tensorflow::port::Free(data);
      };
    }
    Created: Tue Apr 07 12:39:13 GMT 2026
    - Last Modified: Sat Oct 12 05:11:17 GMT 2024
    - 35.9K bytes
    - Click Count (0)
  7. docs/ja/docs/advanced/settings.md

    したがって、その下の関数は引数の組み合わせごとに一度だけ実行されます。そして、その各引数の組み合わせで返された値は、まったく同じ引数の組み合わせで呼び出されたときに何度でも再利用されます。
    
    たとえば、次のような関数があるとします:
    
    ```Python
    @lru_cache
    def say_hi(name: str, salutation: str = "Ms."):
        return f"Hello {salutation} {name}"
    ```
    
    プログラムは次のように実行されます:
    
    ```mermaid
    sequenceDiagram
    
    participant code as Code
    participant function as say_hi()
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Fri Mar 20 14:07:17 GMT 2026
    - 12.7K bytes
    - Click Count (0)
  8. cmd/utils.go

    	}
    	// compare first to rest
    	for _, str := range strs[1:] {
    		xfixl := len(xfix)
    		strl := len(str)
    		// short-circuit empty strings
    		if xfixl == 0 || strl == 0 {
    			return ""
    		}
    		// maximum possible length
    		maxl := min(strl, xfixl)
    		// compare letters
    		if pre {
    			// prefix, iterate left to right
    			for i := range maxl {
    				if xfix[i] != str[i] {
    					xfix = xfix[:i]
    					break
    				}
    Created: Sun Apr 05 19:28:12 GMT 2026
    - Last Modified: Sun Sep 28 20:59:21 GMT 2025
    - 33K bytes
    - Click Count (0)
  9. docs/zh/docs/advanced/settings.md

    `@lru_cache` 会修改它所装饰的函数,使其返回第一次返回的相同值,而不是每次都重新计算并执行函数代码。
    
    因此,下面的函数会针对每个参数组合执行一次。然后,当以完全相同的参数组合调用该函数时,将重复使用该参数组合先前返回的值。
    
    例如,如果你有一个函数:
    
    ```Python
    @lru_cache
    def say_hi(name: str, salutation: str = "Ms."):
        return f"Hello {salutation} {name}"
    ```
    
    你的程序可能会像这样执行:
    
    ```mermaid
    sequenceDiagram
    
    participant code as Code
    participant function as say_hi()
    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)
  10. docs/zh/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:06:37 GMT 2026
    - 6K bytes
    - Click Count (0)
Back to Top