Create a grouping from a schema by using the schema's scalar values to look up items in the provided source object. :param schema: A grouping of potential keys in source :param source: Dict-like object to use to look up scalar grouping value using scalar grouping values as
(schema, source, default=None)
| 143 | |
| 144 | |
| 145 | def make_grouping_by_key(schema, source, default=None): |
| 146 | """ |
| 147 | Create a grouping from a schema by using the schema's scalar values to look up |
| 148 | items in the provided source object. |
| 149 | |
| 150 | :param schema: A grouping of potential keys in source |
| 151 | :param source: Dict-like object to use to look up scalar grouping value using |
| 152 | scalar grouping values as keys |
| 153 | :param default: Default scalar value to use if grouping scalar key is not present |
| 154 | in source |
| 155 | :return: grouping |
| 156 | """ |
| 157 | return map_grouping(lambda s: source.get(s, default), schema) |
| 158 | |
| 159 | |
| 160 | class SchemaTypeValidationError(InvalidCallbackReturnValue): |
searching dependent graphs…