Skip to content

Commit e26470c

Browse files
authored
docs: s/Null/None/, s/nullable/optional/ to align with Python terms (#868)
1 parent 857cad8 commit e26470c

File tree

3 files changed

+16
-16
lines changed

3 files changed

+16
-16
lines changed

docs/docs/core/data_types.mdx

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -200,22 +200,22 @@ Currently, the following types are key types
200200
- *Date*
201201
- *Struct* with all fields being key types (using `@dataclass(frozen=True)` or `NamedTuple`)
202202

203-
## *Null* Values
203+
## *None* Values
204204

205-
CocoIndex supports *Null* values. A *Null* value represents the absence of data or an unknown value, distinct from empty strings, zero numbers, or false boolean values.
205+
CocoIndex supports *None* values. A *None* value represents the absence of data or an unknown value, distinct from empty strings, zero numbers, or false boolean values.
206206

207-
### Nullable Type
207+
### Optional Type
208208

209-
For any data (e.g. a field of a *Struct*, an argument or return value of a CocoIndex function), if it is nullable, it means its value can be *Null*.
210-
We use a `?` suffix to indicate a nullable type, e.g. *Str?*, *Person?*.
209+
For any data (e.g. a field of a *Struct*, an argument or return value of a CocoIndex function), if it is optional, it means its value can be *None*.
210+
We use *Optional[T]* to indicate an optional type, e.g. *Optional[Str]*, *Optional[Person]*.
211211

212-
In Python, *Null* is represented as `None`, so a nullable type can be represented by `T | None` or `typing.Optional[T]`.
212+
In Python, *None* is represented as `None`, so an optional type can be represented by `T | None` or `typing.Optional[T]`.
213213

214-
### *Null* propagating on CocoIndex functions
214+
### *None* propagating on CocoIndex functions
215215

216-
A function may specify whether each input argument is nullable or not.
217-
Non-nullable argument means the function needs a known value for the argument to work.
218-
However, it doesn't forbid the argument to be *Null* at runtime.
219-
When a non-nullable argument receives a *Null* value, the function execution is skipped and the result is *Null*.
216+
A function may specify whether each input argument is optional or not.
217+
Non-optional argument means the function needs a known value for the argument to work.
218+
However, it doesn't forbid the argument to be *None* at runtime.
219+
When a non-optional argument receives a *None* value, the function execution is skipped and the result is *None*.
220220

221-
For example, for [`SplitRecursively` function](/docs/ops/functions#splitrecursively), the `text` and `chunk_size` arguments are not nullable. If the input value of either of them is *Null*, the function will return *Null*.
221+
For example, for [`SplitRecursively` function](/docs/ops/functions#splitrecursively), the `text` and `chunk_size` arguments are not optional. If the input value of either of them is *None*, the function will return *None*.

docs/docs/core/settings.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,11 +81,11 @@ If not set, all flows are in a default unnamed namespace.
8181

8282
*Environment variable* for `Settings.database.url`: `COCOINDEX_DATABASE_URL`
8383

84-
* `user` (type: `str | None`, default: `None`): The username for the Postgres database. If not provided, username will come from `url`.
84+
* `user` (type: `Optional[str]`, default: `None`): The username for the Postgres database. If not provided, username will come from `url`.
8585

8686
*Environment variable* for `Settings.database.user`: `COCOINDEX_DATABASE_USER`
8787

88-
* `password` (type: `str | None`, default: `None`): The password for the Postgres database. If not provided, password will come from `url`.
88+
* `password` (type: `Optional[str]`, default: `None`): The password for the Postgres database. If not provided, password will come from `url`.
8989

9090
*Environment variable* for `Settings.database.password`: `COCOINDEX_DATABASE_PASSWORD`
9191

docs/docs/ops/functions.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ description: CocoIndex Built-in Functions
1212
Input data:
1313

1414
* `text` (*Str*): The source text to parse.
15-
* `language` (*Str?*, default: `"json"`): The language of the source text. Only `json` is supported now.
15+
* `language` (*Optional[Str]*, default: `"json"`): The language of the source text. Only `json` is supported now.
1616

1717
Return: *Json*, the parsed JSON object.
1818

@@ -48,7 +48,7 @@ Input data:
4848

4949
:::
5050

51-
* `chunk_overlap` (*Int64?*, default: *Null*): The maximum overlap size between adjacent chunks, in bytes.
51+
* `chunk_overlap` (*Optional[Int64]*, default: *None*): The maximum overlap size between adjacent chunks, in bytes.
5252
* `language` (*Str*, default: `""`): The language of the document.
5353
Can be a language name (e.g. `Python`, `Javascript`, `Markdown`) or a file extension (e.g. `.py`, `.js`, `.md`).
5454

0 commit comments

Comments
 (0)