From 36b7313baa1c83a19f28caf5b4d3584c4b46d017 Mon Sep 17 00:00:00 2001 From: michaelpacer Date: Sun, 26 Jun 2016 18:28:06 -0700 Subject: [PATCH] changed ampm to have regex variables --- proselint/checks/dates_times/am_pm.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/proselint/checks/dates_times/am_pm.py b/proselint/checks/dates_times/am_pm.py index bc76c9757..8ed683ad7 100644 --- a/proselint/checks/dates_times/am_pm.py +++ b/proselint/checks/dates_times/am_pm.py @@ -19,8 +19,9 @@ def check_lowercase_periods(text): """Check the text.""" err = "dates_times.am_pm.lowercase_periods" msg = u"With lowercase letters, the periods are standard." + regex = "\d{1,2} ?[ap]m" - return existence_check(text, ["\d{1,2} ?[ap]m"], err, msg) + return existence_check(text, [regex], err, msg) @memoize @@ -28,8 +29,9 @@ def check_spacing(text): """Check the text.""" err = "dates_times.am_pm.spacing" msg = u"It's standard to put a space before 'a.m.' or 'p.m.'." + regex = "\d{1,2}[ap]\.?m\.?" - return existence_check(text, ["\d{1,2}[ap]\.?m\.?"], err, msg) + return existence_check(text, [regex], err, msg) @memoize @@ -38,8 +40,9 @@ def check_midnight_noon(text): err = "dates_times.am_pm.midnight_noon" msg = (u"12 a.m. and 12 p.m. are wrong and confusing." " Use 'midnight' or 'noon'.") + regex = "12 ?[ap]\.?m\.?" - return existence_check(text, ["12 ?[ap]\.?m\.?"], err, msg) + return existence_check(text, [regex], err, msg) @memoize