mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
Update collections.py (#4513)
* Update collections.py RangeOfSizeInvocation was not taking step into account when generating the end point of the range * - updated the node description to refelect this mod - added a gt=0 constraint to ensure only a positive size of the range - moved the + 1 to be on the size. To ensure the range is the requested size in cases where the step is negative - formatted with Black * Removed +1 from the range calculation --------- Co-authored-by: psychedelicious <4822129+psychedelicious@users.noreply.github.com>
This commit is contained in:
parent
4e05dcfe2e
commit
0f0366f1f3
@ -38,14 +38,16 @@ class RangeInvocation(BaseInvocation):
|
||||
version="1.0.0",
|
||||
)
|
||||
class RangeOfSizeInvocation(BaseInvocation):
|
||||
"""Creates a range from start to start + size with step"""
|
||||
"""Creates a range from start to start + (size * step) incremented by step"""
|
||||
|
||||
start: int = InputField(default=0, description="The start of the range")
|
||||
size: int = InputField(default=1, description="The number of values")
|
||||
size: int = InputField(default=1, gt=0, description="The number of values")
|
||||
step: int = InputField(default=1, description="The step of the range")
|
||||
|
||||
def invoke(self, context: InvocationContext) -> IntegerCollectionOutput:
|
||||
return IntegerCollectionOutput(collection=list(range(self.start, self.start + self.size, self.step)))
|
||||
return IntegerCollectionOutput(
|
||||
collection=list(range(self.start, self.start + (self.step * self.size), self.step))
|
||||
)
|
||||
|
||||
|
||||
@invocation(
|
||||
|
Loading…
Reference in New Issue
Block a user