From 11eccb60dd22fa780f893e551c9bb451c1a86b26 Mon Sep 17 00:00:00 2001 From: Brett Smith Date: Wed, 27 Dec 2017 13:35:52 -0500 Subject: [PATCH] strparse: Fix default limit argument in split functions. The underlying string methods don't accept None. --- import2ledger/strparse.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/import2ledger/strparse.py b/import2ledger/strparse.py index d72e578..c580aaf 100644 --- a/import2ledger/strparse.py +++ b/import2ledger/strparse.py @@ -48,14 +48,14 @@ def currency_decimal(s, locale='en_US_POSIX'): def date(date_s, date_fmt): return datetime.datetime.strptime(date_s, date_fmt).date() -def _rejoin_slice_words(method_name, source, wordslice, sep=None, limit=None, joiner=None): +def _rejoin_slice_words(method_name, source, wordslice, sep=None, limit=-1, joiner=None): if joiner is None: joiner = ' ' if sep is None else sep return joiner.join(_slice_words(method_name, source, wordslice, sep, limit)) rejoin_slice_words = functools.partial(_rejoin_slice_words, 'split') rejoin_rslice_words = functools.partial(_rejoin_slice_words, 'rsplit') -def _slice_words(method_name, source, wordslice, sep=None, limit=None): +def _slice_words(method_name, source, wordslice, sep=None, limit=-1): return getattr(source, method_name)(sep, limit)[wordslice] slice_words = functools.partial(_slice_words, 'split') rslice_words = functools.partial(_slice_words, 'rsplit')