aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar MarkKoz <[email protected]>2021-08-05 16:13:49 -0700
committerGravatar MarkKoz <[email protected]>2021-08-05 16:13:49 -0700
commit6b280b19ed5c564e824e55a1ec9bb13120c0193d (patch)
treed30f392f09988f80558eb10f8c6bd3ac680775ea
parentempty commit for CI (diff)
Time: remove RFC1123 support
It's not used anywhere and hasn't been for a very long time.
-rw-r--r--bot/utils/time.py6
-rw-r--r--tests/bot/utils/test_time.py7
2 files changed, 0 insertions, 13 deletions
diff --git a/bot/utils/time.py b/bot/utils/time.py
index eaa9b72e9..545e50859 100644
--- a/bot/utils/time.py
+++ b/bot/utils/time.py
@@ -7,7 +7,6 @@ import arrow
import dateutil.parser
from dateutil.relativedelta import relativedelta
-RFC1123_FORMAT = "%a, %d %b %Y %H:%M:%S GMT"
DISCORD_TIMESTAMP_REGEX = re.compile(r"<t:(\d+):f>")
_DURATION_REGEX = re.compile(
@@ -167,11 +166,6 @@ def time_since(past_datetime: datetime.datetime) -> str:
return discord_timestamp(past_datetime, TimestampFormats.RELATIVE)
-def parse_rfc1123(stamp: str) -> datetime.datetime:
- """Parse RFC1123 time string into datetime."""
- return datetime.datetime.strptime(stamp, RFC1123_FORMAT).replace(tzinfo=datetime.timezone.utc)
-
-
def format_infraction(timestamp: str) -> str:
"""Format an infraction timestamp to a discord timestamp."""
return discord_timestamp(dateutil.parser.isoparse(timestamp))
diff --git a/tests/bot/utils/test_time.py b/tests/bot/utils/test_time.py
index a3dcbfc0a..9c52fed27 100644
--- a/tests/bot/utils/test_time.py
+++ b/tests/bot/utils/test_time.py
@@ -43,13 +43,6 @@ class TimeTests(unittest.TestCase):
time.humanize_delta(relativedelta(days=2, hours=2), 'hours', max_units)
self.assertEqual(str(error.exception), 'max_units must be positive')
- def test_parse_rfc1123(self):
- """Testing parse_rfc1123."""
- self.assertEqual(
- time.parse_rfc1123('Sun, 15 Sep 2019 12:00:00 GMT'),
- datetime(2019, 9, 15, 12, 0, 0, tzinfo=timezone.utc)
- )
-
def test_format_infraction(self):
"""Testing format_infraction."""
self.assertEqual(time.format_infraction('2019-12-12T00:01:00Z'), '<t:1576108860:f>')