From 5c28bc1206a03aa591e62c22dfbcb3a873f58057 Mon Sep 17 00:00:00 2001 From: Dawson R <105720-ddaws@users.noreply.gitlab.com> Date: Tue, 10 Sep 2024 07:41:18 +0800 Subject: [PATCH] Fixed formatting --- click_datetime/__init__.py | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/click_datetime/__init__.py b/click_datetime/__init__.py index a7e23e5..34cd524 100644 --- a/click_datetime/__init__.py +++ b/click_datetime/__init__.py @@ -1,16 +1,16 @@ - import click from datetime import datetime + class Datetime(click.ParamType): - ''' + """ A datetime object parsed via datetime.strptime. Format specifiers can be found here : https://docs.python.org/3/library/datetime.html#strftime-strptime-behavior - ''' + """ - name = 'date' + name = "date" def __init__(self, format): self.format = format @@ -26,5 +26,12 @@ def convert(self, value, param, ctx): datetime_value = datetime.strptime(value, self.format) return datetime_value except ValueError as ex: - self.fail('Could not parse datetime string "{datetime_str}" formatted as {format} ({ex})'.format( - datetime_str=value, format=self.format, ex=ex,), param, ctx) + self.fail( + 'Could not parse datetime string "{datetime_str}" formatted as {format} ({ex})'.format( + datetime_str=value, + format=self.format, + ex=ex, + ), + param, + ctx, + )