From c8dbe5f8c6f1b08a05d41693e8c74dee3acf9c68 Mon Sep 17 00:00:00 2001 From: Douglas Thor Date: Mon, 6 Nov 2023 12:47:20 -0800 Subject: [PATCH] Cleanup Imports (#101) --- CHANGELOG.md | 2 ++ LICENSE | 1 - docs/Makefile | 2 +- docs/conf.py | 5 ++--- src/wafer_map/__about__.py | 1 - src/wafer_map/__init__.py | 1 - src/wafer_map/__main__.py | 2 -- src/wafer_map/example.py | 5 +---- src/wafer_map/gen_fake_data.py | 4 +--- src/wafer_map/wm_app.py | 11 ++++------- src/wafer_map/wm_constants.py | 2 -- src/wafer_map/wm_core.py | 6 ++---- src/wafer_map/wm_frame.py | 7 ++----- src/wafer_map/wm_info.py | 1 - src/wafer_map/wm_legend.py | 6 ++---- src/wafer_map/wm_utils.py | 3 --- tests/__init__.py | 1 - tests/test_utils.py | 2 -- tests/test_wx_edits.py | 1 - 19 files changed, 17 insertions(+), 46 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 753f5d7..e912cd4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,8 @@ This document highlights high-level changes made to this program. + Added `pre-commit` config. + Removed now-unnecessary `build_reqs` directory; moved tests to external package. + Formatted code with `black`. ++ Removed `__future__` imports now that we no longer support Python 2; reorder + and fix imports to not use `.` notation. Removed encoding pragma. ## 1.1.2 / 2019-10-14 diff --git a/LICENSE b/LICENSE index 6b156fe..ef7e7ef 100644 --- a/LICENSE +++ b/LICENSE @@ -672,4 +672,3 @@ may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read . - diff --git a/docs/Makefile b/docs/Makefile index e9d0ccc..343eac3 100644 --- a/docs/Makefile +++ b/docs/Makefile @@ -17,4 +17,4 @@ help: # Catch-all target: route all unknown targets to Sphinx using the new # "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). %: Makefile - @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) \ No newline at end of file + @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) diff --git a/docs/conf.py b/docs/conf.py index 366c54a..365b7ee 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -1,5 +1,4 @@ #!/usr/bin/env python3 -# -*- coding: utf-8 -*- # # wafer_map documentation build configuration file, created by # sphinx-quickstart on Wed Feb 1 14:36:48 2017. @@ -12,14 +11,14 @@ # # All configuration values have a default; values that are commented out # serve to show the default. - +# # If extensions (or modules to document with autodoc) are in another directory, # add these directories to sys.path here. If the directory is relative to the # documentation root, use os.path.abspath to make it absolute, like shown here. # +import logging import os import sys -import logging logging.disable(logging.CRITICAL) diff --git a/src/wafer_map/__about__.py b/src/wafer_map/__about__.py index dbccf2d..f0110b2 100644 --- a/src/wafer_map/__about__.py +++ b/src/wafer_map/__about__.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- """ Plots up a wafer map. Used in semiconductor processing and analysis. diff --git a/src/wafer_map/__init__.py b/src/wafer_map/__init__.py index 2ccd24d..2aa8edb 100644 --- a/src/wafer_map/__init__.py +++ b/src/wafer_map/__init__.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- """ __init__ for wafer_map. diff --git a/src/wafer_map/__main__.py b/src/wafer_map/__main__.py index ab4f3ea..dd074d4 100644 --- a/src/wafer_map/__main__.py +++ b/src/wafer_map/__main__.py @@ -1,10 +1,8 @@ -# -*- coding: utf-8 -*- """ Main entry point for wafer_map. Runs the examples when called with `python -m wafer_map`. """ - from wafer_map import example example.main() diff --git a/src/wafer_map/example.py b/src/wafer_map/example.py index 80988b2..c278c91 100644 --- a/src/wafer_map/example.py +++ b/src/wafer_map/example.py @@ -1,16 +1,13 @@ -# -*- coding: utf-8 -*- """ Provides examples on how to use the ``wafer_map`` package. This module is called when running ``python -m wafer_map``. """ -from __future__ import absolute_import, division, print_function, unicode_literals - import wx from wafer_map import gen_fake_data -from wafer_map import wm_core from wafer_map import wm_app +from wafer_map import wm_core from wafer_map.wm_constants import DataType diff --git a/src/wafer_map/gen_fake_data.py b/src/wafer_map/gen_fake_data.py index 378f7f5..d65ccbe 100644 --- a/src/wafer_map/gen_fake_data.py +++ b/src/wafer_map/gen_fake_data.py @@ -1,18 +1,16 @@ -# -*- coding: utf-8 -*- """ Generate fake data for the wafer_map demo. Typically not used by anything but the example. It's also a pretty shitty peice of code so... ye be warned. """ -from __future__ import absolute_import, division, print_function, unicode_literals import math import random from wafer_map import PY2 +from wafer_map import wm_constants as wm_const from wafer_map import wm_info from wafer_map import wm_utils -from wafer_map import wm_constants as wm_const # Python2 Compatibility diff --git a/src/wafer_map/wm_app.py b/src/wafer_map/wm_app.py index be90c89..f8687de 100644 --- a/src/wafer_map/wm_app.py +++ b/src/wafer_map/wm_app.py @@ -1,15 +1,12 @@ -# -*- coding: utf-8 -*- """ A self-contained Window for a Wafer Map. """ -from __future__ import absolute_import, division, print_function, unicode_literals - import wx -from . import wm_frame -from . import wm_info -from . import gen_fake_data -from . import wm_constants as wm_const +from wafer_map import gen_fake_data +from wafer_map import wm_constants as wm_const +from wafer_map import wm_frame +from wafer_map import wm_info class WaferMapApp(object): diff --git a/src/wafer_map/wm_constants.py b/src/wafer_map/wm_constants.py index 4aefa82..c34632c 100644 --- a/src/wafer_map/wm_constants.py +++ b/src/wafer_map/wm_constants.py @@ -1,8 +1,6 @@ -# -*- coding: utf-8 -*- """ Constants for the wafer_map package. """ -from __future__ import absolute_import, division, print_function, unicode_literals from enum import Enum import wx diff --git a/src/wafer_map/wm_core.py b/src/wafer_map/wm_core.py index e32c387..e63b745 100644 --- a/src/wafer_map/wm_core.py +++ b/src/wafer_map/wm_core.py @@ -1,18 +1,16 @@ -# -*- coding: utf-8 -*- """ The core of ``wafer_map``. """ -from __future__ import absolute_import, division, print_function, unicode_literals import math import numpy as np import wx -from wx.lib.floatcanvas import FloatCanvas import wx.lib.colourselect as csel +from wx.lib.floatcanvas import FloatCanvas +from wafer_map import wm_constants as wm_const from wafer_map import wm_legend from wafer_map import wm_utils -from wafer_map import wm_constants as wm_const # Module-level TODO list. diff --git a/src/wafer_map/wm_frame.py b/src/wafer_map/wm_frame.py index d6c2264..1f6b61e 100644 --- a/src/wafer_map/wm_frame.py +++ b/src/wafer_map/wm_frame.py @@ -1,13 +1,10 @@ -# -*- coding: utf-8 -*- """ This is the main window of the Wafer Map application. """ -from __future__ import absolute_import, division, print_function, unicode_literals - import wx -from . import wm_core -from . import wm_constants as wm_const +from wafer_map import wm_constants as wm_const +from wafer_map import wm_core class WaferMapWindow(wx.Frame): diff --git a/src/wafer_map/wm_info.py b/src/wafer_map/wm_info.py index 4573087..9ab9ad2 100644 --- a/src/wafer_map/wm_info.py +++ b/src/wafer_map/wm_info.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- """ The :class:`wafer_map.wm_info.WaferInfo` class. """ diff --git a/src/wafer_map/wm_legend.py b/src/wafer_map/wm_legend.py index 2927692..6570e59 100644 --- a/src/wafer_map/wm_legend.py +++ b/src/wafer_map/wm_legend.py @@ -1,18 +1,16 @@ -# -*- coding: utf-8 -*- """ Draws the wafer map legend. """ -from __future__ import absolute_import, division, print_function, unicode_literals import colorsys from collections import OrderedDict import wx -from wx.lib.floatcanvas import FloatCanvas import wx.lib.colourselect as csel +from wx.lib.floatcanvas import FloatCanvas from wafer_map import PY2 -from wafer_map import wm_utils from wafer_map import wm_constants as wm_const +from wafer_map import wm_utils # TODO: Update to Bezier Curves for colors. See http://bsou.io/p/3 diff --git a/src/wafer_map/wm_utils.py b/src/wafer_map/wm_utils.py index d86da10..de25b7c 100644 --- a/src/wafer_map/wm_utils.py +++ b/src/wafer_map/wm_utils.py @@ -1,9 +1,6 @@ -# -*- coding: utf-8 -*- """ Holds various utilities used by ``wafer_map``. """ -from __future__ import absolute_import, division, print_function, unicode_literals - import numpy as np from colour import Color diff --git a/tests/__init__.py b/tests/__init__.py index 1dd27ee..acf1846 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- """ Unit tests for wafer_map. diff --git a/tests/test_utils.py b/tests/test_utils.py index 0e8a466..a5ff102 100644 --- a/tests/test_utils.py +++ b/tests/test_utils.py @@ -1,8 +1,6 @@ -# -*- coding: utf-8 -*- """ Unittests for the :module:`wafer_map.utils` module. """ -from __future__ import absolute_import, division, print_function, unicode_literals import unittest from wafer_map import wm_utils as utils diff --git a/tests/test_wx_edits.py b/tests/test_wx_edits.py index a5a349b..90f9596 100644 --- a/tests/test_wx_edits.py +++ b/tests/test_wx_edits.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- """ Unittests for the two required changes to wxPython_Phoenix source code.