Skip to content

Commit 8f264c1

Browse files
committed
Have mungers stop outputing module
1 parent b58a3e2 commit 8f264c1

File tree

2 files changed

+17
-18
lines changed

2 files changed

+17
-18
lines changed

tests/core/method-class/test_method.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ def formatter(params):
151151
},
152152
[],
153153
{},
154-
('eth_method', [])
154+
('eth_method', ())
155155
),
156156
(
157157
{
@@ -161,14 +161,14 @@ def formatter(params):
161161
},
162162
[],
163163
{},
164-
('eth_method', [])
164+
('eth_method', ())
165165
),
166166
(
167167
{
168168
'mungers': [
169-
lambda m, x, y, z: (m, [x, y]),
170-
lambda m, x, y: (m, [x]),
171-
lambda m, x: (m, [str(x)])],
169+
lambda m, x, y, z: [x, y],
170+
lambda m, x, y: [x],
171+
lambda m, x: [str(x)]],
172172
'json_rpc_method': 'eth_method',
173173
'formatter_lookup_fn': ''
174174
},
@@ -179,9 +179,9 @@ def formatter(params):
179179
(
180180
{
181181
'mungers': [
182-
lambda m, x, y, z: (m, [x, y]),
183-
lambda m, x, y: (m, [x]),
184-
lambda m, x: (m, [str(x)])],
182+
lambda m, x, y, z: [x, y],
183+
lambda m, x, y: [x],
184+
lambda m, x: [str(x)]],
185185
'json_rpc_method': 'eth_method',
186186
'formatter_lookup_fn': ''
187187
},
@@ -207,14 +207,14 @@ def formatter(params):
207207
},
208208
[],
209209
{},
210-
('eth_mismatch', [])
210+
('eth_mismatch', ())
211211
),
212212
(
213213
{
214214
'mungers': [
215-
lambda m, x, y, z: (m, [x, y]),
216-
lambda m, x, y: (m, [x]),
217-
lambda m, x: (m, [str(x)])],
215+
lambda m, x, y, z: [x, y],
216+
lambda m, x, y: [x],
217+
lambda m, x: [str(x)]],
218218
'json_rpc_method': 'eth_method',
219219
'formatter_lookup_fn': get_test_formatters
220220
},

web3/method.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,8 @@
1111

1212
def _munger_star_apply(fn):
1313
@functools.wraps(fn)
14-
def inner(module_args):
15-
module, args = module_args
16-
return fn(module, *args)
14+
def inner(args):
15+
return fn(*args)
1716
return inner
1817

1918

@@ -23,7 +22,7 @@ def get_default_formatters(*args, **kwargs):
2322

2423
def default_munger(module, *args, **kwargs):
2524
if not args and not kwargs:
26-
return module, list()
25+
return tuple()
2726
else:
2827
raise TypeError("Parameters passed to method without parameter mungers defined.")
2928

@@ -118,9 +117,9 @@ def input_munger(self, val):
118117
# TODO: Create friendly error output.
119118
mungers_iter = iter(self.mungers)
120119
root_munger = next(mungers_iter)
121-
_, munged_inputs = pipe(
120+
munged_inputs = pipe(
122121
root_munger(module, *args, **kwargs),
123-
*map(_munger_star_apply, mungers_iter))
122+
*map(lambda m: _munger_star_apply(functools.partial(m, module)), mungers_iter))
124123

125124
return munged_inputs
126125

0 commit comments

Comments
 (0)