From: NiJia Lin Date: Tue, 4 May 2021 09:02:19 +0000 (+0800) Subject: 🌐 Fix Chinese translation of Tutorial - Query Parameters, remove obsolete content... X-Git-Tag: 0.64.0~10 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=b3f139c0d92ae50fa75c7b06257f76b41cef703d;p=thirdparty%2Ffastapi%2Ffastapi.git 🌐 Fix Chinese translation of Tutorial - Query Parameters, remove obsolete content (#3051) --- diff --git a/docs/zh/docs/tutorial/query-params.md b/docs/zh/docs/tutorial/query-params.md index 36f17beb96..b1668a2d25 100644 --- a/docs/zh/docs/tutorial/query-params.md +++ b/docs/zh/docs/tutorial/query-params.md @@ -191,36 +191,3 @@ http://127.0.0.1:8000/items/foo-item?needy=sooooneedy !!! tip 你还可以像在 [路径参数](path-params.md#predefined-values){.internal-link target=_blank} 中那样使用 `Enum`。 - -## Optional 类型声明 - -!!! warning - 这可能是一个比较高级的使用场景。 - - 您也可以跳过它。 - -如果你正在使用 `mypy`,它可能会对如下的类型声明进行警告: - -```Python -limit: int = None -``` - -提示类似以下错误: - -``` -Incompatible types in assignment (expression has type "None", variable has type "int") -``` - -在这种情况下,你可以使用 `Optional` 来告诉 `mypy` 该值可以为 `None`,例如: - -```Python -from typing import Optional - -limit: Optional[int] = None -``` - -在一个*路径操作*中,看起来会是: - -```Python hl_lines="9" -{!../../../docs_src/query_params/tutorial007.py!} -```