diff --git a/CHANGELOG.md b/CHANGELOG.md index 111b1290..a3339783 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed - Update zsh shell completion (#264). +- Fix fatal AttributeError using Arrow 0.14.5 (#300) ### Removed diff --git a/scripts/fuzzer.py b/scripts/fuzzer.py index be3f498a..25ee5bdd 100755 --- a/scripts/fuzzer.py +++ b/scripts/fuzzer.py @@ -27,23 +27,22 @@ now = arrow.now() -for date in arrow.Arrow.range('day', now.replace(months=-1), now): +for date in arrow.Arrow.range('day', now.shift(months=-1), now): if date.weekday() in (5, 6): # Weekend \o/ continue - start = date.replace( - hour=9, minute=random.randint(0, 59), seconds=random.randint(0, 59) - ) + start = date.replace(hour=9, minute=random.randint(0, 59)) \ + .shift(seconds=random.randint(0, 59)) while start.hour < random.randint(16, 19): project, tags = random.choice(projects) frame = watson.frames.add( project, start, - start.replace(seconds=random.randint(60, 4 * 60 * 60)), + start.shift(seconds=random.randint(60, 4 * 60 * 60)), tags=random.sample(tags, random.randint(0, len(tags))) ) - start = frame.stop.replace(seconds=random.randint(0, 1 * 60 * 60)) + start = frame.stop.shift(seconds=random.randint(0, 1 * 60 * 60)) watson.save() diff --git a/watson/cli.py b/watson/cli.py index 5e605f74..5e523081 100644 --- a/watson/cli.py +++ b/watson/cli.py @@ -405,7 +405,7 @@ def status(watson, project, tags, elapsed): @click.option('-c/-C', '--current/--no-current', 'current', default=None, help="(Don't) include currently running frame in report.") @click.option('-f', '--from', 'from_', cls=MutuallyExclusiveOption, type=Date, - default=arrow.now().replace(days=-7), + default=arrow.now().shift(days=-7), mutually_exclusive=_SHORTCUT_OPTIONS, help="The date from when the report should start. Defaults " "to seven days ago.") @@ -694,7 +694,7 @@ def _final_print(lines): @click.option('-c/-C', '--current/--no-current', 'current', default=None, help="(Don't) include currently running frame in report.") @click.option('-f', '--from', 'from_', cls=MutuallyExclusiveOption, type=Date, - default=arrow.now().replace(days=-7), + default=arrow.now().shift(days=-7), mutually_exclusive=_SHORTCUT_OPTIONS, help="The date from when the report should start. Defaults " "to seven days ago.") @@ -835,7 +835,7 @@ def aggregate(ctx, watson, current, from_, to, projects, tags, output_format, @click.option('-c/-C', '--current/--no-current', 'current', default=None, help="(Don't) include currently running frame in output.") @click.option('-f', '--from', 'from_', type=Date, - default=arrow.now().replace(days=-7), + default=arrow.now().shift(days=-7), help="The date from when the log should start. Defaults " "to seven days ago.") @click.option('-t', '--to', type=Date, default=arrow.now(), diff --git a/watson/utils.py b/watson/utils.py index 22177d2b..cb8248d9 100644 --- a/watson/utils.py +++ b/watson/utils.py @@ -174,7 +174,7 @@ def get_start_time_for_period(period): if period == 'day': start_time = arrow.Arrow(year, month, day) elif period == 'week': - start_time = arrow.Arrow.fromdate(now.replace(days=-weekday).date()) + start_time = arrow.Arrow.fromdate(now.shift(days=-weekday).date()) elif period == 'month': start_time = arrow.Arrow(year, month, 1) elif period == 'luna': @@ -204,7 +204,7 @@ def apply_weekday_offset(start_time, week_start): return start_time now = datetime.datetime.now() offset = weekdays[new_start] - 7 * (weekdays[new_start] > now.weekday()) - return start_time.replace(days=offset) + return start_time.shift(days=offset) def make_json_writer(func, *args, **kwargs):