This commit is contained in:
collerek
2021-06-08 14:34:02 +02:00
parent a1557273b0
commit 96c9615229
49 changed files with 1917 additions and 994 deletions

View File

@ -22,7 +22,7 @@ Return copy of self to avoid in place modifications
**Returns**:
`(ormar.models.excludable.Excludable)`: copy of self with copied sets
`ormar.models.excludable.Excludable`: copy of self with copied sets
<a name="models.excludable.Excludable.set_values"></a>
#### set\_values
@ -35,8 +35,8 @@ Appends the data to include/exclude sets.
**Arguments**:
- `value (set)`: set of values to add
- `is_exclude (bool)`: flag if values are to be excluded or included
- `value` (`set`): set of values to add
- `is_exclude` (`bool`): flag if values are to be excluded or included
<a name="models.excludable.Excludable.is_included"></a>
#### is\_included
@ -49,11 +49,11 @@ Check if field in included (in set or set is {...})
**Arguments**:
- `key (str)`: key to check
- `key` (`str`): key to check
**Returns**:
`(bool)`: result of the check
`bool`: result of the check
<a name="models.excludable.Excludable.is_excluded"></a>
#### is\_excluded
@ -66,11 +66,11 @@ Check if field in excluded (in set or set is {...})
**Arguments**:
- `key (str)`: key to check
- `key` (`str`): key to check
**Returns**:
`(bool)`: result of the check
`bool`: result of the check
<a name="models.excludable.ExcludableItems"></a>
## ExcludableItems Objects
@ -95,11 +95,20 @@ Copy passed ExcludableItems to avoid inplace modifications.
**Arguments**:
- `other (ormar.models.excludable.ExcludableItems)`: other excludable items to be copied
- `other` (`ormar.models.excludable.ExcludableItems`): other excludable items to be copied
**Returns**:
`(ormar.models.excludable.ExcludableItems)`: copy of other
`ormar.models.excludable.ExcludableItems`: copy of other
<a name="models.excludable.ExcludableItems.include_entry_count"></a>
#### include\_entry\_count
```python
| include_entry_count() -> int
```
Returns count of include items inside
<a name="models.excludable.ExcludableItems.get"></a>
#### get
@ -112,12 +121,12 @@ Return Excludable for given model and alias.
**Arguments**:
- `model_cls (ormar.models.metaclass.ModelMetaclass)`: target model to check
- `alias (str)`: table alias from relation manager
- `model_cls` (`ormar.models.metaclass.ModelMetaclass`): target model to check
- `alias` (`str`): table alias from relation manager
**Returns**:
`(ormar.models.excludable.Excludable)`: Excludable for given model and alias
`ormar.models.excludable.Excludable`: Excludable for given model and alias
<a name="models.excludable.ExcludableItems.build"></a>
#### build
@ -133,9 +142,9 @@ Each excludable has two sets of values - one to include, one to exclude.
**Arguments**:
- `items (Union[List[str], str, Tuple[str], Set[str], Dict])`: values to be included or excluded
- `model_cls (ormar.models.metaclass.ModelMetaclass)`: source model from which relations are constructed
- `is_exclude (bool)`: flag if items should be included or excluded
- `items` (`Union[List[str], str, Tuple[str], Set[str], Dict]`): values to be included or excluded
- `model_cls` (`ormar.models.metaclass.ModelMetaclass`): source model from which relations are constructed
- `is_exclude` (`bool`): flag if items should be included or excluded
<a name="models.excludable.ExcludableItems._set_excludes"></a>
#### \_set\_excludes
@ -148,10 +157,10 @@ Sets set of values to be included or excluded for given key and model.
**Arguments**:
- `items (set)`: items to include/exclude
- `model_name (str)`: name of model to construct key
- `is_exclude (bool)`: flag if values should be included or excluded
- `alias (str)`:
- `items` (`set`): items to include/exclude
- `model_name` (`str`): name of model to construct key
- `is_exclude` (`bool`): flag if values should be included or excluded
- `alias` (`str`):
<a name="models.excludable.ExcludableItems._traverse_dict"></a>
#### \_traverse\_dict
@ -164,12 +173,12 @@ Goes through dict of nested values and construct/update Excludables.
**Arguments**:
- `values (Dict)`: items to include/exclude
- `source_model (ormar.models.metaclass.ModelMetaclass)`: source model from which relations are constructed
- `model_cls (ormar.models.metaclass.ModelMetaclass)`: model from which current relation is constructed
- `is_exclude (bool)`: flag if values should be included or excluded
- `related_items (List)`: list of names of related fields chain
- `alias (str)`: alias of relation
- `values` (`Dict`): items to include/exclude
- `source_model` (`ormar.models.metaclass.ModelMetaclass`): source model from which relations are constructed
- `model_cls` (`ormar.models.metaclass.ModelMetaclass`): model from which current relation is constructed
- `is_exclude` (`bool`): flag if values should be included or excluded
- `related_items` (`List`): list of names of related fields chain
- `alias` (`str`): alias of relation
<a name="models.excludable.ExcludableItems._traverse_list"></a>
#### \_traverse\_list
@ -182,7 +191,7 @@ Goes through list of values and construct/update Excludables.
**Arguments**:
- `values (set)`: items to include/exclude
- `model_cls (ormar.models.metaclass.ModelMetaclass)`: model from which current relation is constructed
- `is_exclude (bool)`: flag if values should be included or excluded
- `values` (`set`): items to include/exclude
- `model_cls` (`ormar.models.metaclass.ModelMetaclass`): model from which current relation is constructed
- `is_exclude` (`bool`): flag if values should be included or excluded