From 8997750652bbcdeaa0e8fc6b4331532e831e4cfe Mon Sep 17 00:00:00 2001 From: Antony Lee Date: Tue, 29 Jan 2019 22:56:07 +0100 Subject: [PATCH] In Py3, math.floor and math.ceil already return ints. Remove wrapping int() call. Mostly to save a line in dates.py... --- lib/matplotlib/backends/backend_pgf.py | 2 +- lib/matplotlib/dates.py | 7 +++---- lib/matplotlib/testing/jpl_units/Epoch.py | 2 +- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/lib/matplotlib/backends/backend_pgf.py b/lib/matplotlib/backends/backend_pgf.py index 890c7142b08b..0ddd4e5a2716 100644 --- a/lib/matplotlib/backends/backend_pgf.py +++ b/lib/matplotlib/backends/backend_pgf.py @@ -498,7 +498,7 @@ def draw_path(self, gc, path, transform, rgbFace=None): path.get_extents(transform).get_points() xmin, xmax = f * xmin, f * xmax ymin, ymax = f * ymin, f * ymax - repx, repy = int(math.ceil(xmax-xmin)), int(math.ceil(ymax-ymin)) + repx, repy = math.ceil(xmax - xmin), math.ceil(ymax - ymin) writeln(self.fh, r"\pgfsys@transformshift{%fin}{%fin}" % (xmin, ymin)) for iy in range(repy): diff --git a/lib/matplotlib/dates.py b/lib/matplotlib/dates.py index ed0f9ae1e45b..18c833fe4323 100644 --- a/lib/matplotlib/dates.py +++ b/lib/matplotlib/dates.py @@ -1943,14 +1943,13 @@ def date_ticker_factory(span, tz=None, numticks=5): locator = WeekdayLocator(tz=tz) fmt = '%a, %b %d' elif days > numticks: - locator = DayLocator(interval=int(math.ceil(days / numticks)), tz=tz) + locator = DayLocator(interval=math.ceil(days / numticks), tz=tz) fmt = '%b %d' elif hrs > numticks: - locator = HourLocator(interval=int(math.ceil(hrs / numticks)), tz=tz) + locator = HourLocator(interval=math.ceil(hrs / numticks), tz=tz) fmt = '%H:%M\n%b %d' elif mins > numticks: - locator = MinuteLocator(interval=int(math.ceil(mins / numticks)), - tz=tz) + locator = MinuteLocator(interval=math.ceil(mins / numticks), tz=tz) fmt = '%H:%M:%S' else: locator = MinuteLocator(tz=tz) diff --git a/lib/matplotlib/testing/jpl_units/Epoch.py b/lib/matplotlib/testing/jpl_units/Epoch.py index 97d3a6bde523..fb607d760598 100644 --- a/lib/matplotlib/testing/jpl_units/Epoch.py +++ b/lib/matplotlib/testing/jpl_units/Epoch.py @@ -77,7 +77,7 @@ def __init__(self, frame, sec=None, jd=None, daynum=None, dt=None): self._jd = float(jd) # Resolve seconds down to [ 0, 86400) - deltaDays = int(math.floor(self._seconds / 86400.0)) + deltaDays = math.floor(self._seconds / 86400) self._jd += deltaDays self._seconds -= deltaDays * 86400.0