Skip to content

Commit

Permalink
MAINT: Ensure at least one filter was passed to bundle clean
Browse files Browse the repository at this point in the history
  • Loading branch information
richafrank committed Sep 3, 2020
1 parent 797b8e2 commit b2640da
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions zipline/data/bundles/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,8 +182,9 @@ class BadClean(click.ClickException, ValueError):
"""
def __init__(self, before, after, keep_last):
super(BadClean, self).__init__(
'Cannot pass a combination of `before` and `after` with'
'`keep_last`. Got: before=%r, after=%r, keep_n=%r\n' % (
'Cannot pass a combination of `before` and `after` with '
'`keep_last`. Must pass one. '
'Got: before=%r, after=%r, keep_last=%r\n' % (
before,
after,
keep_last,
Expand Down Expand Up @@ -578,6 +579,9 @@ def clean(name,
if e.errno != errno.ENOENT:
raise
raise UnknownBundle(name)

if before is after is keep_last is None:
raise BadClean(before, after, keep_last)
if ((before is not None or after is not None) and
keep_last is not None):
raise BadClean(before, after, keep_last)
Expand Down

0 comments on commit b2640da

Please sign in to comment.