Skip to content

Commit

Permalink
Merge pull request #119 from Peefy/fix-faq-sample-code
Browse files Browse the repository at this point in the history
fix: faq 4 sample code
  • Loading branch information
Peefy authored Jul 20, 2023
2 parents b166791 + 6dadb4d commit 6d0272d
Show file tree
Hide file tree
Showing 12 changed files with 60 additions and 24 deletions.
7 changes: 5 additions & 2 deletions docs/user_docs/support/faq-kcl.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,8 @@ schema Person:
We can use the union operator `|` or the dict unpacking operator `**` to add elements into a dict, and we can use `in` and `not in` operators to determine whether the dict variable contains a certain key.

```python
_left = {key = {key1 = "value1"}, intKey = 1} # Note: `=` denotes override the value.
_right = {key = {key2 = "value2"}, intKey = 2}
_left = {key: {key1 = "value1"}, intKey = 1} # Note: `=` denotes override the value.
_right = {key: {key2 = "value2"}, intKey = 2}
dataUnion = _left | _right # {"key": {"key1": "value1", "key2": "value2"}, "intKey": 2}
dataUnpack = {**_left, **_right} # {"key": {"key1": "value1", "key2": "value2"}, "intKey": 2}
```
Expand All @@ -110,9 +110,12 @@ dataUnion:
key:
key1: value1
key2: value2
intKey: 2
dataUnpack:
key:
key1: value1
key2: value2
intKey: 2
```
It is also possible to add key-value pair to a dict using the `string interpolation` or the string `format` method.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,8 @@ schema Person:
可以使用 union 运算符 `|`, 或者 dict 解包运算符 `**` 来向 dict 中添加一个元素,并且可以使用 `in`,`not in` 等关键字判断 dict 变量当中是否包含某一个键值

```python
_left = {key = {key1 = "value1"}, intKey = 1} # 注意使用 = 表示覆盖
_right = {key = {key2 = "value2"}, intKey = 2}
_left = {key: {key1 = "value1"}, intKey = 1} # 注意使用 = 表示覆盖
_right = {key: {key2 = "value2"}, intKey = 2}
dataUnion = _left | _right # {"key": {"key1": "value1", "key2": "value2"}, "intKey": 2}
dataUnpack = {**_left, **_right} # {"key": {"key1": "value1", "key2": "value2"}, "intKey": 2}
```
Expand All @@ -112,9 +112,12 @@ dataUnion:
key:
key1: value1
key2: value2
intKey: 2
dataUnpack:
key:
key1: value1
key2: value2
intKey: 2
```
此外还可以使用 `字符串插值` 或者字符串 `format` 成员函数特性向 kcl dict 添加变量键值对
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,8 @@ schema Person:
可以使用 union 运算符 `|`, 或者 dict 解包运算符 `**` 来向 dict 中添加一个元素,并且可以使用 `in`,`not in` 等关键字判断 dict 变量当中是否包含某一个键值

```python
_left = {key = {key1 = "value1"}, intKey = 1} # 注意使用 = 表示覆盖
_right = {key = {key2 = "value2"}, intKey = 2}
_left = {key: {key1 = "value1"}, intKey = 1} # 注意使用 = 表示覆盖
_right = {key: {key2 = "value2"}, intKey = 2}
dataUnion = _left | _right # {"key": {"key1": "value1", "key2": "value2"}, "intKey": 2}
dataUnpack = {**_left, **_right} # {"key": {"key1": "value1", "key2": "value2"}, "intKey": 2}
```
Expand All @@ -112,9 +112,12 @@ dataUnion:
key:
key1: value1
key2: value2
intKey: 2
dataUnpack:
key:
key1: value1
key2: value2
intKey: 2
```
此外还可以使用 `字符串插值` 或者字符串 `format` 成员函数特性向 kcl dict 添加变量键值对
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,8 @@ schema Person:
可以使用 union 运算符 `|`, 或者 dict 解包运算符 `**` 来向 dict 中添加一个元素,并且可以使用 `in`,`not in` 等关键字判断 dict 变量当中是否包含某一个键值

```python
_left = {key = {key1 = "value1"}, intKey = 1} # 注意使用 = 表示覆盖
_right = {key = {key2 = "value2"}, intKey = 2}
_left = {key: {key1 = "value1"}, intKey = 1} # 注意使用 = 表示覆盖
_right = {key: {key2 = "value2"}, intKey = 2}
dataUnion = _left | _right # {"key": {"key1": "value1", "key2": "value2"}, "intKey": 2}
dataUnpack = {**_left, **_right} # {"key": {"key1": "value1", "key2": "value2"}, "intKey": 2}
```
Expand All @@ -112,9 +112,12 @@ dataUnion:
key:
key1: value1
key2: value2
intKey: 2
dataUnpack:
key:
key1: value1
key2: value2
intKey: 2
```
此外还可以使用 `字符串插值` 或者字符串 `format` 成员函数特性向 kcl dict 添加变量键值对
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,8 @@ schema Person:
可以使用 union 运算符 `|`, 或者 dict 解包运算符 `**` 来向 dict 中添加一个元素,并且可以使用 `in`,`not in` 等关键字判断 dict 变量当中是否包含某一个键值

```python
_left = {key = {key1 = "value1"}, intKey = 1} # 注意使用 = 表示覆盖
_right = {key = {key2 = "value2"}, intKey = 2}
_left = {key: {key1 = "value1"}, intKey = 1} # 注意使用 = 表示覆盖
_right = {key: {key2 = "value2"}, intKey = 2}
dataUnion = _left | _right # {"key": {"key1": "value1", "key2": "value2"}, "intKey": 2}
dataUnpack = {**_left, **_right} # {"key": {"key1": "value1", "key2": "value2"}, "intKey": 2}
```
Expand All @@ -112,9 +112,12 @@ dataUnion:
key:
key1: value1
key2: value2
intKey: 2
dataUnpack:
key:
key1: value1
key2: value2
intKey: 2
```
此外还可以使用 `字符串插值` 或者字符串 `format` 成员函数特性向 kcl dict 添加变量键值对
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,8 @@ schema Person:
可以使用 union 运算符 `|`, 或者 dict 解包运算符 `**` 来向 dict 中添加一个元素,并且可以使用 `in`,`not in` 等关键字判断 dict 变量当中是否包含某一个键值

```python
_left = {key = {key1 = "value1"}, intKey = 1} # 注意使用 = 表示覆盖
_right = {key = {key2 = "value2"}, intKey = 2}
_left = {key: {key1 = "value1"}, intKey = 1} # 注意使用 = 表示覆盖
_right = {key: {key2 = "value2"}, intKey = 2}
dataUnion = _left | _right # {"key": {"key1": "value1", "key2": "value2"}, "intKey": 2}
dataUnpack = {**_left, **_right} # {"key": {"key1": "value1", "key2": "value2"}, "intKey": 2}
```
Expand All @@ -112,9 +112,12 @@ dataUnion:
key:
key1: value1
key2: value2
intKey: 2
dataUnpack:
key:
key1: value1
key2: value2
intKey: 2
```
此外还可以使用 `字符串插值` 或者字符串 `format` 成员函数特性向 kcl dict 添加变量键值对
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,8 @@ schema Person:
可以使用 union 运算符 `|`, 或者 dict 解包运算符 `**` 来向 dict 中添加一个元素,并且可以使用 `in`,`not in` 等关键字判断 dict 变量当中是否包含某一个键值

```python
_left = {key = {key1 = "value1"}, intKey = 1} # 注意使用 = 表示覆盖
_right = {key = {key2 = "value2"}, intKey = 2}
_left = {key: {key1 = "value1"}, intKey = 1} # 注意使用 = 表示覆盖
_right = {key: {key2 = "value2"}, intKey = 2}
dataUnion = _left | _right # {"key": {"key1": "value1", "key2": "value2"}, "intKey": 2}
dataUnpack = {**_left, **_right} # {"key": {"key1": "value1", "key2": "value2"}, "intKey": 2}
```
Expand All @@ -112,9 +112,12 @@ dataUnion:
key:
key1: value1
key2: value2
intKey: 2
dataUnpack:
key:
key1: value1
key2: value2
intKey: 2
```
此外还可以使用 `字符串插值` 或者字符串 `format` 成员函数特性向 kcl dict 添加变量键值对
Expand Down
7 changes: 5 additions & 2 deletions versioned_docs/version-0.4.3/user_docs/support/faq-kcl.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,8 @@ schema Person:
We can use the union operator `|` or the dict unpacking operator `**` to add elements into a dict, and we can use `in` and `not in` operators to determine whether the dict variable contains a certain key.

```python
_left = {key = {key1 = "value1"}, intKey = 1} # Note: `=` denotes override the value.
_right = {key = {key2 = "value2"}, intKey = 2}
_left = {key: {key1 = "value1"}, intKey = 1} # Note: `=` denotes override the value.
_right = {key: {key2 = "value2"}, intKey = 2}
dataUnion = _left | _right # {"key": {"key1": "value1", "key2": "value2"}, "intKey": 2}
dataUnpack = {**_left, **_right} # {"key": {"key1": "value1", "key2": "value2"}, "intKey": 2}
```
Expand All @@ -110,9 +110,12 @@ dataUnion:
key:
key1: value1
key2: value2
intKey: 2
dataUnpack:
key:
key1: value1
key2: value2
intKey: 2
```
It is also possible to add key-value pair to a dict using the `string interpolation` or the string `format` method.
Expand Down
7 changes: 5 additions & 2 deletions versioned_docs/version-0.4.4/user_docs/support/faq-kcl.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,8 @@ schema Person:
We can use the union operator `|` or the dict unpacking operator `**` to add elements into a dict, and we can use `in` and `not in` operators to determine whether the dict variable contains a certain key.

```python
_left = {key = {key1 = "value1"}, intKey = 1} # Note: `=` denotes override the value.
_right = {key = {key2 = "value2"}, intKey = 2}
_left = {key: {key1 = "value1"}, intKey = 1} # Note: `=` denotes override the value.
_right = {key: {key2 = "value2"}, intKey = 2}
dataUnion = _left | _right # {"key": {"key1": "value1", "key2": "value2"}, "intKey": 2}
dataUnpack = {**_left, **_right} # {"key": {"key1": "value1", "key2": "value2"}, "intKey": 2}
```
Expand All @@ -110,9 +110,12 @@ dataUnion:
key:
key1: value1
key2: value2
intKey: 2
dataUnpack:
key:
key1: value1
key2: value2
intKey: 2
```
It is also possible to add key-value pair to a dict using the `string interpolation` or the string `format` method.
Expand Down
7 changes: 5 additions & 2 deletions versioned_docs/version-0.4.5/user_docs/support/faq-kcl.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,8 @@ schema Person:
We can use the union operator `|` or the dict unpacking operator `**` to add elements into a dict, and we can use `in` and `not in` operators to determine whether the dict variable contains a certain key.

```python
_left = {key = {key1 = "value1"}, intKey = 1} # Note: `=` denotes override the value.
_right = {key = {key2 = "value2"}, intKey = 2}
_left = {key: {key1 = "value1"}, intKey = 1} # Note: `=` denotes override the value.
_right = {key: {key2 = "value2"}, intKey = 2}
dataUnion = _left | _right # {"key": {"key1": "value1", "key2": "value2"}, "intKey": 2}
dataUnpack = {**_left, **_right} # {"key": {"key1": "value1", "key2": "value2"}, "intKey": 2}
```
Expand All @@ -110,9 +110,12 @@ dataUnion:
key:
key1: value1
key2: value2
intKey: 2
dataUnpack:
key:
key1: value1
key2: value2
intKey: 2
```
It is also possible to add key-value pair to a dict using the `string interpolation` or the string `format` method.
Expand Down
7 changes: 5 additions & 2 deletions versioned_docs/version-0.4.6/user_docs/support/faq-kcl.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,8 @@ schema Person:
We can use the union operator `|` or the dict unpacking operator `**` to add elements into a dict, and we can use `in` and `not in` operators to determine whether the dict variable contains a certain key.

```python
_left = {key = {key1 = "value1"}, intKey = 1} # Note: `=` denotes override the value.
_right = {key = {key2 = "value2"}, intKey = 2}
_left = {key: {key1 = "value1"}, intKey = 1} # Note: `=` denotes override the value.
_right = {key: {key2 = "value2"}, intKey = 2}
dataUnion = _left | _right # {"key": {"key1": "value1", "key2": "value2"}, "intKey": 2}
dataUnpack = {**_left, **_right} # {"key": {"key1": "value1", "key2": "value2"}, "intKey": 2}
```
Expand All @@ -110,9 +110,12 @@ dataUnion:
key:
key1: value1
key2: value2
intKey: 2
dataUnpack:
key:
key1: value1
key2: value2
intKey: 2
```
It is also possible to add key-value pair to a dict using the `string interpolation` or the string `format` method.
Expand Down
7 changes: 5 additions & 2 deletions versioned_docs/version-0.5.0/user_docs/support/faq-kcl.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,8 @@ schema Person:
We can use the union operator `|` or the dict unpacking operator `**` to add elements into a dict, and we can use `in` and `not in` operators to determine whether the dict variable contains a certain key.

```python
_left = {key = {key1 = "value1"}, intKey = 1} # Note: `=` denotes override the value.
_right = {key = {key2 = "value2"}, intKey = 2}
_left = {key: {key1 = "value1"}, intKey = 1} # Note: `=` denotes override the value.
_right = {key: {key2 = "value2"}, intKey = 2}
dataUnion = _left | _right # {"key": {"key1": "value1", "key2": "value2"}, "intKey": 2}
dataUnpack = {**_left, **_right} # {"key": {"key1": "value1", "key2": "value2"}, "intKey": 2}
```
Expand All @@ -110,9 +110,12 @@ dataUnion:
key:
key1: value1
key2: value2
intKey: 2
dataUnpack:
key:
key1: value1
key2: value2
intKey: 2
```
It is also possible to add key-value pair to a dict using the `string interpolation` or the string `format` method.
Expand Down

0 comments on commit 6d0272d

Please sign in to comment.