Skip to content

Commit

Permalink
updated docs
Browse files Browse the repository at this point in the history
  • Loading branch information
vedpatwardhan committed Sep 19, 2024
1 parent 08be78a commit 6c030d1
Showing 1 changed file with 78 additions and 10 deletions.
88 changes: 78 additions & 10 deletions python/types.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -137,18 +137,90 @@ def repr_mode() -> str
Gets the global representation mode as currently set. This is used when representing
the various unify types on screen. Can be either "verbose" or "concise".

<a id="types.key_repr"></a>

---

### key\_repr

```python
def key_repr(instance: _FormattedBaseModel) -> Union[Dict, List]
```

Get the key representation for the instance passed, either as the keys to keep or
the keys to remove.

**Arguments**:

The instance for which we want to retrieve the key representation policy.


**Returns**:

Dict containing the policy, with a base key of "skip" or "keep", followed by
the nested structure of the elements to either remove or keep.

<a id="types.keys_to_skip"></a>

---

### keys\_to\_skip

```python
def keys_to_skip() -> Tuple[str]
def keys_to_skip() -> Dict[Type, Dict]
```

Return the currently set keys to skip, which is a dict with types as keys and the
nested structure to skip as values.

<a id="types.set_keys_to_skip"></a>

---

### set\_keys\_to\_skip

```python
def set_keys_to_skip(skip_keys: Dict[Type, Dict]) -> None
```

Return the currently set keys to skip as part of the representation to mode.
This is a tuple of arbitrary strings.
Set the keys to be skipped during representation, which is a dict with types as keys
and the nested structure to skip as values.

**Arguments**:

- `skip_keys` - A dictionary with the types as keys and dictionary representing the
structure of the keys to skip for that type.

<a id="types.keys_to_keep"></a>

---

### keys\_to\_keep

```python
def keys_to_keep() -> Dict[Type, Dict]
```

Return the currently set keys to keep, which is a dict with types as keys and the
nested structure to keep as values.

<a id="types.set_keys_to_keep"></a>

---

### set\_keys\_to\_keep

```python
def set_keys_to_keep(keep_keys: Dict[Type, Dict]) -> None
```

Set the keys to be kept during representation, which is a dict with types as keys
and the nested structure to keep as values.

**Arguments**:

- `keep_keys` - A dictionary with the types as keys and dictionary representing the
structure of the keys to keep for that type.

<a id="types.set_repr_mode"></a>

Expand All @@ -157,7 +229,7 @@ This is a tuple of arbitrary strings.
### set\_repr\_mode

```python
def set_repr_mode(mode: str, skip_keys: Optional[List[str]] = None) -> None
def set_repr_mode(mode: str) -> None
```

Sets the global representation mode, to be used when representing the various unify
Expand All @@ -166,15 +238,13 @@ types on screen. Can be either "verbose" or "concise".
**Arguments**:

- `mode` - The value to set the mode to, either "verbose" or "concise".

- `skip_keys` - The value of the keys to skip.

<a id="types.ReprMode"></a>

## ReprMode

```python
class ReprMode()
class ReprMode(str)
```

<a id="types.ReprMode.__init__"></a>
Expand All @@ -184,7 +254,7 @@ class ReprMode()
### \_\_init\_\_

```python
def __init__(val: str, skip_keys: Optional[List[str]] = None)
def __init__(val: str)
```

Set a representation mode for a specific context in the code, by using the
Expand All @@ -193,7 +263,5 @@ Set a representation mode for a specific context in the code, by using the
**Arguments**:

- `val` - The value of the string, must be either "verbose" or "concise".

- `skip_keys` - The value of the keys to skip.

<a id="__init__"></a>

0 comments on commit 6c030d1

Please sign in to comment.