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 41a730a commit 4ea2b91
Show file tree
Hide file tree
Showing 3 changed files with 199 additions and 1 deletion.
1 change: 1 addition & 0 deletions mint.json
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@
"python/dataset",
"python/evaluator",
"python/logging",
"python/repr",
"python/types",
{
"group": "utils",
Expand Down
2 changes: 1 addition & 1 deletion python/dataset.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -613,4 +613,4 @@ def __rich_repr__() -> List[Datum]

Used by the rich package for representing and print the instance.

<a id="types"></a>
<a id="repr"></a>
197 changes: 197 additions & 0 deletions python/repr.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,197 @@
---
title: 'repr'
---

<a id="repr.repr_mode"></a>

---

### repr\_mode

```python
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="repr.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**:

- `instance` - The instance for which we want to retrieve the key repr 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="repr.keys_to_skip"></a>

---

### keys\_to\_skip

```python
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="repr.set_keys_to_skip"></a>

---

### set\_keys\_to\_skip

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

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` - The types as keywords arguments and dictionary representing the
structure of the keys to skip for that type as values.

<a id="repr.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="repr.set_keys_to_keep"></a>

---

### set\_keys\_to\_keep

```python
def set_keys_to_keep(keep_keys: Union[Dict[Type, Dict], str]) -> 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` - The types as keywords arguments and dictionary representing the
structure of the keys to keep for that type as values.

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

---

### set\_repr\_mode

```python
def set_repr_mode(mode: str) -> None
```

Sets the global representation mode, to be used when representing the various unify
types on screen. Can be either "verbose" or "concise".

**Arguments**:

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

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

## ReprMode

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

<a id="repr.ReprMode.__init__"></a>

---

### \_\_init\_\_

```python
def __init__(val: str)
```

Set a representation mode for a specific context in the code, by using the
`with` an instantiation of this class.

**Arguments**:

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

<a id="repr.KeepKeys"></a>

## KeepKeys

```python
class KeepKeys()
```

<a id="repr.KeepKeys.__init__"></a>

---

### \_\_init\_\_

```python
def __init__(keep_keys: Union[Dict[Type, Dict], str])
```

Set a the keys to keep for a specific context in the code, by using the
`with` an instantiation of this class.

**Arguments**:

- `keep_keys` - The types as keywords arguments and dictionary representing the
structure of the keys to keep for that type as values.

<a id="repr.SkipKeys"></a>

## SkipKeys

```python
class SkipKeys()
```

<a id="repr.SkipKeys.__init__"></a>

---

### \_\_init\_\_

```python
def __init__(skip_keys: Union[Dict[Type, Dict], str])
```

Set a the keys to skip for a specific context in the code, by using the
`with` an instantiation of this class.

**Arguments**:

- `skip_keys` - The types as keywords arguments and dictionary representing the
structure of the keys to skip for that type as values.

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

0 comments on commit 4ea2b91

Please sign in to comment.