From 00595afa95b7f2aa9bf5d81419dc85e2c5be6984 Mon Sep 17 00:00:00 2001 From: peefy Date: Wed, 28 Aug 2024 17:05:51 +0800 Subject: [PATCH] docs: add full v0.10 builtin and system module documents Signed-off-by: peefy --- docs/reference/model/builtin.md | 14 ++++++++++++++ docs/reference/model/datetime.md | 10 ++++++++-- .../current/reference/model/builtin.md | 14 ++++++++++++++ .../current/reference/model/datetime.md | 10 ++++++++-- .../version-0.10/reference/model/builtin.md | 14 ++++++++++++++ .../version-0.10/reference/model/datetime.md | 10 ++++++++-- .../version-0.10/reference/model/builtin.md | 14 ++++++++++++++ .../version-0.10/reference/model/datetime.md | 10 ++++++++-- 8 files changed, 88 insertions(+), 8 deletions(-) diff --git a/docs/reference/model/builtin.md b/docs/reference/model/builtin.md index 4bb347666..4ff98e022 100644 --- a/docs/reference/model/builtin.md +++ b/docs/reference/model/builtin.md @@ -119,6 +119,20 @@ print(isunique(['abc', "a${'bc'}"])) # False It should be noted that integers and floating-point numbers ignore the type difference and judge whether the values are equal. +## isnullish + +Return `True` if the input value is `None` or `Undefined`, and `False` otherwise. + +```python +isnullish(None) # True +isnullish(Undefined) # True +isnullish(0) # False +isnullish([]) # False +isnullish({}) # False +isnullish([None]) # False +isnullish([Undefined]) # False +``` + ## len `len(x: str | [any] | {:}) -> int` diff --git a/docs/reference/model/datetime.md b/docs/reference/model/datetime.md index 526b036c9..2448be455 100644 --- a/docs/reference/model/datetime.md +++ b/docs/reference/model/datetime.md @@ -20,12 +20,18 @@ Return the `%Y-%m-%d %H:%M:%S` format date. ## now -`now() -> str` +`now(format: str = "%a %b %d %H:%M:%S %Y") -> str` -Return the local time. e.g. `'Sat Jun 06 16:26:11 1998'` +Return the local time format. e.g. 'Sat Jun 06 16:26:11 1998' or format the combined date and time per the specified format string, and the default date format is `%a %b %d %H:%M:%S %Y`. ## today `today() -> str` Return the `%Y-%m-%d %H:%M:%S.%{ticks}` format date. + +## validate + +`validate(date: str, format: str) -> bool` + +Validate whether the provided date string matches the specified format. diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/current/reference/model/builtin.md b/i18n/zh-CN/docusaurus-plugin-content-docs/current/reference/model/builtin.md index 440851744..46d2f18b3 100644 --- a/i18n/zh-CN/docusaurus-plugin-content-docs/current/reference/model/builtin.md +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/current/reference/model/builtin.md @@ -113,6 +113,20 @@ print(isunique(['abc', "abc"])) # False print(isunique(['abc', "a${'bc'}"])) # False ``` +## isnullish + +如果输入值是 `None` 或 `Undefined`,则返回 `True`;否则返回 `False`。 + +```python +isnullish(None) # True +isnullish(Undefined) # True +isnullish(0) # False +isnullish([]) # False +isnullish({}) # False +isnullish([None]) # False +isnullish([Undefined]) # False +``` + 需要注意的是整数和浮点数会忽略类型差异,根据值是否相等判断。 ## len diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/current/reference/model/datetime.md b/i18n/zh-CN/docusaurus-plugin-content-docs/current/reference/model/datetime.md index dd252b860..67a5b48f1 100644 --- a/i18n/zh-CN/docusaurus-plugin-content-docs/current/reference/model/datetime.md +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/current/reference/model/datetime.md @@ -20,12 +20,18 @@ weight: 100 ## now -`now() -> str` +`now(format: str = "%a %b %d %H:%M:%S %Y") -> str` -返回当地时间,例如 `'Sat Jun 06 16:26:11 1998'`。 +返回本地时间格式。例如:`Sat Jun 06 16:26:11 1998`,或者根据指定的格式字符串格式化组合的日期和时间,默认日期格式为 `%a %b %d %H:%M:%S %Y`。 ## today `today() -> str` 返回以 `%Y-%m-%d %H:%M:%S.%{ticks}` 格式表示的时间。 + +## validate + +`validate(date: str, format: str) -> bool` + +验证提供的日期字符串是否与指定格式匹配。 diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/version-0.10/reference/model/builtin.md b/i18n/zh-CN/docusaurus-plugin-content-docs/version-0.10/reference/model/builtin.md index 440851744..46d2f18b3 100644 --- a/i18n/zh-CN/docusaurus-plugin-content-docs/version-0.10/reference/model/builtin.md +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/version-0.10/reference/model/builtin.md @@ -113,6 +113,20 @@ print(isunique(['abc', "abc"])) # False print(isunique(['abc', "a${'bc'}"])) # False ``` +## isnullish + +如果输入值是 `None` 或 `Undefined`,则返回 `True`;否则返回 `False`。 + +```python +isnullish(None) # True +isnullish(Undefined) # True +isnullish(0) # False +isnullish([]) # False +isnullish({}) # False +isnullish([None]) # False +isnullish([Undefined]) # False +``` + 需要注意的是整数和浮点数会忽略类型差异,根据值是否相等判断。 ## len diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/version-0.10/reference/model/datetime.md b/i18n/zh-CN/docusaurus-plugin-content-docs/version-0.10/reference/model/datetime.md index dd252b860..67a5b48f1 100644 --- a/i18n/zh-CN/docusaurus-plugin-content-docs/version-0.10/reference/model/datetime.md +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/version-0.10/reference/model/datetime.md @@ -20,12 +20,18 @@ weight: 100 ## now -`now() -> str` +`now(format: str = "%a %b %d %H:%M:%S %Y") -> str` -返回当地时间,例如 `'Sat Jun 06 16:26:11 1998'`。 +返回本地时间格式。例如:`Sat Jun 06 16:26:11 1998`,或者根据指定的格式字符串格式化组合的日期和时间,默认日期格式为 `%a %b %d %H:%M:%S %Y`。 ## today `today() -> str` 返回以 `%Y-%m-%d %H:%M:%S.%{ticks}` 格式表示的时间。 + +## validate + +`validate(date: str, format: str) -> bool` + +验证提供的日期字符串是否与指定格式匹配。 diff --git a/versioned_docs/version-0.10/reference/model/builtin.md b/versioned_docs/version-0.10/reference/model/builtin.md index 4bb347666..4ff98e022 100644 --- a/versioned_docs/version-0.10/reference/model/builtin.md +++ b/versioned_docs/version-0.10/reference/model/builtin.md @@ -119,6 +119,20 @@ print(isunique(['abc', "a${'bc'}"])) # False It should be noted that integers and floating-point numbers ignore the type difference and judge whether the values are equal. +## isnullish + +Return `True` if the input value is `None` or `Undefined`, and `False` otherwise. + +```python +isnullish(None) # True +isnullish(Undefined) # True +isnullish(0) # False +isnullish([]) # False +isnullish({}) # False +isnullish([None]) # False +isnullish([Undefined]) # False +``` + ## len `len(x: str | [any] | {:}) -> int` diff --git a/versioned_docs/version-0.10/reference/model/datetime.md b/versioned_docs/version-0.10/reference/model/datetime.md index 526b036c9..2448be455 100644 --- a/versioned_docs/version-0.10/reference/model/datetime.md +++ b/versioned_docs/version-0.10/reference/model/datetime.md @@ -20,12 +20,18 @@ Return the `%Y-%m-%d %H:%M:%S` format date. ## now -`now() -> str` +`now(format: str = "%a %b %d %H:%M:%S %Y") -> str` -Return the local time. e.g. `'Sat Jun 06 16:26:11 1998'` +Return the local time format. e.g. 'Sat Jun 06 16:26:11 1998' or format the combined date and time per the specified format string, and the default date format is `%a %b %d %H:%M:%S %Y`. ## today `today() -> str` Return the `%Y-%m-%d %H:%M:%S.%{ticks}` format date. + +## validate + +`validate(date: str, format: str) -> bool` + +Validate whether the provided date string matches the specified format.