Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 76bec02

Browse files
author
Alexis Bienvenüe
committed
Reuse UTC timezone from dates.py
1 parent 2cdc577 commit 76bec02

1 file changed

Lines changed: 2 additions & 15 deletions

File tree

lib/matplotlib/backends/backend_pdf.py

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
from matplotlib.mathtext import MathTextParser
4747
from matplotlib.transforms import Affine2D, BboxBase
4848
from matplotlib.path import Path
49+
from matplotlib.dates import UTC
4950
from matplotlib import _path
5051
from matplotlib import _png
5152
from matplotlib import ttconv
@@ -136,20 +137,6 @@ def _string_escape(match):
136137
assert False
137138

138139

139-
# tzinfo class for UTC
140-
class UTCtimezone(tzinfo):
141-
"""UTC timezone"""
142-
143-
def utcoffset(self, dt):
144-
return timedelta(0)
145-
146-
def tzname(self, dt):
147-
return "UTC"
148-
149-
def dst(self, dt):
150-
return timedelta(0)
151-
152-
153140
def pdfRepr(obj):
154141
"""Map Python objects to PDF syntax."""
155142

@@ -492,7 +479,7 @@ def __init__(self, filename):
492479
source_date_epoch = os.getenv("SOURCE_DATE_EPOCH")
493480
if source_date_epoch:
494481
source_date = datetime.utcfromtimestamp(int(source_date_epoch))
495-
source_date = source_date.replace(tzinfo=UTCtimezone())
482+
source_date = source_date.replace(tzinfo=UTC)
496483
else:
497484
source_date = datetime.today()
498485

0 commit comments

Comments
 (0)