- Sort Score
- Num 10 results
- Language All
Results 1 - 10 of 56 for Decimal (0.04 seconds)
-
tests/test_jsonable_encoder.py
def test_decimal_encoder_float(): data = {"value": Decimal(1.23)} assert jsonable_encoder(data) == {"value": 1.23} def test_decimal_encoder_int(): data = {"value": Decimal(2)} assert jsonable_encoder(data) == {"value": 2} def test_decimal_encoder_nan(): data = {"value": Decimal("NaN")} assert isnan(jsonable_encoder(data)["value"])
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Tue Feb 17 09:59:14 GMT 2026 - 9.2K bytes - Click Count (0) -
tests/test_multi_body_errors.py
from decimal import Decimal from dirty_equals import IsOneOf from fastapi import FastAPI from fastapi.testclient import TestClient from inline_snapshot import snapshot from pydantic import BaseModel, condecimal app = FastAPI() class Item(BaseModel): name: str age: condecimal(gt=Decimal(0.0)) # type: ignore @app.post("/items/") def save_item_no_body(item: list[Item]): return {"item": item}
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Sun Feb 08 10:18:38 GMT 2026 - 6.7K bytes - Click Count (0) -
fastapi/encoders.py
Our Id type is a prime example of this. >>> decimal_encoder(Decimal("1.0")) 1.0 >>> decimal_encoder(Decimal("1")) 1 >>> decimal_encoder(Decimal("NaN")) nan """ exponent = dec_value.as_tuple().exponent if isinstance(exponent, int) and exponent >= 0: return int(dec_value) else: return float(dec_value)Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Sun Mar 15 11:44:39 GMT 2026 - 10.9K bytes - Click Count (0) -
fastapi/param_functions.py
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Sun Mar 15 11:44:39 GMT 2026 - 68K bytes - Click Count (0) -
docs/en/docs/tutorial/extra-data-types.md
* `bytes`: * Standard Python `bytes`. * In requests and responses will be treated as `str`. * The generated schema will specify that it's a `str` with `binary` "format". * `Decimal`: * Standard Python `Decimal`. * In requests and responses, handled the same as a `float`. * You can check all the valid Pydantic data types here: [Pydantic data types](https://docs.pydantic.dev/latest/usage/types/types/).Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Thu Mar 05 18:13:19 GMT 2026 - 2.6K bytes - Click Count (0) -
docs/zh-hant/docs/tutorial/extra-data-types.md
* 生成的 schema 會指定 `set` 的值為唯一(使用 JSON Schema 的 `uniqueItems`)。 * `bytes`: * 標準的 Python `bytes`。 * 在請求與回應中會被當作 `str` 處理。 * 生成的 schema 會指定其為 `str`,且 "format" 為 `binary`。 * `Decimal`: * 標準的 Python `Decimal`。 * 在請求與回應中,與 `float` 的處理方式相同。 * 你可以在此查閱所有可用的 Pydantic 資料型別:[Pydantic 資料型別](https://docs.pydantic.dev/latest/usage/types/types/)。 ## 範例 { #example } 以下是一個帶有參數、使用上述部分型別的 *路徑操作 (path operation)* 範例。Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Fri Mar 20 17:05:38 GMT 2026 - 2.6K bytes - Click Count (0) -
docs/zh/docs/tutorial/extra-data-types.md
* 产生的模式将指定那些 `set` 的值是唯一的 (使用 JSON Schema 的 `uniqueItems`)。 * `bytes`: * 标准的 Python `bytes`。 * 在请求和响应中被当作 `str` 处理。 * 生成的模式将指定这个 `str` 是 `binary` "格式"。 * `Decimal`: * 标准的 Python `Decimal`。 * 在请求和响应中被当做 `float` 一样处理。 * 您可以在这里检查所有有效的 Pydantic 数据类型: [Pydantic data types](https://docs.pydantic.dev/latest/usage/types/types/)。 ## 例子 { #example } 下面是一个*路径操作*的示例,其中的参数使用了上面的一些类型。Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Fri Mar 20 17:06:37 GMT 2026 - 2.5K bytes - Click Count (0) -
src/main/java/org/codelibs/core/convert/NumberConversionUtil.java
return Character.toString(symbol.getGroupingSeparator()); } /** * Returns the separator for decimal numbers. * * @param locale * Locale * @return Separator for decimal numbers */ public static String findDecimalSeparator(final Locale locale) { final DecimalFormatSymbols symbol = getDecimalFormatSymbols(locale);
Created: Fri Apr 03 20:58:12 GMT 2026 - Last Modified: Thu Jul 31 08:16:49 GMT 2025 - 5.6K bytes - Click Count (0) -
src/main/java/org/codelibs/core/text/DecimalFormatUtil.java
return normalize(s, LocaleUtil.getDefault()); } /** * Normalizes the string representation of a number by removing grouping separators * and representing the decimal point with '.'. * * @param s * A string representing a number * @param locale * The locale. Must not be {@literal null}. * @return The normalized string */
Created: Fri Apr 03 20:58:12 GMT 2026 - Last Modified: Thu Jul 31 08:16:49 GMT 2025 - 2.5K bytes - Click Count (0) -
src/test/java/jcifs/smb1/smb1/Trans2FindNext2Test.java
/** * Ensures toString contains key fields with expected formatting. */ @Test void testToStringContainsExpectedFields() { // Given int sid = 4660; // 0x1234, printed as decimal int resumeKey = 0x01020304; // shows only low 4 hex digits per implementation String name = "name"; Trans2FindNext2 next = new Trans2FindNext2(sid, resumeKey, name); // WhenCreated: Sun Apr 05 00:10:12 GMT 2026 - Last Modified: Thu Aug 14 05:31:44 GMT 2025 - 6.9K bytes - Click Count (0)