Skip to content

Commit

Permalink
changed the default reader from map_line_reader to None (which return…
Browse files Browse the repository at this point in the history
…s an iter over the fd)
  • Loading branch information
jflatow committed Nov 3, 2010
1 parent 99d96fa commit 5d9150f
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion lib/disco/core.py
Expand Up @@ -700,7 +700,7 @@ class JobDict(util.DefaultDict):
defaults = {'input': (),
'map': None,
'map_init': func.noop,
'map_reader': func.map_line_reader,
'map_reader': None,
'map_input_stream': (func.map_input_stream, ),
'map_output_stream': (func.map_output_stream,
func.disco_output_stream),
Expand Down
2 changes: 1 addition & 1 deletion tests/test_chain.py
Expand Up @@ -22,7 +22,7 @@ def getdata_1(self, path):

@staticmethod
def map_1(e, params):
yield e + params['suffix'], 0
yield e.strip() + params['suffix'], 0

@staticmethod
def reduce_1(iter, out, params):
Expand Down
2 changes: 1 addition & 1 deletion tests/test_mapresults.py
Expand Up @@ -20,7 +20,7 @@ def input_2(self):
def map_1(e, params):
if type(e) == tuple:
e = e[0]
yield (e + "!", '')
yield (e.strip() + "!", '')

@staticmethod
def reduce_1(iter, out, params):
Expand Down
2 changes: 1 addition & 1 deletion tests/test_objectrw.py
Expand Up @@ -16,7 +16,7 @@ def getdata(self, path):

@staticmethod
def map(e, params):
return [({'PI': math.pi}, time.strptime(e, '%d/%m/%Y'))]
return [({'PI': math.pi}, time.strptime(e.strip(), '%d/%m/%Y'))]

@staticmethod
def reduce(iter, out, params):
Expand Down
2 changes: 1 addition & 1 deletion tests/test_onlymap.py
Expand Up @@ -10,7 +10,7 @@ def getdata(self, path):

@staticmethod
def map(e, params):
return [(e, 1)]
return [(e.strip(), 1)]

def runTest(self):
d = {}
Expand Down
2 changes: 1 addition & 1 deletion tests/test_save.py
Expand Up @@ -52,7 +52,7 @@ def input_2(self):
def map_1(e, params):
if type(e) == tuple:
e = e[0]
yield (e + "!", '')
yield (e.strip() + "!", '')

map_2 = map_1

Expand Down
3 changes: 2 additions & 1 deletion tests/test_writers.py
Expand Up @@ -9,7 +9,8 @@ def getdata(self, path):

@staticmethod
def map(e, params):
return [('=' + e, e)]
e = e.strip()
yield '=' + e, e

@staticmethod
def map_writer(fd, key, value, params):
Expand Down

0 comments on commit 5d9150f

Please sign in to comment.