Skip to content

Commit

Permalink
Update PWalk input to use values in sequence
Browse files Browse the repository at this point in the history
  • Loading branch information
Qirky committed Jun 23, 2020
1 parent 0b803c0 commit 11a657c
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion FoxDot/lib/.version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.8.8
0.8.9
6 changes: 3 additions & 3 deletions FoxDot/lib/Patterns/Generators.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

from __future__ import absolute_import, division, print_function

from .Main import GeneratorPattern, Pattern, asStream
from .Main import GeneratorPattern, Pattern, asStream, PatternInput

import random

Expand Down Expand Up @@ -252,7 +252,7 @@ def __init__(self, max=7, step=1, start=0, **kwargs):
self.max = abs(max)
self.min = self.max * -1

self.step = asStream(step).abs()
self.step = PatternInput(step).transform(abs)
self.start = start

self.data = [self.start, self.step, self.max]
Expand All @@ -273,7 +273,7 @@ def func(self, index):
f = self.directions[0]
else:
f = self.choice(self.directions)
self.last_value = f(self.last_value, self.step.choose())
self.last_value = f(self.last_value, self.step[index])
return self.last_value

class PDelta(GeneratorPattern):
Expand Down
5 changes: 5 additions & 0 deletions FoxDot/lib/Patterns/Main.py
Original file line number Diff line number Diff line change
Expand Up @@ -1504,6 +1504,11 @@ def PatternFormat(data):
return PGroup(data)
return data

def PatternInput(data):
if isinstance(data, GeneratorPattern):
return data
return asStream(data)

Format = PatternFormat ## TODO - Remove this

def convert_nested_data(data):
Expand Down

0 comments on commit 11a657c

Please sign in to comment.