There should be a way to compose generators with filters
- Dominant language
- Python
- Stars
- 953
- Forks
- 91
- PR merge metrics
- No merged PRs in 30d
Description
Maybe I'm missing something but something like this should be builtin:
```python
def COMPOSE(generator: ServiceValue, *callables):
class Generator(ServiceValue):
def gen_value(self, type_mixer, name, field):
field, value = generator.gen_value(type_mixer, name, field)
for func in callables:
value = func(value)
return field, value
return Generator()
```
eg: `mixer.blend(MyModel, field=COMPOSE(mixer.RANDOM, str.upper))`
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by locating ServiceValue and its gen_value method, then trace how mixer.blend applies field values. Verify the proposed composition with a generator and callable such as mixer.RANDOM and str.upper; done means generator output can be passed through one or more filters.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- testing
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100