Unused imports

Claude Paroz <[email protected]> Wed, 16 Feb 2022 21:10:08 +0100
Newsgroups gmane.comp.python.reportlab.user
Message-ID <[email protected]>
My next cleaning patch is about unused imports (as I think we could gain 
some memory or speed by avoiding those imports).
However I know this patch is prone to merge conflicts as it touches many 
import section of various files. Feel free to ask me to do a rebase 
later if you have other WIP works that conflicts too much with it.

Regards,

Claude
-- 
www.2xlibre.net
0001-Remove-unused-imports.patch (text/x-patch, 88 KB)
From ab2176a9f071ffc771b70a47f0c6c566c0a8711b Mon Sep 17 00:00:00 2001
From: Claude Paroz <[email protected]>
Date: Fri, 4 Feb 2022 22:36:36 +0100
Subject: [PATCH] Remove unused imports

---
 docs/userguide/genuserguide.py                |  8 +++---
 src/reportlab/graphics/barcode/__init__.py    |  2 +-
 src/reportlab/graphics/barcode/code128.py     |  3 +--
 src/reportlab/graphics/barcode/fourstate.py   |  4 ---
 src/reportlab/graphics/barcode/qr.py          |  2 +-
 src/reportlab/graphics/barcode/test.py        | 12 ++++-----
 src/reportlab/graphics/barcode/usps4s.py      |  1 -
 src/reportlab/graphics/barcode/widgets.py     |  4 +--
 src/reportlab/graphics/charts/areas.py        |  2 +-
 src/reportlab/graphics/charts/axes.py         |  7 +-----
 src/reportlab/graphics/charts/barcharts.py    | 13 +++++-----
 src/reportlab/graphics/charts/dotbox.py       |  2 +-
 src/reportlab/graphics/charts/doughnut.py     | 18 +++----------
 src/reportlab/graphics/charts/legends.py      |  7 ++----
 src/reportlab/graphics/charts/linecharts.py   |  6 ++---
 src/reportlab/graphics/charts/lineplots.py    | 10 +++-----
 src/reportlab/graphics/charts/markers.py      |  2 +-
 src/reportlab/graphics/charts/piecharts.py    | 11 ++++----
 src/reportlab/graphics/charts/slidebox.py     | 13 +++++-----
 src/reportlab/graphics/charts/spider.py       | 17 +++++--------
 src/reportlab/graphics/charts/textlabels.py   | 17 +++++--------
 src/reportlab/graphics/charts/utils.py        |  4 +--
 src/reportlab/graphics/charts/utils3d.py      |  7 ++----
 src/reportlab/graphics/renderPDF.py           |  2 +-
 src/reportlab/graphics/renderPM.py            |  6 ++---
 src/reportlab/graphics/renderPS.py            | 11 ++++----
 src/reportlab/graphics/renderSVG.py           |  6 ++---
 src/reportlab/graphics/samples/bubble.py      |  2 +-
 .../graphics/samples/clustered_bar.py         |  2 +-
 .../graphics/samples/clustered_column.py      |  2 +-
 src/reportlab/graphics/samples/excelcolors.py |  2 +-
 .../graphics/samples/exploded_pie.py          |  2 +-
 .../graphics/samples/filled_radar.py          |  2 +-
 src/reportlab/graphics/samples/line_chart.py  |  2 +-
 .../samples/linechart_with_markers.py         |  2 +-
 src/reportlab/graphics/samples/radar.py       |  2 +-
 src/reportlab/graphics/samples/runall.py      |  1 -
 src/reportlab/graphics/samples/scatter.py     |  2 +-
 .../graphics/samples/scatter_lines.py         |  2 +-
 .../graphics/samples/scatter_lines_markers.py |  2 +-
 src/reportlab/graphics/samples/simple_pie.py  |  2 +-
 src/reportlab/graphics/samples/stacked_bar.py |  2 +-
 .../graphics/samples/stacked_column.py        |  2 +-
 src/reportlab/graphics/shapes.py              |  5 ----
 src/reportlab/graphics/testshapes.py          |  4 +--
 src/reportlab/graphics/widgetbase.py          |  4 +--
 .../graphics/widgets/adjustableArrow.py       |  1 -
 src/reportlab/graphics/widgets/eventcal.py    |  7 +-----
 src/reportlab/graphics/widgets/flags.py       |  1 -
 src/reportlab/graphics/widgets/grids.py       |  4 +--
 src/reportlab/graphics/widgets/markers.py     |  4 +--
 src/reportlab/graphics/widgets/table.py       |  1 -
 src/reportlab/lib/codecharts.py               |  2 +-
 src/reportlab/lib/colors.py                   |  2 +-
 src/reportlab/lib/corp.py                     |  1 -
 src/reportlab/lib/fontfinder.py               |  3 +--
 src/reportlab/lib/fonts.py                    |  1 -
 src/reportlab/lib/formatters.py               |  2 +-
 src/reportlab/lib/normalDate.py               |  1 -
 src/reportlab/lib/pdfencrypt.py               |  8 +++---
 src/reportlab/lib/pygments2xpre.py            |  3 +--
 src/reportlab/lib/rl_accel.py                 |  4 +--
 src/reportlab/lib/rparsexml.py                |  1 -
 src/reportlab/lib/styles.py                   |  2 +-
 src/reportlab/lib/utils.py                    |  5 ++--
 src/reportlab/lib/validators.py               |  2 +-
 src/reportlab/pdfbase/_can_cmap_data.py       |  2 --
 src/reportlab/pdfbase/acroform.py             |  1 -
 src/reportlab/pdfbase/cidfonts.py             |  1 -
 src/reportlab/pdfbase/pdfdoc.py               |  3 +--
 src/reportlab/pdfbase/pdfform.py              |  1 -
 src/reportlab/pdfbase/pdfmetrics.py           |  4 +--
 src/reportlab/pdfbase/pdfutils.py             |  1 -
 src/reportlab/pdfgen/canvas.py                |  7 ++----
 src/reportlab/pdfgen/pdfimages.py             |  1 -
 src/reportlab/pdfgen/textobject.py            |  4 +--
 src/reportlab/platypus/flowables.py           |  7 +++---
 src/reportlab/platypus/frames.py              |  1 -
 src/reportlab/platypus/paragraph.py           |  7 +++---
 src/reportlab/platypus/paraparser.py          |  8 ++----
 src/reportlab/platypus/tableofcontents.py     |  3 +--
 src/reportlab/platypus/xpreformatted.py       |  2 +-
 src/rl_addons/rl_accel/tests/t0.py            |  2 +-
 tests/test_platypus_index.py                  |  3 +--
 tools/docco/docpy.py                          | 10 +++-----
 tools/docco/graphdocpy.py                     | 25 ++++++-------------
 tools/docco/rl_doc_utils.py                   |  8 ++----
 tools/docco/rltemplate.py                     |  5 ++--
 tools/docco/stylesheet.py                     |  2 +-
 tools/docco/yaml.py                           |  1 -
 tools/docco/yaml2pdf.py                       |  5 ----
 tools/pythonpoint/pythonpoint.py              |  5 ++--
 tools/pythonpoint/stdparser.py                |  3 +--
 tools/pythonpoint/styles/htu.py               |  6 ++---
 tools/pythonpoint/styles/modern.py            |  4 +--
 tools/pythonpoint/styles/projection.py        |  4 +--
 tools/pythonpoint/styles/standard.py          |  6 ++---
 tools/utils/add_bleed.py                      |  2 +-
 98 files changed, 157 insertions(+), 283 deletions(-)

diff --git a/docs/userguide/genuserguide.py b/docs/userguide/genuserguide.py
index 90a0520e..94116bba 100644
--- a/docs/userguide/genuserguide.py
+++ b/docs/userguide/genuserguide.py
@@ -9,7 +9,7 @@ This module contains the script for building the user guide.
 
 def run(pagesize=None, verbose=0, outDir=None):
     import sys,os
-    from reportlab.lib.utils import open_and_read, asUnicode
+    from reportlab.lib.utils import open_and_read
     cwd = os.getcwd()
     docsDir=os.path.dirname(os.path.dirname(sys.argv[0]) or cwd)
     topDir=os.path.dirname(docsDir)
@@ -24,7 +24,9 @@ def run(pagesize=None, verbose=0, outDir=None):
     pdfmetrics.registerFont(TTFont('VeraIt', 'VeraIt.ttf'))
     pdfmetrics.registerFont(TTFont('VeraBI', 'VeraBI.ttf'))
     registerFontFamily('Vera',normal='Vera',bold='VeraBd',italic='VeraIt',boldItalic='VeraBI')
-    from tools.docco.rl_doc_utils import setStory, getStory, RLDocTemplate, defaultPageSize, H1, H2, H3, H4
+    from reportlab.rl_config import defaultPageSize
+    from tools.docco.rl_doc_utils import setStory, getStory, H1, H2, H3, H4
+    from tools.docco.rltemplate import RLDocTemplate
     from tools.docco import rl_doc_utils
     exec('from tools.docco.rl_doc_utils import *', G, G)
     destfn = os.path.join(outDir,'reportlab-userguide.pdf')
@@ -51,7 +53,7 @@ def run(pagesize=None, verbose=0, outDir=None):
         'app_demos',
         ):
         #python source is supposed to be utf8 these days
-        exec(asUnicode(open_and_read(f+'.py')), G, G)
+        exec(open_and_read(f+'.py', mode='r'), G, G)
     del G
 
     story = getStory()
diff --git a/src/reportlab/graphics/barcode/__init__.py b/src/reportlab/graphics/barcode/__init__.py
index f1d74fb0..69993d3f 100644
--- a/src/reportlab/graphics/barcode/__init__.py
+++ b/src/reportlab/graphics/barcode/__init__.py
@@ -95,7 +95,7 @@ def getCodeNames():
 def createBarcodeDrawing(codeName, **options):
     """This creates and returns a drawing with a barcode.
     """    
-    from reportlab.graphics.shapes import Drawing, Group
+    from reportlab.graphics.shapes import Drawing
 
     codes = getCodes()
     bcc = codes[codeName]
diff --git a/src/reportlab/graphics/barcode/code128.py b/src/reportlab/graphics/barcode/code128.py
index 3f2b3d2f..c8cf4fc0 100644
--- a/src/reportlab/graphics/barcode/code128.py
+++ b/src/reportlab/graphics/barcode/code128.py
@@ -419,11 +419,10 @@ if __name__=='__main__':
     def main():
         from reportlab.graphics.barcode.code128 import Code128
         from reportlab.platypus import Spacer, SimpleDocTemplate
-        from reportlab.lib.units import inch, cm
+        from reportlab.lib.units import inch
         from reportlab.lib.styles import getSampleStyleSheet
         from reportlab.platypus.paragraph import Paragraph
         from reportlab.platypus.flowables import KeepTogether
-        import os
         styles = getSampleStyleSheet()
         styleN = styles['Normal']
         styleH = styles['Heading1']
diff --git a/src/reportlab/graphics/barcode/fourstate.py b/src/reportlab/graphics/barcode/fourstate.py
index 386721f5..539d0a5c 100644
--- a/src/reportlab/graphics/barcode/fourstate.py
+++ b/src/reportlab/graphics/barcode/fourstate.py
@@ -30,10 +30,6 @@
 # POSSIBILITY OF SUCH DAMAGE.
 #
 
-from reportlab.lib.units import inch
-from reportlab.graphics.barcode.common import Barcode
-import string
-
 # . 3 T Tracker
 # , 2 D Descender
 # ' 1 A Ascender
diff --git a/src/reportlab/graphics/barcode/qr.py b/src/reportlab/graphics/barcode/qr.py
index b1b4bda7..683a8b8f 100644
--- a/src/reportlab/graphics/barcode/qr.py
+++ b/src/reportlab/graphics/barcode/qr.py
@@ -23,7 +23,7 @@ import itertools
 from reportlab.platypus.flowables import Flowable
 from reportlab.graphics.shapes import Group, Rect
 from reportlab.lib import colors
-from reportlab.lib.validators import isNumber, isNumberOrNone, isColor, isString, Validator
+from reportlab.lib.validators import isNumber, isNumberOrNone, isColor, Validator
 from reportlab.lib.attrmap import AttrMap, AttrMapValue
 from reportlab.graphics.widgetbase import Widget
 from reportlab.lib.units import mm
diff --git a/src/reportlab/graphics/barcode/test.py b/src/reportlab/graphics/barcode/test.py
index 65c6eb6f..362f6d09 100644
--- a/src/reportlab/graphics/barcode/test.py
+++ b/src/reportlab/graphics/barcode/test.py
@@ -1,6 +1,6 @@
 #!/usr/pkg/bin/python
 
-import os, sys, time
+import sys, time
 
 from reportlab import Version as __RL_Version__
 from reportlab.graphics.barcode.common import *
@@ -12,19 +12,17 @@ from reportlab.graphics.barcode.usps4s import USPS_4State
 from reportlab.graphics.barcode.qr import QrCodeWidget
 from reportlab.graphics.barcode.dmtx import DataMatrixWidget, pylibdmtx
 
-
-from reportlab.platypus import Spacer, SimpleDocTemplate, Table, TableStyle, Preformatted, PageBreak
-from reportlab.lib.units import inch, cm
+from reportlab.platypus import Spacer, SimpleDocTemplate, PageBreak
+from reportlab.lib.units import inch
 from reportlab.lib import colors
 
-from reportlab.pdfgen.canvas import Canvas
 from reportlab.lib.styles import getSampleStyleSheet
 from reportlab.platypus.paragraph import Paragraph
-from reportlab.platypus.frames import Frame
 from reportlab.platypus.flowables import XBox, KeepTogether
 from reportlab.graphics.shapes import Drawing, Rect, Line
 
-from reportlab.graphics.barcode import getCodes, getCodeNames, createBarcodeDrawing, createBarcodeImageInMemory
+from reportlab.graphics.barcode import getCodeNames, createBarcodeDrawing, createBarcodeImageInMemory
+
 def run():
     styles = getSampleStyleSheet()
     styleN = styles['Normal']
diff --git a/src/reportlab/graphics/barcode/usps4s.py b/src/reportlab/graphics/barcode/usps4s.py
index 14d09985..b50135ec 100644
--- a/src/reportlab/graphics/barcode/usps4s.py
+++ b/src/reportlab/graphics/barcode/usps4s.py
@@ -4,7 +4,6 @@ from __future__ import print_function
 __version__='3.3.0'
 __all__ = ('USPS_4State',)
 
-from reportlab.lib.colors import black
 from reportlab.graphics.barcode.common import Barcode
 from reportlab.lib.utils import asNative
 
diff --git a/src/reportlab/graphics/barcode/widgets.py b/src/reportlab/graphics/barcode/widgets.py
index 2c7c162c..8a5c6b9f 100644
--- a/src/reportlab/graphics/barcode/widgets.py
+++ b/src/reportlab/graphics/barcode/widgets.py
@@ -16,11 +16,11 @@ __all__= (
         'BarcodeUSPS_4State',
         )
 
-from reportlab.lib.validators import isInt, isNumber, isColor, isString, isColorOrNone, OneOf, isBoolean, EitherOr, isNumberOrNone
+from reportlab.lib.validators import isInt, isNumber, isString, isColorOrNone, isBoolean, EitherOr, isNumberOrNone
 from reportlab.lib.attrmap import AttrMap, AttrMapValue
 from reportlab.lib.colors import black
 from reportlab.lib.utils import rl_exec
-from reportlab.graphics.shapes import Line, Rect, Group, NotImplementedError, String
+from reportlab.graphics.shapes import Rect, Group, String
 from reportlab.graphics.charts.areas import PlotArea
 
 '''
diff --git a/src/reportlab/graphics/charts/areas.py b/src/reportlab/graphics/charts/areas.py
index 8417fd40..3e1c93d9 100644
--- a/src/reportlab/graphics/charts/areas.py
+++ b/src/reportlab/graphics/charts/areas.py
@@ -5,7 +5,7 @@
 __version__='3.3.0'
 __doc__='''This module defines a Area mixin classes'''
 
-from reportlab.lib.validators import isNumber, isColor, isColorOrNone, isNoneOrShape
+from reportlab.lib.validators import isNumber, isColorOrNone, isNoneOrShape
 from reportlab.graphics.widgetbase import Widget
 from reportlab.graphics.shapes import Rect, Group, Line, Polygon
 from reportlab.lib.attrmap import AttrMap, AttrMapValue
diff --git a/src/reportlab/graphics/charts/axes.py b/src/reportlab/graphics/charts/axes.py
index 6e93e19f..15d9b370 100644
--- a/src/reportlab/graphics/charts/axes.py
+++ b/src/reportlab/graphics/charts/axes.py
@@ -34,7 +34,7 @@ the former axes in its own coordinate system.
 from math import log10 as math_log10
 from reportlab.lib.validators import    isNumber, isNumberOrNone, isListOfStringsOrNone, isListOfNumbers, \
                                         isListOfNumbersOrNone, isColorOrNone, OneOf, isBoolean, SequenceOf, \
-                                        isString, EitherOr, Validator, NoneOr, isInstanceOf, \
+                                        isString, EitherOr, Validator, NoneOr, \
                                         isNormalDate, isNoneOrCallable
 from reportlab.lib.attrmap import *
 from reportlab.lib import normalDate
@@ -45,11 +45,6 @@ from reportlab.graphics.charts.utils import nextRoundNumber
 from reportlab.graphics.widgets.grids import ShadedRect
 from reportlab.lib.colors import Color
 from reportlab.lib.utils import isSeq
-import copy
-try:
-    reduce  # Python 2.x
-except NameError:
-    from functools import reduce
 
 # Helpers.
 def _findMinMaxValue(V, x, default, func, special=None):
diff --git a/src/reportlab/graphics/charts/barcharts.py b/src/reportlab/graphics/charts/barcharts.py
index b501f0e4..68dfee1a 100644
--- a/src/reportlab/graphics/charts/barcharts.py
+++ b/src/reportlab/graphics/charts/barcharts.py
@@ -13,18 +13,17 @@ import copy, functools
 from ast import literal_eval
 
 from reportlab.lib import colors
-from reportlab.lib.validators import isNumber, isNumberOrNone, isColor, isColorOrNone, isString,\
-            isListOfStrings, SequenceOf, isBoolean, isNoneOrShape, isStringOrNone,\
+from reportlab.lib.validators import isNumber, isNumberOrNone, isColorOrNone, isString,\
+            SequenceOf, isBoolean, isStringOrNone,\
             NoneOr, isListOfNumbersOrNone, EitherOr, OneOf, isInt
-from reportlab.lib.utils import flatten, isStr, yieldNoneSplits
+from reportlab.lib.utils import isStr, yieldNoneSplits
 from reportlab.graphics.widgets.markers import uSymbol2Symbol, isSymbol
-from reportlab.lib.formatters import Formatter
 from reportlab.lib.attrmap import AttrMap, AttrMapValue
 from reportlab.pdfbase.pdfmetrics import stringWidth
-from reportlab.graphics.widgetbase import Widget, TypedPropertyCollection, PropHolder, tpcGetItem
-from reportlab.graphics.shapes import Line, Rect, Group, Drawing, NotImplementedError, PolyLine
+from reportlab.graphics.widgetbase import TypedPropertyCollection, PropHolder, tpcGetItem
+from reportlab.graphics.shapes import Line, Rect, Group, Drawing, PolyLine
 from reportlab.graphics.charts.axes import XCategoryAxis, YValueAxis, YCategoryAxis, XValueAxis
-from reportlab.graphics.charts.textlabels import BarChartLabel, NA_Label, NoneOrInstanceOfNA_Label
+from reportlab.graphics.charts.textlabels import BarChartLabel, NoneOrInstanceOfNA_Label
 from reportlab.graphics.charts.areas import PlotArea
 from reportlab.graphics.charts.legends import _objStr
 from reportlab import cmp
diff --git a/src/reportlab/graphics/charts/dotbox.py b/src/reportlab/graphics/charts/dotbox.py
index 6962d278..e8140453 100644
--- a/src/reportlab/graphics/charts/dotbox.py
+++ b/src/reportlab/graphics/charts/dotbox.py
@@ -1,4 +1,4 @@
-from reportlab.lib.colors import blue, _PCMYK_black
+from reportlab.lib.colors import _PCMYK_black
 from reportlab.graphics.charts.textlabels import Label
 from reportlab.graphics.shapes import Circle, Drawing, Group, Line, Rect, String
 from reportlab.graphics.widgetbase import Widget
diff --git a/src/reportlab/graphics/charts/doughnut.py b/src/reportlab/graphics/charts/doughnut.py
index 33c94591..c82c8d28 100644
--- a/src/reportlab/graphics/charts/doughnut.py
+++ b/src/reportlab/graphics/charts/doughnut.py
@@ -11,25 +11,15 @@ Can handle multiple series (which produce concentric 'rings' in the chart).
 
 """
 
-import copy
 from math import sin, cos, pi
 from reportlab.lib import colors
-from reportlab.lib.validators import isColor, isNumber, isListOfNumbersOrNone,\
-                                    isListOfNumbers, isColorOrNone, isString,\
-                                    isListOfStringsOrNone, OneOf, SequenceOf,\
-                                    isBoolean, isListOfColors,\
-                                    isNoneOrListOfNoneOrStrings,\
-                                    isNoneOrListOfNoneOrNumbers,\
-                                    isNumberOrNone, isListOfNoneOrNumber,\
+from reportlab.lib.validators import isNumber, isListOfStringsOrNone, OneOf,\
+                                    isBoolean, isNumberOrNone, isListOfNoneOrNumber,\
                                     isListOfListOfNoneOrNumber, EitherOr
 from reportlab.lib.attrmap import *
-from reportlab.pdfgen.canvas import Canvas
-from reportlab.graphics.shapes import Group, Drawing, Line, Rect, Polygon, Ellipse, \
-    Wedge, String, SolidShape, UserNode, STATE_DEFAULTS
-from reportlab.graphics.widgetbase import Widget, TypedPropertyCollection, PropHolder
+from reportlab.graphics.shapes import Group, Drawing, Wedge
+from reportlab.graphics.widgetbase import TypedPropertyCollection
 from reportlab.graphics.charts.piecharts import AbstractPieChart, WedgeProperties, _addWedgeLabel, fixLabelOverlaps
-from reportlab.graphics.charts.textlabels import Label
-from reportlab.graphics.widgets.markers import Marker
 from functools import reduce
 
 class SectorProperties(WedgeProperties):
diff --git a/src/reportlab/graphics/charts/legends.py b/src/reportlab/graphics/charts/legends.py
index bc7e4494..1c96accb 100644
--- a/src/reportlab/graphics/charts/legends.py
+++ b/src/reportlab/graphics/charts/legends.py
@@ -5,21 +5,19 @@
 __version__='3.3.0'
 __doc__="""This will be a collection of legends to be used with charts."""
 
-import copy, operator
+import copy
 
 from reportlab.lib import colors
 from reportlab.lib.validators import isNumber, OneOf, isString, isColorOrNone,\
-        isNumberOrNone, isListOfNumbersOrNone, isStringOrNone, isBoolean,\
+        isNumberOrNone, isListOfNumbersOrNone, isBoolean,\
         EitherOr, NoneOr, AutoOr, isAuto, Auto, isBoxAnchor, SequenceOf, isInstanceOf
 from reportlab.lib.attrmap import *
 from reportlab.pdfbase.pdfmetrics import stringWidth, getFont
 from reportlab.graphics.widgetbase import Widget, TypedPropertyCollection, PropHolder
 from reportlab.graphics.shapes import Drawing, Group, String, Rect, Line, STATE_DEFAULTS
-from reportlab.graphics.charts.areas import PlotArea
 from reportlab.graphics.widgets.markers import uSymbol2Symbol, isSymbol
 from reportlab.lib.utils import isSeq, find_locals, isStr, asNative
 from reportlab.graphics.shapes import _baseGFontName
-from functools import reduce
 
 def _transMax(n,A):
     X = n*[0]
@@ -608,7 +606,6 @@ class LineSwatch(Widget):
 
     def __init__(self):
         from reportlab.lib.colors import red
-        from reportlab.graphics.shapes import Line
         self.x = 0
         self.y = 0
         self.width  = 20
diff --git a/src/reportlab/graphics/charts/linecharts.py b/src/reportlab/graphics/charts/linecharts.py
index 2b081a95..f2b5f6c4 100644
--- a/src/reportlab/graphics/charts/linecharts.py
+++ b/src/reportlab/graphics/charts/linecharts.py
@@ -6,12 +6,12 @@ __version__='3.3.0'
 __doc__="""This modules defines a very preliminary Line Chart example."""
 
 from reportlab.lib import colors
-from reportlab.lib.validators import isNumber, isNumberOrNone, isColor, isColorOrNone, isListOfStrings, \
-                                    isListOfStringsOrNone, SequenceOf, isBoolean, NoneOr, \
+from reportlab.lib.validators import isNumber, isNumberOrNone, isColorOrNone, \
+                                    isListOfStringsOrNone, isBoolean, NoneOr, \
                                     isListOfNumbersOrNone, isStringOrNone, OneOf, Percentage
 from reportlab.lib.attrmap import *
 from reportlab.lib.utils import flatten
-from reportlab.graphics.widgetbase import Widget, TypedPropertyCollection, PropHolder, tpcGetItem
+from reportlab.graphics.widgetbase import TypedPropertyCollection, PropHolder, tpcGetItem
 from reportlab.graphics.shapes import Line, Rect, Group, Drawing, Polygon, PolyLine
 from reportlab.graphics.widgets.signsandsymbols import NoEntry
 from reportlab.graphics.charts.axes import XCategoryAxis, YValueAxis
diff --git a/src/reportlab/graphics/charts/lineplots.py b/src/reportlab/graphics/charts/lineplots.py
index 93f1c23d..2ded66ec 100644
--- a/src/reportlab/graphics/charts/lineplots.py
+++ b/src/reportlab/graphics/charts/lineplots.py
@@ -5,19 +5,17 @@
 __version__='3.3.0'
 __doc__="""This module defines a very preliminary Line Plot example."""
 
-import string, time
-
 from reportlab.lib import colors
 from reportlab.lib.validators import *
 from reportlab.lib.attrmap import *
 from reportlab.lib.utils import flatten, isStr
-from reportlab.graphics.shapes import Drawing, Group, Rect, Line, PolyLine, Polygon, _SetKeyWordArgs
-from reportlab.graphics.widgetbase import Widget, TypedPropertyCollection, PropHolder, tpcGetItem
+from reportlab.graphics.shapes import Drawing, Group, Rect, PolyLine, Polygon, _SetKeyWordArgs
+from reportlab.graphics.widgetbase import TypedPropertyCollection, PropHolder, tpcGetItem
 from reportlab.graphics.charts.textlabels import Label
 from reportlab.graphics.charts.axes import XValueAxis, YValueAxis, AdjYValueAxis, NormalDateXValueAxis
 from reportlab.graphics.charts.utils import *
-from reportlab.graphics.widgets.markers import uSymbol2Symbol, isSymbol, makeMarker
-from reportlab.graphics.widgets.grids import Grid, DoubleGrid, ShadedRect, ShadedPolygon
+from reportlab.graphics.widgets.markers import uSymbol2Symbol, makeMarker
+from reportlab.graphics.widgets.grids import Grid, DoubleGrid, ShadedPolygon
 from reportlab.pdfbase.pdfmetrics import stringWidth, getFont
 from reportlab.graphics.charts.areas import PlotArea
 from .utils import FillPairedData
diff --git a/src/reportlab/graphics/charts/markers.py b/src/reportlab/graphics/charts/markers.py
index 8e709bb0..10979dfd 100644
--- a/src/reportlab/graphics/charts/markers.py
+++ b/src/reportlab/graphics/charts/markers.py
@@ -10,7 +10,7 @@ the smiley.
 """
 
 from reportlab.lib import colors
-from reportlab.graphics.shapes import Rect, Line, Circle, Polygon
+from reportlab.graphics.shapes import Rect, Circle, Polygon
 from reportlab.graphics.widgets.signsandsymbols import SmileyFace
 
 
diff --git a/src/reportlab/graphics/charts/piecharts.py b/src/reportlab/graphics/charts/piecharts.py
index 3856a6cb..b60207c3 100644
--- a/src/reportlab/graphics/charts/piecharts.py
+++ b/src/reportlab/graphics/charts/piecharts.py
@@ -13,13 +13,13 @@ This permits you to customize and pop out individual wedges;
 supports elliptical and circular pies.
 """
 
-import copy, functools
+import functools
 from math import sin, cos, pi
 
 from reportlab.lib import colors
-from reportlab.lib.validators import isColor, isNumber, isListOfNumbersOrNone,\
+from reportlab.lib.validators import isNumber, isListOfNumbersOrNone,\
                                     isListOfNumbers, isColorOrNone, isString,\
-                                    isListOfStringsOrNone, OneOf, SequenceOf,\
+                                    isListOfStringsOrNone, OneOf,\
                                     isBoolean, isListOfColors, isNumberOrNone,\
                                     isNoneOrListOfNoneOrStrings, isTextAnchor,\
                                     isNoneOrListOfNoneOrNumbers, isBoxAnchor,\
@@ -27,9 +27,8 @@ from reportlab.lib.validators import isColor, isNumber, isListOfNumbersOrNone,\
                                     isNumberInRange
 from reportlab.graphics.widgets.markers import uSymbol2Symbol, isSymbol
 from reportlab.lib.attrmap import *
-from reportlab.pdfgen.canvas import Canvas
 from reportlab.graphics.shapes import Group, Drawing, Ellipse, Wedge, String, STATE_DEFAULTS, ArcPath, Polygon, Rect, PolyLine, Line
-from reportlab.graphics.widgetbase import Widget, TypedPropertyCollection, PropHolder
+from reportlab.graphics.widgetbase import TypedPropertyCollection, PropHolder
 from reportlab.graphics.charts.areas import PlotArea
 from reportlab.graphics.charts.legends import _objStr
 from reportlab.graphics.charts.textlabels import Label
@@ -1091,7 +1090,7 @@ class LegendedPie(Pie):
         drawing.add(self.draw())
         return drawing
 
-from reportlab.graphics.charts.utils3d import _getShaded, _2rad, _360, _pi_2, _2pi, _180_pi
+from reportlab.graphics.charts.utils3d import _getShaded, _2rad, _360, _180_pi
 class Wedge3dProperties(PropHolder):
     """This holds descriptive information about the wedges in a pie chart.
 
diff --git a/src/reportlab/graphics/charts/slidebox.py b/src/reportlab/graphics/charts/slidebox.py
index 309fb07b..f48bba69 100644
--- a/src/reportlab/graphics/charts/slidebox.py
+++ b/src/reportlab/graphics/charts/slidebox.py
@@ -1,12 +1,12 @@
-from reportlab.lib.colors import Color, white, black
-from reportlab.graphics.charts.textlabels import Label
-from reportlab.graphics.shapes import Polygon, Line, Circle, String, Drawing, PolyLine, Group, Rect
-from reportlab.graphics.widgetbase import Widget, TypedPropertyCollection
+from reportlab.lib import colors
+from reportlab.lib.colors import black, white
+from reportlab.graphics.shapes import Polygon, String, Drawing, Group, Rect
+from reportlab.graphics.widgetbase import Widget
 from reportlab.lib.attrmap import *
 from reportlab.lib.validators import *
 from reportlab.lib.units import cm
-from reportlab.pdfbase.pdfmetrics import stringWidth, getFont
-from reportlab.graphics.widgets.grids import ShadedRect, Grid
+from reportlab.pdfbase.pdfmetrics import getFont
+from reportlab.graphics.widgets.grids import ShadedRect
 
 class SlideBox(Widget):
     """Returns a slidebox widget"""
@@ -91,7 +91,6 @@ class SlideBox(Widget):
         return colorsList
 
     def demo(self,drawing=None):
-        from reportlab.lib import colors
         if not drawing:
             tx,ty=self._getDrawingDimensions()
             drawing = Drawing(tx,ty)
diff --git a/src/reportlab/graphics/charts/spider.py b/src/reportlab/graphics/charts/spider.py
index afb40937..bf3bbd1b 100644
--- a/src/reportlab/graphics/charts/spider.py
+++ b/src/reportlab/graphics/charts/spider.py
@@ -11,23 +11,18 @@ When there is more than one series, place the series with the largest
 numbers first, as it will be overdrawn by each successive one.
 """
 
-import copy
 from math import sin, cos, pi
 
 from reportlab.lib import colors
-from reportlab.lib.validators import isColor, isNumber, isListOfNumbersOrNone,\
-                                    isListOfNumbers, isColorOrNone, isString,\
-                                    isListOfStringsOrNone, OneOf, SequenceOf,\
-                                    isBoolean, isListOfColors, isNumberOrNone,\
-                                    isNoneOrListOfNoneOrStrings, isTextAnchor,\
-                                    isNoneOrListOfNoneOrNumbers, isBoxAnchor,\
+from reportlab.lib.validators import isNumber, isListOfNumbersOrNone,\
+                                    isColorOrNone, isListOfStringsOrNone, OneOf,\
+                                    isBoolean, isNumberOrNone,\
                                     isStringOrNone, isStringOrNone, EitherOr,\
                                     isCallable
 from reportlab.lib.attrmap import *
-from reportlab.pdfgen.canvas import Canvas
-from reportlab.graphics.shapes import Group, Drawing, Line, Rect, Polygon, PolyLine, Ellipse, \
-    Wedge, String, STATE_DEFAULTS
-from reportlab.graphics.widgetbase import Widget, TypedPropertyCollection, PropHolder
+from reportlab.graphics.shapes import Group, Drawing, Line, Rect, Polygon, PolyLine, \
+    STATE_DEFAULTS
+from reportlab.graphics.widgetbase import TypedPropertyCollection, PropHolder
 from reportlab.graphics.charts.areas import PlotArea
 from reportlab.graphics.charts.legends import _objStr
 from reportlab.graphics.charts.piecharts import WedgeLabel
diff --git a/src/reportlab/graphics/charts/textlabels.py b/src/reportlab/graphics/charts/textlabels.py
index 9e529606..88431efc 100644
--- a/src/reportlab/graphics/charts/textlabels.py
+++ b/src/reportlab/graphics/charts/textlabels.py
@@ -2,26 +2,22 @@
 #see license.txt for license details
 #history https://hg.reportlab.com/hg-public/reportlab/log/tip/src/reportlab/graphics/charts/textlabels.py
 __version__='3.3.0'
-import string
 
 from reportlab.lib import colors
-from reportlab.lib.utils import simpleSplit, _simpleSplit
+from reportlab.lib.utils import simpleSplit
 from reportlab.lib.validators import isNumber, isNumberOrNone, OneOf, isColorOrNone, isString, \
         isTextAnchor, isBoxAnchor, isBoolean, NoneOr, isInstanceOf, isNoneOrString, isNoneOrCallable, \
-        isSubclassOf, EitherOr
+        isSubclassOf
 from reportlab.lib.attrmap import *
-from reportlab.pdfbase.pdfmetrics import stringWidth, getAscentDescent, getFont
+from reportlab.pdfbase.pdfmetrics import stringWidth, getAscentDescent
 from reportlab.graphics.shapes import Drawing, Group, Circle, Rect, String, STATE_DEFAULTS
 from reportlab.graphics.widgetbase import Widget, PropHolder
-from reportlab.graphics.shapes import _baseGFontName, DirectDraw
-from reportlab.platypus import XPreformatted, Paragraph, Flowable
+from reportlab.graphics.shapes import DirectDraw
+from reportlab.platypus import XPreformatted, Flowable
 from reportlab.lib.styles import ParagraphStyle, PropertySet
 from reportlab.lib.enums import TA_LEFT, TA_RIGHT, TA_CENTER
 _ta2al = dict(start=TA_LEFT,end=TA_RIGHT,middle=TA_CENTER)
-from ..utils import (text2Path as _text2Path,   #here for continuity
-                    pathNumTrunc as _pathNumTrunc,
-                    processGlyph as _processGlyph,
-                    text2PathDescription as _text2PathDescription)
+from ..utils import text2Path as _text2Path   #here for continuity
 
 _A2BA=  {
         'x': {0:'n', 45:'ne', 90:'e', 135:'se', 180:'s', 225:'sw', 270:'w', 315: 'nw', -45: 'nw'},
@@ -369,7 +365,6 @@ class LabelDecorator:
         g.add(L)
 
     def __call__(self,l):
-        from copy import deepcopy
         L = Label()
         for a,v in self.__dict__.items():
             if v is None: v = getattr(l,a,None)
diff --git a/src/reportlab/graphics/charts/utils.py b/src/reportlab/graphics/charts/utils.py
index 8492ba9a..7541f693 100644
--- a/src/reportlab/graphics/charts/utils.py
+++ b/src/reportlab/graphics/charts/utils.py
@@ -5,9 +5,9 @@
 __version__='3.3.0'
 __doc__="Utilities used here and there."
 from time import mktime, gmtime, strftime
-from math import log10, pi, floor, sin, cos, sqrt, hypot
+from math import log10, pi, floor, sin, cos, hypot
 import weakref
-from reportlab.graphics.shapes import transformPoint, transformPoints, inverse, Ellipse, Group, String, Path, numericXShift
+from reportlab.graphics.shapes import transformPoints, inverse, Ellipse, Group, String, numericXShift
 from reportlab.lib.utils import flatten
 from reportlab.pdfbase.pdfmetrics import stringWidth
 
diff --git a/src/reportlab/graphics/charts/utils3d.py b/src/reportlab/graphics/charts/utils3d.py
index c570d1c2..93b9530b 100644
--- a/src/reportlab/graphics/charts/utils3d.py
+++ b/src/reportlab/graphics/charts/utils3d.py
@@ -1,7 +1,4 @@
-from reportlab.lib import colors
-from reportlab.lib.attrmap import *
-from reportlab.pdfgen.canvas import Canvas
-from reportlab.graphics.shapes import Group, Drawing, Ellipse, Wedge, String, STATE_DEFAULTS, Polygon, Line
+from reportlab.graphics.shapes import Drawing, Polygon, Line
 
 def _getShaded(col,shd=None,shading=0.1):
     if shd is None:
@@ -98,7 +95,7 @@ def _make_3d_line_info( G, x0, x1, y0, y1, z0, z1,
         x_0 = x_1
         y_0 = y_1
 
-from math import pi, sin, cos
+from math import pi
 _pi_2 = pi*0.5
 _2pi = 2*pi
 _180_pi=180./pi
diff --git a/src/reportlab/graphics/renderPDF.py b/src/reportlab/graphics/renderPDF.py
index dc6aa062..73d215b4 100644
--- a/src/reportlab/graphics/renderPDF.py
+++ b/src/reportlab/graphics/renderPDF.py
@@ -21,7 +21,7 @@ from reportlab.graphics.shapes import *
 from reportlab.pdfgen.canvas import Canvas
 from reportlab.pdfbase.pdfmetrics import stringWidth
 from reportlab import rl_config
-from reportlab.graphics.renderbase import Renderer, StateTracker, getStateDelta, renderScaledDrawing, STATE_DEFAULTS
+from reportlab.graphics.renderbase import Renderer, getStateDelta, renderScaledDrawing, STATE_DEFAULTS
 
 # the main entry point for users...
 def draw(drawing, canvas, x, y, showBoundary=rl_config._unset_):
diff --git a/src/reportlab/graphics/renderPM.py b/src/reportlab/graphics/renderPM.py
index 650c2d9f..cc026a06 100644
--- a/src/reportlab/graphics/renderPM.py
+++ b/src/reportlab/graphics/renderPM.py
@@ -13,15 +13,15 @@ Other functions let you create a PM drawing as string or into a PM buffer.
 Execute the script to see some test drawings."""
 
 from reportlab.graphics.shapes import *
-from reportlab.graphics.renderbase import StateTracker, getStateDelta, renderScaledDrawing
+from reportlab.graphics.renderbase import getStateDelta, renderScaledDrawing
 from reportlab.pdfbase.pdfmetrics import getFont, unicode2T1
-from math import sin, cos, pi, ceil
-from reportlab.lib.utils import open_and_read, isUnicode
+from reportlab.lib.utils import isUnicode
 from reportlab import rl_config
 from .utils import setFont as _setFont, RenderPMError
 
 import os, sys
 from io import BytesIO, StringIO
+from math import sin, cos, pi, ceil
 
 try:
     from reportlab.graphics import _renderPM
diff --git a/src/reportlab/graphics/renderPS.py b/src/reportlab/graphics/renderPS.py
index 17592917..36ff6c46 100644
--- a/src/reportlab/graphics/renderPS.py
+++ b/src/reportlab/graphics/renderPS.py
@@ -4,17 +4,16 @@
 __version__='3.3.0'
 __doc__="""Render drawing objects in Postscript"""
 
+import math
+from io import BytesIO, StringIO
 from reportlab.pdfbase.pdfmetrics import getFont, stringWidth, unicode2T1 # for font info
 from reportlab.lib.utils import asBytes, char2int, rawBytes, asNative, isUnicode
 from reportlab.lib.rl_accel import fp_str
-from reportlab.lib.colors import black
-from reportlab.graphics.renderbase import Renderer, StateTracker, getStateDelta, renderScaledDrawing
+from reportlab.graphics.renderbase import Renderer, getStateDelta, renderScaledDrawing
 from reportlab.graphics.shapes import STATE_DEFAULTS
-import math
-from io import BytesIO, StringIO
-from operator import getitem
 from reportlab import rl_config
-from reportlab.pdfgen.canvas import FILL_EVEN_ODD, FILL_NON_ZERO
+from reportlab.pdfgen.canvas import FILL_EVEN_ODD
+
 _ESCAPEDICT={}
 for c in range(256):
     if c<32 or c>=127:
diff --git a/src/reportlab/graphics/renderSVG.py b/src/reportlab/graphics/renderSVG.py
index c895a79e..a85d1ea0 100644
--- a/src/reportlab/graphics/renderSVG.py
+++ b/src/reportlab/graphics/renderSVG.py
@@ -7,15 +7,13 @@ objects download the svglib module here:
   http://python.net/~gherman/#svglib
 """
 
-import math, types, sys, os, codecs, base64
+import math, sys, os, codecs, base64
 from io import BytesIO, StringIO
-from operator import getitem
 
 from reportlab.pdfbase.pdfmetrics import stringWidth # for font info
 from reportlab.lib.rl_accel import fp_str
-from reportlab.lib.colors import black
 from reportlab.lib.utils import asNative
-from reportlab.graphics.renderbase import StateTracker, getStateDelta, Renderer, renderScaledDrawing
+from reportlab.graphics.renderbase import getStateDelta, Renderer, renderScaledDrawing
 from reportlab.graphics.shapes import STATE_DEFAULTS, Path, UserNode
 from reportlab.graphics.shapes import * # (only for test0)
 from reportlab import rl_config
diff --git a/src/reportlab/graphics/samples/bubble.py b/src/reportlab/graphics/samples/bubble.py
index b6bd6ac1..57bc012a 100644
--- a/src/reportlab/graphics/samples/bubble.py
+++ b/src/reportlab/graphics/samples/bubble.py
@@ -1,7 +1,7 @@
 #Autogenerated by ReportLab guiedit do not edit
 from reportlab.graphics.charts.legends import Legend
 from reportlab.graphics.charts.lineplots import ScatterPlot
-from reportlab.graphics.shapes import Drawing, _DrawingEditorMixin, String
+from reportlab.graphics.shapes import Drawing, _DrawingEditorMixin
 from reportlab.graphics.charts.textlabels import Label
 from reportlab.graphics.samples.excelcolors import *
 
diff --git a/src/reportlab/graphics/samples/clustered_bar.py b/src/reportlab/graphics/samples/clustered_bar.py
index 11c7caac..e5783613 100644
--- a/src/reportlab/graphics/samples/clustered_bar.py
+++ b/src/reportlab/graphics/samples/clustered_bar.py
@@ -2,7 +2,7 @@
 from reportlab.graphics.charts.legends import Legend
 from reportlab.graphics.samples.excelcolors import *
 from reportlab.graphics.charts.barcharts import HorizontalBarChart
-from reportlab.graphics.shapes import Drawing, _DrawingEditorMixin, String
+from reportlab.graphics.shapes import Drawing, _DrawingEditorMixin
 from reportlab.graphics.charts.textlabels import Label
 
 class ClusteredBar(_DrawingEditorMixin,Drawing):
diff --git a/src/reportlab/graphics/samples/clustered_column.py b/src/reportlab/graphics/samples/clustered_column.py
index 3aa95a42..055f1ea7 100644
--- a/src/reportlab/graphics/samples/clustered_column.py
+++ b/src/reportlab/graphics/samples/clustered_column.py
@@ -2,7 +2,7 @@
 from reportlab.graphics.charts.legends import Legend
 from reportlab.graphics.samples.excelcolors import *
 from reportlab.graphics.charts.barcharts import VerticalBarChart
-from reportlab.graphics.shapes import Drawing, _DrawingEditorMixin, String
+from reportlab.graphics.shapes import Drawing, _DrawingEditorMixin
 from reportlab.graphics.charts.textlabels import Label
 
 class ClusteredColumn(_DrawingEditorMixin,Drawing):
diff --git a/src/reportlab/graphics/samples/excelcolors.py b/src/reportlab/graphics/samples/excelcolors.py
index f3f4f5b6..23b0213c 100644
--- a/src/reportlab/graphics/samples/excelcolors.py
+++ b/src/reportlab/graphics/samples/excelcolors.py
@@ -1,5 +1,5 @@
 # define standard colors to mimic those used by Microsoft Excel
-from reportlab.lib.colors import CMYKColor, PCMYKColor
+from reportlab.lib.colors import PCMYKColor
 
 #colour names as comments at the end of each line are as a memory jogger ONLY
 #NOT HTML named colours!
diff --git a/src/reportlab/graphics/samples/exploded_pie.py b/src/reportlab/graphics/samples/exploded_pie.py
index f4dc30a3..c4d99bc7 100644
--- a/src/reportlab/graphics/samples/exploded_pie.py
+++ b/src/reportlab/graphics/samples/exploded_pie.py
@@ -3,7 +3,7 @@ from reportlab.graphics.charts.piecharts import Pie
 from reportlab.graphics.samples.excelcolors import *
 from reportlab.graphics.widgets.grids import ShadedRect
 from reportlab.graphics.charts.legends import Legend
-from reportlab.graphics.shapes import Drawing, _DrawingEditorMixin, String
+from reportlab.graphics.shapes import Drawing, _DrawingEditorMixin
 from reportlab.graphics.charts.textlabels import Label
 
 class ExplodedPie(_DrawingEditorMixin,Drawing):
diff --git a/src/reportlab/graphics/samples/filled_radar.py b/src/reportlab/graphics/samples/filled_radar.py
index 78d0d427..7761a4a5 100644
--- a/src/reportlab/graphics/samples/filled_radar.py
+++ b/src/reportlab/graphics/samples/filled_radar.py
@@ -1,7 +1,7 @@
 #Autogenerated by ReportLab guiedit do not edit
 from reportlab.graphics.charts.legends import Legend
 from reportlab.graphics.charts.spider import SpiderChart
-from reportlab.graphics.shapes import Drawing, _DrawingEditorMixin, String
+from reportlab.graphics.shapes import Drawing, _DrawingEditorMixin
 from reportlab.graphics.charts.textlabels import Label
 from reportlab.graphics.samples.excelcolors import *
 
diff --git a/src/reportlab/graphics/samples/line_chart.py b/src/reportlab/graphics/samples/line_chart.py
index 6122bc81..dc6bcab0 100644
--- a/src/reportlab/graphics/samples/line_chart.py
+++ b/src/reportlab/graphics/samples/line_chart.py
@@ -1,7 +1,7 @@
 #Autogenerated by ReportLab guiedit do not edit
 from reportlab.graphics.charts.legends import Legend
 from reportlab.graphics.charts.lineplots import LinePlot
-from reportlab.graphics.shapes import Drawing, _DrawingEditorMixin, String
+from reportlab.graphics.shapes import Drawing, _DrawingEditorMixin
 from reportlab.graphics.charts.textlabels import Label
 from reportlab.graphics.samples.excelcolors import *
 
diff --git a/src/reportlab/graphics/samples/linechart_with_markers.py b/src/reportlab/graphics/samples/linechart_with_markers.py
index 56871b65..981e69ac 100644
--- a/src/reportlab/graphics/samples/linechart_with_markers.py
+++ b/src/reportlab/graphics/samples/linechart_with_markers.py
@@ -1,7 +1,7 @@
 #Autogenerated by ReportLab guiedit do not edit
 from reportlab.graphics.charts.legends import Legend
 from reportlab.graphics.charts.lineplots import LinePlot
-from reportlab.graphics.shapes import Drawing, _DrawingEditorMixin, String
+from reportlab.graphics.shapes import Drawing, _DrawingEditorMixin
 from reportlab.graphics.widgets.markers import makeMarker
 from reportlab.graphics.charts.textlabels import Label
 from reportlab.graphics.samples.excelcolors import *
diff --git a/src/reportlab/graphics/samples/radar.py b/src/reportlab/graphics/samples/radar.py
index adbf8f9f..b7480546 100644
--- a/src/reportlab/graphics/samples/radar.py
+++ b/src/reportlab/graphics/samples/radar.py
@@ -2,7 +2,7 @@
 from reportlab.graphics.charts.legends import Legend
 from reportlab.graphics.samples.excelcolors import *
 from reportlab.graphics.charts.spider import SpiderChart
-from reportlab.graphics.shapes import Drawing, _DrawingEditorMixin, String
+from reportlab.graphics.shapes import Drawing, _DrawingEditorMixin
 from reportlab.graphics.charts.textlabels import Label
 
 class RadarChart(_DrawingEditorMixin,Drawing):
diff --git a/src/reportlab/graphics/samples/runall.py b/src/reportlab/graphics/samples/runall.py
index e305a37f..9d6400a5 100644
--- a/src/reportlab/graphics/samples/runall.py
+++ b/src/reportlab/graphics/samples/runall.py
@@ -3,7 +3,6 @@
 import sys
 import glob
 import inspect
-import types
 
 def moduleClasses(mod):
     def P(obj, m=mod.__name__, CT=type):
diff --git a/src/reportlab/graphics/samples/scatter.py b/src/reportlab/graphics/samples/scatter.py
index 1e227c1b..a5a17f02 100644
--- a/src/reportlab/graphics/samples/scatter.py
+++ b/src/reportlab/graphics/samples/scatter.py
@@ -1,7 +1,7 @@
 #Autogenerated by ReportLab guiedit do not edit
 from reportlab.graphics.charts.legends import Legend
 from reportlab.graphics.charts.lineplots import ScatterPlot
-from reportlab.graphics.shapes import Drawing, _DrawingEditorMixin, String
+from reportlab.graphics.shapes import Drawing, _DrawingEditorMixin
 from reportlab.graphics.charts.textlabels import Label
 from reportlab.graphics.samples.excelcolors import *
 
diff --git a/src/reportlab/graphics/samples/scatter_lines.py b/src/reportlab/graphics/samples/scatter_lines.py
index 550b7931..b435625b 100644
--- a/src/reportlab/graphics/samples/scatter_lines.py
+++ b/src/reportlab/graphics/samples/scatter_lines.py
@@ -1,7 +1,7 @@
 #Autogenerated by ReportLab guiedit do not edit
 from reportlab.graphics.charts.legends import Legend
 from reportlab.graphics.charts.lineplots import ScatterPlot
-from reportlab.graphics.shapes import Drawing, _DrawingEditorMixin, String
+from reportlab.graphics.shapes import Drawing, _DrawingEditorMixin
 from reportlab.graphics.charts.textlabels import Label
 from reportlab.graphics.samples.excelcolors import *
 
diff --git a/src/reportlab/graphics/samples/scatter_lines_markers.py b/src/reportlab/graphics/samples/scatter_lines_markers.py
index 5686e4d8..53406056 100644
--- a/src/reportlab/graphics/samples/scatter_lines_markers.py
+++ b/src/reportlab/graphics/samples/scatter_lines_markers.py
@@ -1,7 +1,7 @@
 #Autogenerated by ReportLab guiedit do not edit
 from reportlab.graphics.charts.legends import Legend
 from reportlab.graphics.charts.lineplots import ScatterPlot
-from reportlab.graphics.shapes import Drawing, _DrawingEditorMixin, String
+from reportlab.graphics.shapes import Drawing, _DrawingEditorMixin
 from reportlab.graphics.charts.textlabels import Label
 from reportlab.graphics.samples.excelcolors import *
 
diff --git a/src/reportlab/graphics/samples/simple_pie.py b/src/reportlab/graphics/samples/simple_pie.py
index 57f5ae74..670beba5 100644
--- a/src/reportlab/graphics/samples/simple_pie.py
+++ b/src/reportlab/graphics/samples/simple_pie.py
@@ -2,7 +2,7 @@
 from reportlab.graphics.charts.piecharts import Pie
 from reportlab.graphics.widgets.grids import ShadedRect
 from reportlab.graphics.charts.legends import Legend
-from reportlab.graphics.shapes import Drawing, _DrawingEditorMixin, String
+from reportlab.graphics.shapes import Drawing, _DrawingEditorMixin
 from reportlab.graphics.charts.textlabels import Label
 from reportlab.graphics.samples.excelcolors import *
 
diff --git a/src/reportlab/graphics/samples/stacked_bar.py b/src/reportlab/graphics/samples/stacked_bar.py
index c5ec9c6a..d1756518 100644
--- a/src/reportlab/graphics/samples/stacked_bar.py
+++ b/src/reportlab/graphics/samples/stacked_bar.py
@@ -1,7 +1,7 @@
 #Autogenerated by ReportLab guiedit do not edit
 from reportlab.graphics.charts.legends import Legend
 from reportlab.graphics.charts.barcharts import HorizontalBarChart
-from reportlab.graphics.shapes import Drawing, _DrawingEditorMixin, String
+from reportlab.graphics.shapes import Drawing, _DrawingEditorMixin
 from reportlab.graphics.charts.textlabels import Label
 from reportlab.graphics.samples.excelcolors import *
 
diff --git a/src/reportlab/graphics/samples/stacked_column.py b/src/reportlab/graphics/samples/stacked_column.py
index f6028434..70246c66 100644
--- a/src/reportlab/graphics/samples/stacked_column.py
+++ b/src/reportlab/graphics/samples/stacked_column.py
@@ -1,7 +1,7 @@
 #Autogenerated by ReportLab guiedit do not edit
 from reportlab.graphics.charts.legends import Legend
 from reportlab.graphics.charts.barcharts import VerticalBarChart
-from reportlab.graphics.shapes import Drawing, _DrawingEditorMixin, String
+from reportlab.graphics.shapes import Drawing, _DrawingEditorMixin
 from reportlab.graphics.charts.textlabels import Label
 from reportlab.graphics.samples.excelcolors import *
 
diff --git a/src/reportlab/graphics/shapes.py b/src/reportlab/graphics/shapes.py
index 30fbb33a..e3f956b3 100644
--- a/src/reportlab/graphics/shapes.py
+++ b/src/reportlab/graphics/shapes.py
@@ -7,7 +7,6 @@ __doc__='''Core of the graphics library - defines Drawing and Shapes'''
 
 import os, sys
 from math import pi, cos, sin, sqrt, radians, floor
-from pprint import pprint
 
 from reportlab.platypus import Flowable
 from reportlab.rl_config import shapeChecking, verbose, defaultGraphicsFontName as _baseGFontName, _unset_, decimalSymbol
@@ -25,9 +24,6 @@ _baseGFontNameB = tt2ps(_baseGFontName,1,0)
 _baseGFontNameI = tt2ps(_baseGFontName,0,1)
 _baseGFontNameBI = tt2ps(_baseGFontName,1,1)
 
-class NotImplementedError(Exception):
-    pass
-
 # two constants for filling rules
 NON_ZERO_WINDING = 'Non-Zero Winding'
 EVEN_ODD = 'Even-Odd'
@@ -389,7 +385,6 @@ class Group(Shape):
 
     def _explode(self):
         ''' return a fully expanded object'''
-        from reportlab.graphics.widgetbase import Widget
         obj = Group()
         if hasattr(self,'__label__'):
             obj.__label__=self.__label__
diff --git a/src/reportlab/graphics/testshapes.py b/src/reportlab/graphics/testshapes.py
index c33cb667..e8744bd8 100644
--- a/src/reportlab/graphics/testshapes.py
+++ b/src/reportlab/graphics/testshapes.py
@@ -15,7 +15,7 @@ but we will expand them to try and trip up any parser.
 Feel free to add more.
 '''
 
-import os, sys, base64
+import os, sys
 from io import BytesIO
 
 from reportlab.lib import colors
@@ -23,9 +23,7 @@ from reportlab.lib.units import cm
 from reportlab.lib.utils import asNative, base64_decodebytes
 from reportlab.pdfgen.canvas import Canvas
 from reportlab.pdfbase.pdfmetrics import stringWidth
-from reportlab.platypus import Flowable
 from reportlab.graphics.shapes import *
-from reportlab.graphics.renderPDF import _PDFRenderer
 import unittest
 
 _FONTS = ['Times-Roman','Vera','Times-BoldItalic',]
diff --git a/src/reportlab/graphics/widgetbase.py b/src/reportlab/graphics/widgetbase.py
index bbbcd78c..977e906d 100644
--- a/src/reportlab/graphics/widgetbase.py
+++ b/src/reportlab/graphics/widgetbase.py
@@ -141,11 +141,11 @@ class Widget(PropHolder, shapes.UserNode):
 
     def draw(self):
         msg = "draw() must be implemented for each Widget!"
-        raise shapes.NotImplementedError(msg)
+        raise NotImplementedError(msg)
 
     def demo(self):
         msg = "demo() must be implemented for each Widget!"
-        raise shapes.NotImplementedError(msg)
+        raise NotImplementedError(msg)
 
     def provideNode(self):
         return self.draw()
diff --git a/src/reportlab/graphics/widgets/adjustableArrow.py b/src/reportlab/graphics/widgets/adjustableArrow.py
index e46fb5ca..bdd18c9f 100644
--- a/src/reportlab/graphics/widgets/adjustableArrow.py
+++ b/src/reportlab/graphics/widgets/adjustableArrow.py
@@ -1,7 +1,6 @@
 from reportlab.lib import colors
 from reportlab.lib.validators import *
 from reportlab.lib.attrmap import *
-from reportlab.lib.utils import flatten
 from reportlab.graphics.shapes import Drawing, _DrawingEditorMixin, Group, Polygon
 from reportlab.graphics.widgetbase import Widget
 
diff --git a/src/reportlab/graphics/widgets/eventcal.py b/src/reportlab/graphics/widgets/eventcal.py
index 8524ba33..55758b1c 100644
--- a/src/reportlab/graphics/widgets/eventcal.py
+++ b/src/reportlab/graphics/widgets/eventcal.py
@@ -8,14 +8,9 @@ __doc__="""This file is a
 """
 
 from reportlab.lib import colors
-from reportlab.lib.validators import *
-from reportlab.lib.attrmap import *
-from reportlab.graphics.shapes import Line, Rect, Polygon, Drawing, Group, String, Circle, Wedge
+from reportlab.graphics.shapes import Rect, Drawing, Group, String
 from reportlab.graphics.charts.textlabels import Label
 from reportlab.graphics.widgetbase import Widget
-from reportlab.graphics import renderPDF
-
-
 
 
 class EventCalendar(Widget):
diff --git a/src/reportlab/graphics/widgets/flags.py b/src/reportlab/graphics/widgets/flags.py
index b9cddd7e..7afd6b5a 100644
--- a/src/reportlab/graphics/widgets/flags.py
+++ b/src/reportlab/graphics/widgets/flags.py
@@ -34,7 +34,6 @@ from reportlab.lib import colors
 from reportlab.lib.validators import *
 from reportlab.lib.attrmap import *
 from reportlab.graphics.shapes import Line, Rect, Polygon, Drawing, Group, String, Circle, Wedge
-from reportlab.graphics.widgetbase import Widget
 from reportlab.graphics import renderPDF
 from reportlab.graphics.widgets.signsandsymbols import _Symbol
 import copy
diff --git a/src/reportlab/graphics/widgets/grids.py b/src/reportlab/graphics/widgets/grids.py
index 496cebf9..2e395735 100644
--- a/src/reportlab/graphics/widgets/grids.py
+++ b/src/reportlab/graphics/widgets/grids.py
@@ -442,7 +442,7 @@ def rotatedEnclosingRect(P, angle, rect):
 
     The class R
     '''
-    from math import pi, cos, sin, tan
+    from math import pi, cos, sin
     x0, y0 = centroid(P)
     theta = (angle/180.)*pi
     s,c=sin(theta),cos(theta)
@@ -511,8 +511,6 @@ class ShadedPolygon(Widget,LineShape):
         return g
 
 if __name__=='__main__': #noruntests
-    from reportlab.lib.colors import blue
-    from reportlab.graphics.shapes import Drawing
     angle=45
     D = Drawing(120,120)
     D.add(ShadedPolygon(points=(10,10,60,60,110,10),strokeColor=None,strokeWidth=1,angle=90,numShades=50,cylinderMode=0))
diff --git a/src/reportlab/graphics/widgets/markers.py b/src/reportlab/graphics/widgets/markers.py
index 5e4ec650..30e47682 100644
--- a/src/reportlab/graphics/widgets/markers.py
+++ b/src/reportlab/graphics/widgets/markers.py
@@ -5,13 +5,13 @@ __version__='3.3.0'
 __doc__="""This modules defines a collection of markers used in charts.
 """
 
-from reportlab.graphics.shapes import Rect, Line, Circle, Polygon, Drawing, Group
+from reportlab.graphics.shapes import Rect, Circle, Polygon, Drawing, Group
 from reportlab.graphics.widgets.signsandsymbols import SmileyFace
 from reportlab.graphics.widgetbase import Widget
 from reportlab.lib.validators import isNumber, isColorOrNone, OneOf, Validator
 from reportlab.lib.attrmap import AttrMap, AttrMapValue
 from reportlab.lib.colors import black
-from reportlab.lib.utils import isFunction, isClass
+from reportlab.lib.utils import isClass
 from reportlab.graphics.widgets.flags import Flag, _Symbol
 from math import sin, cos, pi
 _toradians = pi/180.0
diff --git a/src/reportlab/graphics/widgets/table.py b/src/reportlab/graphics/widgets/table.py
index ee5e6562..a5be99e8 100644
--- a/src/reportlab/graphics/widgets/table.py
+++ b/src/reportlab/graphics/widgets/table.py
@@ -5,7 +5,6 @@
 __version__='3.3.0'
 
 from reportlab.graphics.widgetbase import Widget
-from reportlab.graphics.charts.textlabels import Label
 from reportlab.graphics import shapes
 from reportlab.lib import colors
 from reportlab.lib.validators import *
diff --git a/src/reportlab/lib/codecharts.py b/src/reportlab/lib/codecharts.py
index 153bc101..b0fe90fa 100644
--- a/src/reportlab/lib/codecharts.py
+++ b/src/reportlab/lib/codecharts.py
@@ -14,7 +14,7 @@ import codecs
 from reportlab.pdfgen.canvas import Canvas
 from reportlab.platypus import Flowable
 from reportlab.pdfbase import pdfmetrics, cidfonts
-from reportlab.graphics.shapes import Drawing, Group, String, Circle, Rect
+from reportlab.graphics.shapes import Group, String, Rect
 from reportlab.graphics.widgetbase import Widget
 from reportlab.lib import colors
 from reportlab.lib.utils import int2Byte
diff --git a/src/reportlab/lib/colors.py b/src/reportlab/lib/colors.py
index bff353a6..84e8679d 100644
--- a/src/reportlab/lib/colors.py
+++ b/src/reportlab/lib/colors.py
@@ -40,7 +40,6 @@ Traceback (most recent call last):
 ValueError: css color 'pcmyka(100,0,0,0)' has wrong number of components
 '''
 import math, re, functools
-from reportlab import cmp
 from reportlab.lib.rl_accel import fp_str
 from reportlab.lib.utils import asNative, isStr, rl_safe_eval
 from ast import literal_eval
@@ -62,6 +61,7 @@ class Color:
     @property
     def __key__(self):
         '''simple comparison by component; cmyk != color ever
+        >>> from reportlab import cmp
         >>> cmp(Color(0,0,0),None)
         -1
         >>> cmp(Color(0,0,0),black)
diff --git a/src/reportlab/lib/corp.py b/src/reportlab/lib/corp.py
index f1203461..a85f923e 100644
--- a/src/reportlab/lib/corp.py
+++ b/src/reportlab/lib/corp.py
@@ -17,7 +17,6 @@ from reportlab.graphics.shapes import definePath, Group, Drawing, Rect, PolyLine
 from reportlab.graphics.widgetbase import Widget
 from reportlab.lib.colors import Color, black, white, ReportLabBlue
 from reportlab.pdfbase.pdfmetrics import stringWidth
-from math import sin, pi
 
 class RL_CorpLogo(Widget):
     '''Dinu's fat letter logo as hacked into decent paths by Robin'''
diff --git a/src/reportlab/lib/fontfinder.py b/src/reportlab/lib/fontfinder.py
index 9bc1b566..c9a26a4a 100644
--- a/src/reportlab/lib/fontfinder.py
+++ b/src/reportlab/lib/fontfinder.py
@@ -58,7 +58,7 @@ of non-Python applications.
 Future plans might include using this to auto-register fonts; and making it
 update itself smartly on repeated instantiation.
 """
-import sys, os, pickle, tempfile
+import sys, os, pickle
 from reportlab.lib.utils import asNative as _asNative
 from xml.sax.saxutils import quoteattr
 from reportlab.lib.utils import asBytes
@@ -256,7 +256,6 @@ class FontFinder:
                 except:
                     pass  #pickle load failed.  Ho hum, maybe it's an old pickle.  Better rebuild it.
 
-        from stat import ST_MTIME
         for dirName in self._dirs:
             try:
                 fileNames = rl_listdir(dirName)
diff --git a/src/reportlab/lib/fonts.py b/src/reportlab/lib/fonts.py
index e7144b4a..144548f3 100644
--- a/src/reportlab/lib/fonts.py
+++ b/src/reportlab/lib/fonts.py
@@ -13,7 +13,6 @@ of up to 4 implementation fonts to use.
 Most font-handling code lives in pdfbase, and this probably should too.
 
 '''
-import sys, os
 ###############################################################################
 #   A place to put useful font stuff
 ###############################################################################
diff --git a/src/reportlab/lib/formatters.py b/src/reportlab/lib/formatters.py
index 13f2b070..459ce4e6 100644
--- a/src/reportlab/lib/formatters.py
+++ b/src/reportlab/lib/formatters.py
@@ -8,7 +8,7 @@ __doc__="""
 These help format numbers and dates in a user friendly way.
 Used by the graphics framework.
 """
-import string, sys, os, re
+import re
 
 class Formatter:
     "Base formatter - simply applies python format strings"
diff --git a/src/reportlab/lib/normalDate.py b/src/reportlab/lib/normalDate.py
index 152ac423..cfca9f10 100644
--- a/src/reportlab/lib/normalDate.py
+++ b/src/reportlab/lib/normalDate.py
@@ -25,7 +25,6 @@ _monthName = '''January February March April May June
 _monthNameLower = _monthName.lower().split()
 _monthName = _monthName.split()
 
-from reportlab import cmp
 import re, time, datetime
 from .utils import isStr
 
diff --git a/src/reportlab/lib/pdfencrypt.py b/src/reportlab/lib/pdfencrypt.py
index 787ca6a6..fbfea9a1 100644
--- a/src/reportlab/lib/pdfencrypt.py
+++ b/src/reportlab/lib/pdfencrypt.py
@@ -3,13 +3,12 @@
 __version__='3.3.0'
 
 """helpers for pdf encryption/decryption"""
-import sys, os, tempfile
+import sys, os
 from binascii import hexlify, unhexlify
 from io import BytesIO
 
-from reportlab.lib.utils import md5, asBytes, int2Byte, char2int, rawUnicode, rawBytes, asNative
+from reportlab.lib.utils import md5, asBytes, int2Byte, rawBytes, asNative
 from reportlab.pdfgen.canvas import Canvas
-from reportlab.pdfbase import pdfutils
 from reportlab.pdfbase.pdfdoc import PDFObject
 from reportlab.platypus.flowables import Flowable
 from reportlab import rl_config
@@ -255,7 +254,7 @@ class StandardEncryptionDictionary(PDFObject):
         self.revision = revision
     def format(self, document):
         # use a dummy document to bypass encryption
-        from reportlab.pdfbase.pdfdoc import DummyDoc, PDFDictionary, PDFString, PDFName
+        from reportlab.pdfbase.pdfdoc import DummyDoc, PDFDictionary, PDFName
         dummy = DummyDoc()
         dict = {"Filter": PDFName("Standard"),
                 "O": hexText(self.O),
@@ -766,7 +765,6 @@ See PdfEncryptIntro.pdf for more information.
         print(usage)
 
 def main():
-    from reportlab.rl_config import verbose
     scriptInterp()
 
 if __name__=="__main__": #NO RUNTESTS
diff --git a/src/reportlab/lib/pygments2xpre.py b/src/reportlab/lib/pygments2xpre.py
index f1048d4c..8a32681b 100644
--- a/src/reportlab/lib/pygments2xpre.py
+++ b/src/reportlab/lib/pygments2xpre.py
@@ -9,7 +9,6 @@ For a list of available lexers see http://pygments.org/docs/
 
 """
 __all__ = ('pygments2xpre',)
-from reportlab.lib.utils import asBytes, asUnicode, isUnicode
 import re
 from io import StringIO
 
@@ -49,7 +48,7 @@ def pygments2xpre(s, language="python"):
 def convertSourceFiles(filenames):
     "Helper function - makes minimal PDF document"
 
-    from reportlab.platypus import Paragraph, SimpleDocTemplate, Spacer, XPreformatted
+    from reportlab.platypus import Paragraph, SimpleDocTemplate, XPreformatted
     from reportlab.lib.styles import getSampleStyleSheet
     styT=getSampleStyleSheet()["Title"]
     styC=getSampleStyleSheet()["Code"]
diff --git a/src/reportlab/lib/rl_accel.py b/src/reportlab/lib/rl_accel.py
index b802535f..cf35ac5b 100644
--- a/src/reportlab/lib/rl_accel.py
+++ b/src/reportlab/lib/rl_accel.py
@@ -31,7 +31,7 @@ for fn in __all__:
     del D
 
 if _py_funcs:
-    from reportlab.lib.utils import isBytes, isUnicode, isSeq, rawBytes, asNative, asUnicode, asBytes
+    from reportlab.lib.utils import isUnicode, isSeq, rawBytes, asNative, asBytes
     from math import log
     from struct import unpack
 
@@ -330,7 +330,7 @@ for fn in __all__:
 del fn, f, G
 
 if __name__=='__main__':
-    import sys, os, subprocess
+    import sys, subprocess
     for modname in 'reportlab.lib.rl_accel','reportlab.lib._rl_accel':
         for cmd  in (
             #"unicode2T1('abcde fghi . jkl ; mno',fonts)",
diff --git a/src/reportlab/lib/rparsexml.py b/src/reportlab/lib/rparsexml.py
index 49ae475c..ea302778 100644
--- a/src/reportlab/lib/rparsexml.py
+++ b/src/reportlab/lib/rparsexml.py
@@ -368,7 +368,6 @@ def parsexml0(xmltext, startingat=0, toplevel=1,
     t = (NameString, AttDict, ContentList, ExtraStuff)
     return (t, cursor)
 
-import types
 def pprettyprint(parsedxml):
     """pretty printer mainly for testing"""
     st = bytes
diff --git a/src/reportlab/lib/styles.py b/src/reportlab/lib/styles.py
index 348a506a..d10e1604 100644
--- a/src/reportlab/lib/styles.py
+++ b/src/reportlab/lib/styles.py
@@ -22,7 +22,7 @@ __all__=(
         'StyleSheet1',
         'getSampleStyleSheet',
         )
-from reportlab.lib.colors import white, black
+from reportlab.lib.colors import black
 from reportlab.lib.enums import TA_LEFT, TA_CENTER
 from reportlab.lib.fonts import tt2ps
 from reportlab.rl_config import canvas_basefontname as _baseFontName, \
diff --git a/src/reportlab/lib/utils.py b/src/reportlab/lib/utils.py
index 9f396572..fbf8c960 100644
--- a/src/reportlab/lib/utils.py
+++ b/src/reportlab/lib/utils.py
@@ -5,7 +5,6 @@ __version__='3.5.34'
 __doc__='''Gazillions of miscellaneous internal utility functions'''
 
 import os, pickle, sys, time, types, datetime, ast, importlib
-from functools import reduce as functools_reduce
 from io import BytesIO
 literal_eval = ast.literal_eval
 try:
@@ -13,7 +12,7 @@ try:
 except ImportError:
     from base64 import decodestring as base64_decodebytes, encodestring as base64_encodebytes
 from reportlab.lib.logger import warnOnce
-from reportlab.lib.rltempfile import get_rl_tempfile, get_rl_tempdir, _rl_getuid
+from reportlab.lib.rltempfile import get_rl_tempfile, get_rl_tempdir
 from . rl_safe_eval import rl_safe_exec, rl_safe_eval, safer_globals
 
 class __UNSET__:
@@ -838,7 +837,7 @@ class DebugMemo:
     of information which are also printed in the show() method.
     '''
     def __init__(self,fn='rl_dbgmemo.dbg',mode='w',getScript=1,modules=(),capture_traceback=1, stdout=None, **kw):
-        import time, socket
+        import socket
         self.fn = fn
         if not stdout: 
             self.stdout = sys.stdout
diff --git a/src/reportlab/lib/validators.py b/src/reportlab/lib/validators.py
index 12c6f5c9..ff4e72c3 100644
--- a/src/reportlab/lib/validators.py
+++ b/src/reportlab/lib/validators.py
@@ -4,7 +4,7 @@
 __version__='3.5.33'
 __doc__="""Standard verifying functions used by attrmap."""
 
-import sys, codecs, re
+import codecs, re
 from reportlab.lib.utils import isSeq, isBytes, isStr
 from reportlab.lib import colors
 try:
diff --git a/src/reportlab/pdfbase/_can_cmap_data.py b/src/reportlab/pdfbase/_can_cmap_data.py
index f9c2d78c..93d4aa82 100644
--- a/src/reportlab/pdfbase/_can_cmap_data.py
+++ b/src/reportlab/pdfbase/_can_cmap_data.py
@@ -19,8 +19,6 @@ Running off CMAP files we get the following widths...::
 
 """
 
-from pprint import pprint as pp
-
 from reportlab.pdfbase._cidfontdata import defaultUnicodeEncodings
 from reportlab.pdfbase.cidfonts import UnicodeCIDFont
 
diff --git a/src/reportlab/pdfbase/acroform.py b/src/reportlab/pdfbase/acroform.py
index 0e62e58f..3c6575e9 100644
--- a/src/reportlab/pdfbase/acroform.py
+++ b/src/reportlab/pdfbase/acroform.py
@@ -1,7 +1,6 @@
 __all__=('AcroForm',)
 from reportlab.pdfbase.pdfdoc import (PDFObject, PDFArray, PDFDictionary, PDFString, pdfdocEnc,
                                     PDFName, PDFStream, PDFStreamFilterZCompress, escapePDF)
-from reportlab.pdfgen.canvas  import Canvas
 from reportlab.pdfbase.pdfmetrics import stringWidth
 from reportlab.lib.colors import Color, CMYKColor, Whiter, Blacker, opaqueColor
 from reportlab.lib.rl_accel import fp_str
diff --git a/src/reportlab/pdfbase/cidfonts.py b/src/reportlab/pdfbase/cidfonts.py
index 181cde87..f3baf72b 100644
--- a/src/reportlab/pdfbase/cidfonts.py
+++ b/src/reportlab/pdfbase/cidfonts.py
@@ -16,7 +16,6 @@ try:
 except ImportError:
     from md5 import md5
 
-import reportlab
 from reportlab.pdfbase import pdfmetrics
 from reportlab.pdfbase._cidfontdata import allowedTypeFaces, allowedEncodings, CIDFontInfo, \
      defaultUnicodeEncodings, widthsByUnichar
diff --git a/src/reportlab/pdfbase/pdfdoc.py b/src/reportlab/pdfbase/pdfdoc.py
index 78ef74de..506829b8 100755
--- a/src/reportlab/pdfbase/pdfdoc.py
+++ b/src/reportlab/pdfbase/pdfdoc.py
@@ -14,7 +14,7 @@ The classes within this generally mirror structures in the PDF file
 and are not part of any public interface.  Instead, canvas and font
 classes are made available elsewhere for users to manipulate.
 """
-import types, binascii, codecs, time
+import binascii, codecs
 from collections import OrderedDict
 from reportlab.pdfbase import pdfutils
 from reportlab import rl_config
@@ -1511,7 +1511,6 @@ class PDFOutlines(PDFObject):
 
 def count(tree, closedict=None):
     """utility for outline: recursively count leaves in a tuple/list tree"""
-    from operator import add
     if isinstance(tree,tuple):
         # leaf with subsections XXXX should clean up this structural usage
         (leafdict, subsections) = tree
diff --git a/src/reportlab/pdfbase/pdfform.py b/src/reportlab/pdfbase/pdfform.py
index 140fb871..57a72227 100644
--- a/src/reportlab/pdfbase/pdfform.py
+++ b/src/reportlab/pdfbase/pdfform.py
@@ -37,7 +37,6 @@ WHO WISH TO REMAIN ANONYMOUS.
 
 ### NOTE: MAKE THE STRING FORMATS DYNAMIC IN PATTERNS TO SUPPORT ENCRYPTION XXXX
 
-import string
 from reportlab.pdfbase.pdfdoc import PDFString, PDFStream, PDFDictionary, PDFName, PDFObject
 from reportlab.lib.colors import obj_R_G_B
 
diff --git a/src/reportlab/pdfbase/pdfmetrics.py b/src/reportlab/pdfbase/pdfmetrics.py
index 414d5ee7..12539f0d 100755
--- a/src/reportlab/pdfbase/pdfmetrics.py
+++ b/src/reportlab/pdfbase/pdfmetrics.py
@@ -18,10 +18,10 @@ a registry of Font, TypeFace and Encoding objects.  Ideally these
 would be pre-loaded, but due to a nasty circularity problem we
 trap attempts to access them and do it on first access.
 """
-import string, os, sys, encodings
+import os, sys, encodings
 from reportlab.pdfbase import _fontdata
 from reportlab.lib.logger import warnOnce
-from reportlab.lib.utils import rl_isfile, rl_glob, rl_isdir, open_and_read, open_and_readlines, findInPaths, isSeq, isStr, isUnicode
+from reportlab.lib.utils import rl_isfile, rl_glob, rl_isdir, open_and_read, open_and_readlines, findInPaths, isSeq, isStr
 from reportlab.rl_config import defaultEncoding, T1SearchPath
 from reportlab.lib.rl_accel import unicode2T1, instanceStringWidthT1
 from reportlab.pdfbase import rl_codecs
diff --git a/src/reportlab/pdfbase/pdfutils.py b/src/reportlab/pdfbase/pdfutils.py
index c61f8726..9b0f001f 100755
--- a/src/reportlab/pdfbase/pdfutils.py
+++ b/src/reportlab/pdfbase/pdfutils.py
@@ -6,7 +6,6 @@ __doc__=''
 # pdfutils.py - everything to do with images, streams,
 # compression, and some constants
 
-import sys
 import os
 import binascii
 from io import BytesIO
diff --git a/src/reportlab/pdfgen/canvas.py b/src/reportlab/pdfgen/canvas.py
index 384adc32..ed6aa1e5 100755
--- a/src/reportlab/pdfgen/canvas.py
+++ b/src/reportlab/pdfgen/canvas.py
@@ -9,18 +9,15 @@ doc/reportlab-userguide.pdf for copious examples.
 __all__ = ['Canvas']
 ENABLE_TRACKING = 1 # turn this off to do profile testing w/o tracking
 
-import os
 import sys
 import re
 import hashlib
 from string import digits
-import tempfile
-from math import sin, cos, tan, pi, ceil
+from math import sin, cos, tan, pi
 from reportlab import rl_config
-from reportlab.pdfbase import pdfutils
 from reportlab.pdfbase import pdfdoc
 from reportlab.pdfbase import pdfmetrics
-from reportlab.pdfgen  import pdfgeom, pathobject
+from reportlab.pdfgen  import pathobject
 from reportlab.pdfgen.textobject import PDFTextObject, _PDFColorSetter
 from reportlab.lib.colors import black, _chooseEnforceColorSpace, Color, CMYKColor, toColor
 from reportlab.lib.utils import import_zlib, ImageReader, isSeq, isStr, isUnicode, _digester, asUnicode
diff --git a/src/reportlab/pdfgen/pdfimages.py b/src/reportlab/pdfgen/pdfimages.py
index fe0753ee..1c0f1429 100644
--- a/src/reportlab/pdfgen/pdfimages.py
+++ b/src/reportlab/pdfgen/pdfimages.py
@@ -208,7 +208,6 @@ if __name__=='__main__':
     assert os.path.isfile(srcfile), 'image not found'
     pdfdoc.LongFormat = 1
     img = PDFImage(srcfile, 100, 100)
-    import pprint
     doc = pdfdoc.PDFDocument()
     print('source=',img.source)
     print(img.format(doc))
diff --git a/src/reportlab/pdfgen/textobject.py b/src/reportlab/pdfgen/textobject.py
index 9e2a85b1..0f276e71 100755
--- a/src/reportlab/pdfgen/textobject.py
+++ b/src/reportlab/pdfgen/textobject.py
@@ -9,9 +9,7 @@ instantiate directly, obtain one from the Canvas instead.
 Progress Reports:
 8.83, 2000-01-13, gmcm: created from pdfgen.py
 """
-import string
-from types import *
-from reportlab.lib.colors import Color, CMYKColor, CMYKColorSep, toColor, black, white, _CMYK_black, _CMYK_white
+from reportlab.lib.colors import Color, CMYKColor, CMYKColorSep, toColor
 from reportlab.lib.utils import isBytes, isStr, asUnicode
 from reportlab.lib.rl_accel import fp_str
 from reportlab.pdfbase import pdfmetrics
diff --git a/src/reportlab/platypus/flowables.py b/src/reportlab/platypus/flowables.py
index d85a71b6..0e2a4522 100644
--- a/src/reportlab/platypus/flowables.py
+++ b/src/reportlab/platypus/flowables.py
@@ -26,16 +26,15 @@ higher level components).
 """
 import os
 from copy import deepcopy, copy
-from reportlab.lib.colors import red, gray, lightgrey
+from reportlab.lib.colors import gray, lightgrey
 from reportlab.lib.rl_accel import fp_str
-from reportlab.lib.enums import TA_LEFT, TA_CENTER, TA_RIGHT, TA_JUSTIFY
+from reportlab.lib.enums import TA_LEFT, TA_CENTER, TA_RIGHT
 from reportlab.lib.styles import _baseFontName
 from reportlab.lib.utils import strTypes, rl_safe_exec
 from reportlab.lib.abag import ABag
 from reportlab.pdfbase import pdfutils
 from reportlab.pdfbase.pdfmetrics import stringWidth
 from reportlab.rl_config import _FUZZ, overlapAttachedSpace, ignoreContainerActions, listWrapOnFakeWidth
-import collections
 
 __all__ = '''AnchorFlowable BalancedColumns BulletDrawer CallerMacro CondPageBreak DDIndenter DocAssert
         DocAssign DocExec DocIf DocPara DocWhile FailOnDraw FailOnWrap Flowable FrameBG FrameSplitter
@@ -1529,7 +1528,7 @@ class BalancedColumns(_FindSplitterMixin,NullDraw):
     def _generated_content(self,aW,aH):
         G = []
         frame = self._frame
-        from reportlab.platypus.doctemplate import CurrentFrameFlowable,LayoutError, ActionFlowable, Indenter
+        from reportlab.platypus.doctemplate import LayoutError, ActionFlowable, Indenter
         from reportlab.platypus.frames import Frame
         from reportlab.platypus.doctemplate import FrameBreak
         lpad = frame._leftPadding if self._leftPadding is None else self._leftPadding
diff --git a/src/reportlab/platypus/frames.py b/src/reportlab/platypus/frames.py
index 6cd95f7a..96f8dd06 100644
--- a/src/reportlab/platypus/frames.py
+++ b/src/reportlab/platypus/frames.py
@@ -17,7 +17,6 @@ logger = logging.getLogger('reportlab.platypus')
 
 _geomAttr=('x1', 'y1', 'width', 'height', 'leftPadding', 'bottomPadding', 'rightPadding', 'topPadding')
 from reportlab import rl_config
-from reportlab.lib.rl_accel import fp_str
 _FUZZ=rl_config._FUZZ
 
 class ShowBoundaryValue:
diff --git a/src/reportlab/platypus/paragraph.py b/src/reportlab/platypus/paragraph.py
index 373f325a..340df4eb 100644
--- a/src/reportlab/platypus/paragraph.py
+++ b/src/reportlab/platypus/paragraph.py
@@ -12,7 +12,7 @@ __doc__='''The standard paragraph implementation'''
 from string import whitespace
 from operator import truth
 from unicodedata import category
-from reportlab.pdfbase.pdfmetrics import stringWidth, getFont, getAscentDescent
+from reportlab.pdfbase.pdfmetrics import stringWidth, getAscentDescent
 from reportlab.platypus.paraparser import ParaParser, _PCT, _num as _parser_num, _re_us_value
 from reportlab.platypus.flowables import Flowable
 from reportlab.lib.colors import Color
@@ -22,8 +22,8 @@ from reportlab.lib.textsplit import wordSplit, ALL_CANNOT_START
 from reportlab.lib.styles import ParagraphStyle
 from copy import deepcopy
 from reportlab.lib.abag import ABag
-from reportlab.rl_config import platypus_link_underline, decimalSymbol, _FUZZ,\
-        paraFontSizeHeightOffset, hyphenationMinWordLength
+from reportlab.rl_config import decimalSymbol, _FUZZ, paraFontSizeHeightOffset,\
+    hyphenationMinWordLength
 from reportlab.lib.utils import _className, isBytes, isStr
 from reportlab.lib.rl_accel import sameFrag
 import re
@@ -2431,7 +2431,6 @@ class Paragraph(Flowable):
             else:
                 text = ''.join(getattr(f,'words',[]))
 
-            from reportlab.lib.textsplit import wordSplit
             lines = wordSplit(text, maxWidths, f.fontName, f.fontSize)
             #the paragraph drawing routine assumes multiple frags per line, so we need an
             #extra list like this
diff --git a/src/reportlab/platypus/paraparser.py b/src/reportlab/platypus/paraparser.py
index 8da13f56..72849012 100644
--- a/src/reportlab/platypus/paraparser.py
+++ b/src/reportlab/platypus/paraparser.py
@@ -4,19 +4,15 @@
 __all__ = ('ParaFrag', 'ParaParser')
 __version__='3.5.20'
 __doc__='''The parser used to process markup within paragraphs'''
-import string
 import re
 import sys
-import os
 import copy
-import base64
-from pprint import pprint as pp
 import unicodedata
 import reportlab.lib.sequencer
 
 from reportlab.lib.abag import ABag
-from reportlab.lib.utils import ImageReader, annotateException, encode_label, asUnicode, asBytes, isStr
-from reportlab.lib.colors import toColor, white, black, red, Color
+from reportlab.lib.utils import ImageReader, annotateException, encode_label, asUnicode
+from reportlab.lib.colors import toColor, black
 from reportlab.lib.fonts import tt2ps, ps2tt
 from reportlab.lib.enums import TA_LEFT, TA_RIGHT, TA_CENTER, TA_JUSTIFY
 from reportlab.lib.units import inch,mm,cm,pica
diff --git a/src/reportlab/platypus/tableofcontents.py b/src/reportlab/platypus/tableofcontents.py
index 951af8b2..e76fcffa 100644
--- a/src/reportlab/platypus/tableofcontents.py
+++ b/src/reportlab/platypus/tableofcontents.py
@@ -44,7 +44,6 @@ lines after the first are indented by the same constant named
 epsilon.
 """
 
-from reportlab.lib import enums
 from reportlab.lib.units import cm
 from reportlab.lib.utils import commasplit, escapeOnce, encode_label, decode_label, strTypes, asUnicode, asNative
 from reportlab.lib.styles import ParagraphStyle, _baseFontName
@@ -52,7 +51,7 @@ from reportlab.lib import sequencer as rl_sequencer
 from reportlab.platypus.paragraph import Paragraph
 from reportlab.platypus.doctemplate import IndexingFlowable
 from reportlab.platypus.tables import TableStyle, Table
-from reportlab.platypus.flowables import Spacer, Flowable
+from reportlab.platypus.flowables import Spacer
 from reportlab.pdfbase.pdfmetrics import stringWidth
 from reportlab.pdfgen import canvas
 import unicodedata
diff --git a/src/reportlab/platypus/xpreformatted.py b/src/reportlab/platypus/xpreformatted.py
index a1a3d28e..f917dbd4 100644
--- a/src/reportlab/platypus/xpreformatted.py
+++ b/src/reportlab/platypus/xpreformatted.py
@@ -8,7 +8,7 @@ __all__ = (
 __version__='3.5.20'
 __doc__='''A 'rich preformatted text' widget allowing internal markup'''
 from reportlab.lib import PyFontify
-from reportlab.platypus.paragraph import Paragraph, cleanBlockQuotedText, _handleBulletWidth, \
+from reportlab.platypus.paragraph import Paragraph, _handleBulletWidth, \
      ParaLines, _getFragWords, stringWidth, getAscentDescent, imgVRange, imgNormV
 from reportlab.lib.utils import isSeq
 from reportlab.platypus.flowables import _dedenter
diff --git a/src/rl_addons/rl_accel/tests/t0.py b/src/rl_addons/rl_accel/tests/t0.py
index d3c2bba8..1bb568ca 100644
--- a/src/rl_addons/rl_accel/tests/t0.py
+++ b/src/rl_addons/rl_accel/tests/t0.py
@@ -1,4 +1,4 @@
-import os, time, sys
+import time
 from reportlab.pdfbase.pdfmetrics import _py_getFont, _py_unicode2T1
 from _rl_accel import unicode2T1
 from getrc import getrc, checkrc
diff --git a/tests/test_platypus_index.py b/tests/test_platypus_index.py
index ee5bb866..f17e0aa6 100644
--- a/tests/test_platypus_index.py
+++ b/tests/test_platypus_index.py
@@ -11,7 +11,7 @@ from os.path import join, basename, splitext
 from math import sqrt
 import unittest
 from reportlab.lib.units import cm
-from reportlab.lib.utils import commajoin, asUnicode
+from reportlab.lib.utils import commajoin
 from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle
 from reportlab.platypus.paragraph import Paragraph
 from reportlab.platypus.xpreformatted import XPreformatted
@@ -100,7 +100,6 @@ class IndexTestCase(unittest.TestCase):
             index = SimpleIndex(dot=' . ', headers=headers)
 
             def addParas(words):
-                words = [asUnicode(w) for w in words]
                 txt = u' '.join([(len(w) > 5 and u'<index item=%s/>%s' % (quoteattr(commajoin([w[:2], w[:3], w])), w) or w) for w in words])
                 para = Paragraph(txt, makeBodyStyle())
                 story.append(para)
diff --git a/tools/docco/docpy.py b/tools/docco/docpy.py
index 20608580..3e084589 100644
--- a/tools/docco/docpy.py
+++ b/tools/docco/docpy.py
@@ -33,18 +33,14 @@ Type the following for usage info:
 __version__ = '0.8'
 
 
-import sys, os, re, types, getopt, copy, time
-from reportlab.pdfgen import canvas
+import sys, os, getopt, time
 from reportlab.lib import colors
 from reportlab.lib.units import inch, cm
 from reportlab.lib.pagesizes import A4
-from reportlab.lib import enums
-from reportlab.lib.enums import TA_CENTER, TA_LEFT
+from reportlab.lib.enums import TA_CENTER
 from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle
-from reportlab.platypus.flowables import Flowable, Spacer
+from reportlab.platypus.flowables import Spacer, PageBreak
 from reportlab.platypus.paragraph import Paragraph
-from reportlab.platypus.flowables \
-     import Flowable, Preformatted,Spacer, Image, KeepTogether, PageBreak
 from reportlab.platypus.tableofcontents import TableOfContents
 from reportlab.platypus.xpreformatted import XPreformatted
 from reportlab.platypus.frames import Frame
diff --git a/tools/docco/graphdocpy.py b/tools/docco/graphdocpy.py
index f4449087..3d3b1470 100644
--- a/tools/docco/graphdocpy.py
+++ b/tools/docco/graphdocpy.py
@@ -10,41 +10,30 @@ __version__ = '0.8'
 
 import sys
 sys.path.insert(0, '.')
-import os, re, types, getopt, pickle, copy, time, pprint, traceback
+import os, re, getopt, pickle, time, pprint, traceback
 from io import StringIO
 from reportlab import rl_config
 
-from docpy import PackageSkeleton0, ModuleSkeleton0
+from docpy import ModuleSkeleton0
 from docpy import DocBuilder0, PdfDocBuilder0, HtmlDocBuilder0
-from docpy import htmlescape, htmlrepr, defaultformat, \
-     getdoc, reduceDocStringLength
-from docpy import makeHtmlSection, makeHtmlSubSection, \
-     makeHtmlInlineImage
+from docpy import makeHtmlInlineImage
 
 from reportlab.lib.units import inch, cm
 from reportlab.lib.pagesizes import A4
-from reportlab.lib import colors
-from reportlab.lib.enums import TA_CENTER, TA_LEFT
-from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle
-from reportlab.pdfgen import canvas
-from reportlab.platypus.flowables import Flowable, Spacer
+from reportlab.lib.styles import getSampleStyleSheet
+from reportlab.platypus.flowables import Spacer
 from reportlab.platypus.paragraph import Paragraph
 from reportlab.platypus.tableofcontents import TableOfContents
-from reportlab.platypus.flowables \
-     import Flowable, Preformatted,Spacer, Image, KeepTogether, PageBreak
+from reportlab.platypus.flowables import Preformatted, Spacer, PageBreak
 from reportlab.platypus.xpreformatted import XPreformatted
 from reportlab.platypus.frames import Frame
-from reportlab.platypus.doctemplate \
-     import PageTemplate, BaseDocTemplate
-from reportlab.platypus.tables import TableStyle, Table
-from reportlab.graphics.shapes import NotImplementedError
+from reportlab.platypus.doctemplate import PageTemplate, BaseDocTemplate
 import inspect
 
 # Needed to draw Widget/Drawing demos.
 
 from reportlab.graphics.widgetbase import Widget
 from reportlab.graphics.shapes import Drawing
-from reportlab.graphics import shapes
 from reportlab.graphics import renderPDF
 
 VERBOSE = rl_config.verbose
diff --git a/tools/docco/rl_doc_utils.py b/tools/docco/rl_doc_utils.py
index f73d96a8..0a43127d 100644
--- a/tools/docco/rl_doc_utils.py
+++ b/tools/docco/rl_doc_utils.py
@@ -8,21 +8,17 @@ __doc__ = """
 This module contains utilities for generating guides
 """
 
-import os, sys, glob
-import string
+import os
 from reportlab.lib.utils import asUnicode
 
-from .rltemplate import RLDocTemplate
 from .stylesheet import getStyleSheet
 styleSheet = getStyleSheet()
 
 #from reportlab.platypus.doctemplate import SimpleDocTemplate
 from reportlab.lib.units import inch
-from reportlab.lib.pagesizes import letter, A4, A5, A3  # latter two for testing
-from reportlab.rl_config import defaultPageSize
 from reportlab.platypus import figures
 from reportlab.platypus import Paragraph, Spacer, Preformatted,\
-            PageBreak, CondPageBreak, Flowable, Table, TableStyle, \
+            PageBreak, CondPageBreak, Table, TableStyle,\
             NextPageTemplate, KeepTogether, Image, XPreformatted
 from reportlab.platypus.xpreformatted import PythonPreformatted
 from reportlab.lib.styles import ParagraphStyle
diff --git a/tools/docco/rltemplate.py b/tools/docco/rltemplate.py
index a19eb67b..f87f44c1 100644
--- a/tools/docco/rltemplate.py
+++ b/tools/docco/rltemplate.py
@@ -5,9 +5,8 @@
 #to use this, which is wrong.
 
 
-from reportlab.platypus import PageTemplate, \
-     BaseDocTemplate, Frame, Paragraph
-from reportlab.lib.units import inch, cm
+from reportlab.platypus import PageTemplate, BaseDocTemplate, Frame, Paragraph
+from reportlab.lib.units import inch
 from reportlab.lib.sequencer import Sequencer
 from reportlab.rl_config import defaultPageSize
 
diff --git a/tools/docco/stylesheet.py b/tools/docco/stylesheet.py
index caa9fa7c..2bc21efc 100644
--- a/tools/docco/stylesheet.py
+++ b/tools/docco/stylesheet.py
@@ -3,7 +3,7 @@
 #history https://hg.reportlab.com/hg-public/reportlab/log/tip/tools/docco/stylesheet.py
 #standard stylesheet for our manuals
 from reportlab.lib.styles import StyleSheet1, ParagraphStyle
-from reportlab.lib.enums import TA_CENTER, TA_LEFT, TA_RIGHT, TA_JUSTIFY
+from reportlab.lib.enums import TA_CENTER
 from reportlab.lib import colors
 
 
diff --git a/tools/docco/yaml.py b/tools/docco/yaml.py
index c07a5a32..8002757b 100644
--- a/tools/docco/yaml.py
+++ b/tools/docco/yaml.py
@@ -39,7 +39,6 @@ Special commands understood at present are:
 
 
 import sys
-import imp
 from . import codegrab
 
 #modes:
diff --git a/tools/docco/yaml2pdf.py b/tools/docco/yaml2pdf.py
index e6da40a1..8fe850b3 100644
--- a/tools/docco/yaml2pdf.py
+++ b/tools/docco/yaml2pdf.py
@@ -19,13 +19,8 @@ import imp
 
 from . import yaml
 from .rltemplate import RLDocTemplate
-from reportlab.lib.styles import ParagraphStyle
-from reportlab.lib.enums import *
 from reportlab.lib.pagesizes import A4
 from reportlab.platypus import *
-from reportlab.lib import colors
-from reportlab.lib.units import inch
-
 
 from .stylesheet import getStyleSheet
 
diff --git a/tools/pythonpoint/pythonpoint.py b/tools/pythonpoint/pythonpoint.py
index 746e8ec2..fe4cf89e 100644
--- a/tools/pythonpoint/pythonpoint.py
+++ b/tools/pythonpoint/pythonpoint.py
@@ -71,15 +71,14 @@ Recently added features are:
 - add pyRXP support (TODO)
 """
 __version__='3.3.0'
-import os, sys, imp, pprint, getopt, glob, re
+import os, sys, getopt, glob, re
 from io import BytesIO
 
 from reportlab import rl_config
-from reportlab.lib import styles
 from reportlab.lib import colors
 from reportlab.lib.units import cm
 from reportlab.lib.utils import isStr, isBytes, isUnicode
-from reportlab.lib.enums import TA_LEFT, TA_RIGHT, TA_CENTER, TA_JUSTIFY
+from reportlab.lib.enums import TA_LEFT, TA_RIGHT, TA_CENTER
 from reportlab.pdfbase import pdfmetrics
 from reportlab.pdfgen import canvas
 from reportlab.platypus.doctemplate import SimpleDocTemplate
diff --git a/tools/pythonpoint/stdparser.py b/tools/pythonpoint/stdparser.py
index 84985a1b..ee21ecd3 100644
--- a/tools/pythonpoint/stdparser.py
+++ b/tools/pythonpoint/stdparser.py
@@ -7,9 +7,8 @@ The parser has a getPresentation method; it is called from
 pythonpoint.py.
 """
 
-import string, imp, sys, os, copy
+import imp, sys, os, copy
 from reportlab.lib.utils import isSeq
-from reportlab.lib import colors
 from reportlab.lib.enums import TA_LEFT, TA_RIGHT, TA_CENTER, TA_JUSTIFY
 from reportlab.lib.utils import recursiveImport
 from reportlab.platypus.paraparser import HTMLParser, known_entities
diff --git a/tools/pythonpoint/styles/htu.py b/tools/pythonpoint/styles/htu.py
index bc79a7ba..98aa4acb 100644
--- a/tools/pythonpoint/styles/htu.py
+++ b/tools/pythonpoint/styles/htu.py
@@ -1,9 +1,7 @@
 from reportlab.lib import styles
 from reportlab.lib import colors
-from reportlab.lib.units import cm
-from reportlab.lib.enums import TA_LEFT, TA_CENTER, TA_RIGHT, TA_JUSTIFY
-from reportlab.platypus import Preformatted, Paragraph, Frame, \
-     Image, Table, TableStyle, Spacer
+from reportlab.lib.enums import TA_CENTER
+from reportlab.platypus import TableStyle
 from reportlab.pdfbase import pdfmetrics
 from reportlab.pdfbase.ttfonts import TTFont
 
diff --git a/tools/pythonpoint/styles/modern.py b/tools/pythonpoint/styles/modern.py
index 17dec463..24287809 100644
--- a/tools/pythonpoint/styles/modern.py
+++ b/tools/pythonpoint/styles/modern.py
@@ -20,7 +20,7 @@ A style sheet MUST define a style called 'Normal'.
 """
 
 from reportlab.lib import styles
-from reportlab.lib.enums import TA_LEFT, TA_CENTER, TA_RIGHT, TA_JUSTIFY
+from reportlab.lib.enums import TA_CENTER
 
 def getParagraphStyles():
     """Returns a dictionary of styles based on Helvetica"""
@@ -117,4 +117,4 @@ def getParagraphStyles():
     para.leftIndent = 36
     stylesheet['Code'] = para
 
-    return stylesheet
\ No newline at end of file
+    return stylesheet
diff --git a/tools/pythonpoint/styles/projection.py b/tools/pythonpoint/styles/projection.py
index a3c81855..ccedb57f 100644
--- a/tools/pythonpoint/styles/projection.py
+++ b/tools/pythonpoint/styles/projection.py
@@ -15,8 +15,8 @@ A style sheet MUST define a style called 'Normal'.
 """
 
 from reportlab.lib import styles
-from reportlab.lib.colors import *
-from reportlab.lib.enums import TA_LEFT, TA_CENTER, TA_RIGHT, TA_JUSTIFY
+from reportlab.lib.colors import chartreuse, green, white
+from reportlab.lib.enums import TA_LEFT, TA_CENTER
 
 
 def getParagraphStyles():
diff --git a/tools/pythonpoint/styles/standard.py b/tools/pythonpoint/styles/standard.py
index c5259645..f0f434b5 100644
--- a/tools/pythonpoint/styles/standard.py
+++ b/tools/pythonpoint/styles/standard.py
@@ -1,9 +1,7 @@
 from reportlab.lib import styles
 from reportlab.lib import colors
-from reportlab.lib.units import cm
-from reportlab.lib.enums import TA_LEFT, TA_CENTER, TA_RIGHT, TA_JUSTIFY
-from reportlab.platypus import Preformatted, Paragraph, Frame, \
-     Image, Table, TableStyle, Spacer
+from reportlab.lib.enums import TA_CENTER
+from reportlab.platypus import TableStyle
 
 
 def getParagraphStyles():
diff --git a/tools/utils/add_bleed.py b/tools/utils/add_bleed.py
index 44823bcd..019ad949 100644
--- a/tools/utils/add_bleed.py
+++ b/tools/utils/add_bleed.py
@@ -1,7 +1,7 @@
 #How to add bleed to a page in this case 6mm to a landscape A4
 from reportlab.lib import units, pagesizes
 from reportlab.pdfgen.canvas import Canvas
-import sys, os, glob, time
+import sys, os
 bleedX = 6*units.mm
 bleedY = 6*units.mm
 pageWidth, pageHeight = pagesizes.landscape(pagesizes.A4)
-- 
2.30.2