Search Options

Display Count
Sort
Preferred Language
Advanced Search

Results 581 - 590 of 1,083 for str (0.3 seconds)

  1. docs/zh-hant/docs/tutorial/path-params.md

    如果你有一個接收「路徑參數」的「路徑操作」,但你希望可用的「路徑參數」值是預先定義好的,你可以使用標準的 Python <abbr title="Enumeration - 列舉">`Enum`</abbr>。
    
    ### 建立 `Enum` 類別 { #create-an-enum-class }
    
    匯入 `Enum` 並建立一個同時繼承自 `str` 與 `Enum` 的子類別。
    
    繼承自 `str` 之後,API 文件就能知道這些值的型別必須是 `string`,並能正確地呈現。
    
    然後建立具有固定值的類別屬性,這些就是可用的有效值:
    
    {* ../../docs_src/path_params/tutorial005_py310.py hl[1,6:9] *}
    
    /// tip
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Fri Mar 20 17:05:38 GMT 2026
    - 8.4K bytes
    - Click Count (0)
  2. src/main/java/org/codelibs/fess/opensearch/user/allcommon/EsAbstractBehavior.java

                return ((List<?>) value).stream().map(v -> v.toString()).toArray(n -> new String[n]);
            }
            String str = DfTypeUtil.toString(value);
            if (str == null) {
                return null;
            }
            return new String[] { str };
        }
    
        protected LocalDateTime toLocalDateTime(Object value) {
            return DfTypeUtil.toLocalDateTime(value);
        }
    
    Created: Tue Mar 31 13:07:34 GMT 2026
    - Last Modified: Thu Nov 27 07:01:25 GMT 2025
    - 26.4K bytes
    - Click Count (0)
  3. src/test/java/jcifs/internal/smb1/com/SmbComWriteResponseTest.java

            byte[] buf = new byte[12];
            buf[0] = 0x00;
            buf[1] = 0x02; // count = 512 in little-endian
            resp.readParameterWordsWireFormat(buf, 0);
            String str = resp.toString();
            assertTrue(str.contains("count=512"), "toString should include numeric count");
        }
    
        @Test
        public void testReturnFromReadParameterWordsWireFormatIs8() {
            // ensure the method returns 8 as claimed
    Created: Sun Apr 05 00:10:12 GMT 2026
    - Last Modified: Thu Aug 14 05:31:44 GMT 2025
    - 2.1K bytes
    - Click Count (0)
  4. statement.go

    }
    
    // QuoteTo write quoted value to writer
    func (stmt *Statement) QuoteTo(writer clause.Writer, field interface{}) {
    	write := func(raw bool, str string) {
    		if raw {
    			writer.WriteString(str)
    		} else {
    			stmt.DB.Dialector.QuoteTo(writer, str)
    		}
    	}
    
    	switch v := field.(type) {
    	case clause.Table:
    		if v.Name == clause.CurrentTable {
    			if stmt.TableExpr != nil {
    				stmt.TableExpr.Build(stmt)
    Created: Sun Apr 05 09:35:12 GMT 2026
    - Last Modified: Fri Sep 12 04:33:27 GMT 2025
    - 20.9K bytes
    - Click Count (0)
  5. docs/zh/docs/tutorial/body.md

    {* ../../docs_src/body/tutorial004_py310.py hl[16] *}
    
    函数参数按如下规则进行识别:
    
    * 如果该参数也在**路径**中声明了,它就是路径参数。
    * 如果该参数是(`int`、`float`、`str`、`bool` 等)**单一类型**,它会被当作**查询**参数。
    * 如果该参数的类型声明为 **Pydantic 模型**,它会被当作请求**体**。
    
    /// note | 注意
    
    FastAPI 会根据默认值 `= None` 知道 `q` 的值不是必填的。
    
    `str | None` 并不是 FastAPI 用来判断是否必填的依据;是否必填由是否有默认值 `= None` 决定。
    
    但添加这些类型注解可以让你的编辑器提供更好的支持并检测错误。
    
    ///
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Fri Mar 20 17:06:37 GMT 2026
    - 5.9K bytes
    - Click Count (0)
  6. docs/zh/docs/features.md

    编写带有类型标注的标准 Python:
    
    ```Python
    from datetime import date
    
    from pydantic import BaseModel
    
    # 将变量声明为 str
    # 并在函数内获得编辑器支持
    def main(user_id: str):
        return user_id
    
    
    # 一个 Pydantic 模型
    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 = {
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Fri Mar 20 17:06:37 GMT 2026
    - 8.7K bytes
    - Click Count (0)
  7. tests/test_forms_single_param.py

    from typing import Annotated
    
    from fastapi import FastAPI, Form
    from fastapi.testclient import TestClient
    from inline_snapshot import snapshot
    
    app = FastAPI()
    
    
    @app.post("/form/")
    def post_form(username: Annotated[str, Form()]):
        return username
    
    
    client = TestClient(app)
    
    
    def test_single_form_field():
        response = client.post("/form/", data={"username": "Rick"})
        assert response.status_code == 200, response.text
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Sun Feb 08 10:18:38 GMT 2026
    - 4.1K bytes
    - Click Count (0)
  8. src/test/java/jcifs/smb/SmbOperationExceptionTest.java

            // When
            String str = exception.toString();
    
            // Then
            assertNotNull(str);
            assertTrue(str.contains("SmbOperationException"));
            assertTrue(str.contains("ACCESS_DENIED"));
            assertTrue(str.contains("AUTHENTICATION"));
            assertTrue(str.contains("retryable=false"));
            assertTrue(str.contains("attempt=1"));
    Created: Sun Apr 05 00:10:12 GMT 2026
    - Last Modified: Sat Aug 30 05:58:03 GMT 2025
    - 16.1K bytes
    - Click Count (0)
  9. tests/test_additional_properties.py

    from fastapi import FastAPI
    from fastapi.testclient import TestClient
    from inline_snapshot import snapshot
    from pydantic import BaseModel
    
    app = FastAPI()
    
    
    class Items(BaseModel):
        items: dict[str, int]
    
    
    @app.post("/foo")
    def foo(items: Items):
        return items.items
    
    
    client = TestClient(app)
    
    
    def test_additional_properties_post():
        response = client.post("/foo", json={"items": {"foo": 1, "bar": 2}})
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Sun Feb 08 10:18:38 GMT 2026
    - 4.1K bytes
    - Click Count (0)
  10. docs/zh-hant/docs/advanced/security/oauth2-scopes.md

    接著用 Pydantic 模型驗證這些資料(捕捉 `ValidationError` 例外),若在讀取 JWT token 或用 Pydantic 驗證資料時出錯,就丟出先前建立的 `HTTPException`。
    
    為此,我們更新了 Pydantic 模型 `TokenData`,加入新屬性 `scopes`。
    
    透過 Pydantic 驗證資料,我們可以確保,例如,scopes 正好是 `list` 的 `str`,而 `username` 是 `str`。
    
    否則若是 `dict` 或其他型別,可能在後續某處使應用壞掉,造成安全風險。
    
    我們也會確認該 `username` 對應的使用者是否存在,否則同樣丟出之前建立的例外。
    
    {* ../../docs_src/security/tutorial005_an_py310.py hl[47,117:129] *}
    
    ## 驗證 `scopes` { #verify-the-scopes }
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Fri Mar 20 17:05:38 GMT 2026
    - 12.7K bytes
    - Click Count (0)
Back to Top