Create README.md
This commit is contained in:
committed by
GitHub
parent
f5a4abd0c9
commit
ef82fbf84c
@@ -0,0 +1,56 @@
|
||||
# Exercise 1: Enhanced Object Processing 🔄
|
||||
|
||||
Building on Exercise 0, this exercise enhances the comment function with multi-object selection and visual feedback.
|
||||
|
||||
## What's New ✨
|
||||
1. Added `number_of_elements` input parameter
|
||||
2. Enhanced object selection to handle multiple objects
|
||||
3. Introduced gradient visualization
|
||||
4. Improved display value handling
|
||||
|
||||
## Key Changes from Exercise 0 📈
|
||||
|
||||
### Input Schema Changes
|
||||
```python
|
||||
class FunctionInputs(AutomateBase):
|
||||
comment_phrase: str = Field(...)
|
||||
number_of_elements: int = Field(
|
||||
title="Number of Elements",
|
||||
description="The number of elements to process"
|
||||
)
|
||||
```
|
||||
|
||||
### Function Implementation Changes
|
||||
```python
|
||||
# NEW: Using random.sample instead of random.choice
|
||||
selected_objects = random.sample(
|
||||
displayable_objects,
|
||||
real_number_of_elements,
|
||||
)
|
||||
|
||||
# NEW: Gradient visualization
|
||||
gradient_values = {
|
||||
object_id: {"gradientValue": index + 1}
|
||||
for index, object_id in enumerate(selected_object_ids)
|
||||
}
|
||||
```
|
||||
|
||||
## Enhanced Features 🎯
|
||||
- Dynamic selection of multiple objects
|
||||
- Visual differentiation between selected objects
|
||||
- Better handling of edge cases
|
||||
- More informative success/failure messages
|
||||
- Gradient-based visualization
|
||||
|
||||
## Key Learning Points 📝
|
||||
- [ ] Handling multiple objects effectively
|
||||
- [ ] Adding visual feedback mechanisms
|
||||
- [ ] Working with user-defined quantities
|
||||
- [ ] Enhanced error handling for edge cases
|
||||
- [ ] Improved object filtering techniques
|
||||
|
||||
## Testing 🧪
|
||||
Run the test file:
|
||||
```bash
|
||||
pytest tests/local_test_exercise1.py::test_function_run
|
||||
```
|
||||
Reference in New Issue
Block a user