From 2a9ba22dda0ba72819757e752dac152fe3d4ac22 Mon Sep 17 00:00:00 2001 From: Marco Gorelli <33491632+MarcoGorelli@users.noreply.github.com> Date: Sat, 2 Nov 2024 10:23:57 +0000 Subject: [PATCH] verbose regex --- narwhals/_pandas_like/utils.py | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/narwhals/_pandas_like/utils.py b/narwhals/_pandas_like/utils.py index 287f7f878..7241cd814 100644 --- a/narwhals/_pandas_like/utils.py +++ b/narwhals/_pandas_like/utils.py @@ -32,17 +32,17 @@ } PD_DATETIME_RGX = r"""^ datetime64\[ - (?Ps|ms|us|ns) # Match time unit: s, ms, us, or ns - (?:, # Begin non-capturing group for optional timezone - \s? # Optional whitespace after comma - (?P # Start named group for timezone - [a-zA-Z\/]+ # Match timezone name, e.g., UTC, America/New_York - (?: # Begin optional non-capturing group for offset - [+-]\d{2}:\d{2} # Match offset in format +HH:MM or -HH:MM - )? # End optional offset group - ) # End time_zone group - )? # End optional timezone group - \] # Closing bracket + (?Ps|ms|us|ns) # Match time unit: s, ms, us, or ns + (?:, # Begin non-capturing group for optional timezone + \s? # Optional whitespace after comma + (?P # Start named group for timezone + [a-zA-Z\/]+ # Match timezone name, e.g., UTC, America/New_York + (?: # Begin optional non-capturing group for offset + [+-]\d{2}:\d{2} # Match offset in format +HH:MM or -HH:MM + )? # End optional offset group + ) # End time_zone group + )? # End optional timezone group + \] # Closing bracket $""" PATTERN_PD_DATETIME = re.compile(PD_DATETIME_RGX, re.VERBOSE) PA_DATETIME_RGX = r"""^