Skip to content

Commit 11a657c

Browse files
committed
Update PWalk input to use values in sequence
1 parent 0b803c0 commit 11a657c

File tree

3 files changed

+9
-4
lines changed

3 files changed

+9
-4
lines changed

FoxDot/lib/.version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.8.8
1+
0.8.9

FoxDot/lib/Patterns/Generators.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929

3030
from __future__ import absolute_import, division, print_function
3131

32-
from .Main import GeneratorPattern, Pattern, asStream
32+
from .Main import GeneratorPattern, Pattern, asStream, PatternInput
3333

3434
import random
3535

@@ -252,7 +252,7 @@ def __init__(self, max=7, step=1, start=0, **kwargs):
252252
self.max = abs(max)
253253
self.min = self.max * -1
254254

255-
self.step = asStream(step).abs()
255+
self.step = PatternInput(step).transform(abs)
256256
self.start = start
257257

258258
self.data = [self.start, self.step, self.max]
@@ -273,7 +273,7 @@ def func(self, index):
273273
f = self.directions[0]
274274
else:
275275
f = self.choice(self.directions)
276-
self.last_value = f(self.last_value, self.step.choose())
276+
self.last_value = f(self.last_value, self.step[index])
277277
return self.last_value
278278

279279
class PDelta(GeneratorPattern):

FoxDot/lib/Patterns/Main.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1504,6 +1504,11 @@ def PatternFormat(data):
15041504
return PGroup(data)
15051505
return data
15061506

1507+
def PatternInput(data):
1508+
if isinstance(data, GeneratorPattern):
1509+
return data
1510+
return asStream(data)
1511+
15071512
Format = PatternFormat ## TODO - Remove this
15081513

15091514
def convert_nested_data(data):

0 commit comments

Comments
 (0)