From af2f4b73e99a7c44b568ed81024011567dd695d3 Mon Sep 17 00:00:00 2001 From: Paul Gauthier Date: Wed, 15 May 2024 11:03:07 -0700 Subject: [PATCH] aider: Use the `released` field directly in the plot instead of parsing it with `datetime.strptime`. # Aider chat conversation: USER: I ran this command: python benchmark/over_time.py And got this output: Traceback (most recent call last): File "/Users/gauthier/Projects/aider/benchmark/over_time.py", line 33, in plot_over_time('_data/edit_leaderboard.yml') File "/Users/gauthier/Projects/aider/benchmark/over_time.py", line 15, in plot_over_time dates.append(datetime.strptime(entry['released'], '%Y-%m-%d')) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ TypeError: strptime() argument 1 must be str, not datetime.date ASSISTANT: The error indicates that the `released` field in the YAML file is already a `datetime.date` object, so we don't need to parse it with `datetime.strptime`. We can directly use it in the plot. Here are the changes: benchmark/over_time.py ```python <<<<<<< SEARCH dates.append(datetime.strptime(entry['released'], '%Y-%m-%d')) ======= dates.append(entry['released']) >>>>>>> REPLACE ``` --- benchmark/over_time.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/benchmark/over_time.py b/benchmark/over_time.py index b3fec4b95..aea0349ff 100644 --- a/benchmark/over_time.py +++ b/benchmark/over_time.py @@ -12,7 +12,7 @@ def plot_over_time(yaml_file): for entry in data: if 'released' in entry and 'pass_rate_2' in entry: - dates.append(datetime.strptime(entry['released'], '%Y-%m-%d')) + dates.append(entry['released']) pass_rates.append(entry['pass_rate_2']) models.append(entry['model'])