Skip to content

Commit

Permalink
Modernize: Run black (#99)
Browse files Browse the repository at this point in the history
  • Loading branch information
dougthor42 authored Nov 6, 2023
1 parent 3a5432c commit 226bf46
Show file tree
Hide file tree
Showing 14 changed files with 729 additions and 720 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ This document highlights high-level changes made to this program.
+ Migrated CI from Travis + GitLab + Appveyor CIs to Github.
+ Added `pre-commit` config.
+ Removed now-unnecessary `build_reqs` directory; moved tests to external package.
+ Formatted code with `black`.


## 1.1.2 / 2019-10-14
Expand Down
79 changes: 42 additions & 37 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

logging.disable(logging.CRITICAL)

sys.path.insert(0, os.path.abspath('..'))
sys.path.insert(0, os.path.abspath(".."))

base_dir = os.path.join(os.path.dirname(__file__), os.pardir)
about = {}
Expand All @@ -35,19 +35,19 @@

# If your documentation needs a minimal Sphinx version, state it here.

needs_sphinx = '1.3'
needs_sphinx = "1.3"

# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.doctest',
'sphinx.ext.todo',
'sphinx.ext.coverage',
# 'sphinx.ext.imgmath',
'sphinx.ext.napoleon',
'sphinx.ext.viewcode',
"sphinx.ext.autodoc",
"sphinx.ext.doctest",
"sphinx.ext.todo",
"sphinx.ext.coverage",
# 'sphinx.ext.imgmath',
"sphinx.ext.napoleon",
"sphinx.ext.viewcode",
]

# Napoleon Settings
Expand All @@ -63,30 +63,30 @@
napoleon_use_rtype = True

# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
templates_path = ["_templates"]

# The suffix(es) of source filenames.
# You can specify multiple suffix as a list of string:
#
# source_suffix = ['.rst', '.md']
source_suffix = '.rst'
source_suffix = ".rst"

# The master toctree document.
master_doc = 'index'
master_doc = "index"

# General information about the project.
project = about['__project_name__']
copyright = '2017, {}'.format(about['__author__'])
author = about['__author__']
project = about["__project_name__"]
copyright = "2017, {}".format(about["__author__"])
author = about["__author__"]

# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# The short X.Y version.
version = about['__version__']
version = about["__version__"]
# The full version, including alpha/beta/rc tags.
release = about['__version__']
release = about["__version__"]

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand All @@ -98,10 +98,10 @@
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This patterns also effect to html_static_path and html_extra_path
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]

# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'sphinx'
pygments_style = "sphinx"

# If true, `todo` and `todoList` produce output, else they produce nothing.
todo_include_todos = False
Expand All @@ -112,7 +112,7 @@
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
html_theme = 'sphinx_rtd_theme'
html_theme = "sphinx_rtd_theme"

# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
Expand All @@ -123,13 +123,13 @@
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']
html_static_path = ["_static"]


# -- Options for HTMLHelp output ------------------------------------------

# Output file base name for HTML help builder.
htmlhelp_basename = 'wafer_mapdoc'
htmlhelp_basename = "wafer_mapdoc"


# -- Options for LaTeX output ---------------------------------------------
Expand All @@ -138,15 +138,15 @@
# The paper size ('letterpaper' or 'a4paper').
#
# 'papersize': 'letterpaper',

#
# The font size ('10pt', '11pt' or '12pt').
#
# 'pointsize': '10pt',

#
# Additional stuff for the LaTeX preamble.
#
# 'preamble': '',

#
# Latex figure (float) alignment
#
# 'figure_align': 'htbp',
Expand All @@ -156,19 +156,21 @@
# (source start file, target name, title,
# author, documentclass [howto, manual, or own class]).
latex_documents = [
(master_doc, 'wafer_map.tex', 'wafer\\_map Documentation',
'Douglas Thor', 'manual'),
(
master_doc,
"wafer_map.tex",
"wafer\\_map Documentation",
"Douglas Thor",
"manual",
),
]


# -- Options for manual page output ---------------------------------------

# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
(master_doc, 'wafer_map', 'wafer_map Documentation',
[author], 1)
]
man_pages = [(master_doc, "wafer_map", "wafer_map Documentation", [author], 1)]


# -- Options for Texinfo output -------------------------------------------
Expand All @@ -177,10 +179,13 @@
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
(master_doc, 'wafer_map', 'wafer_map Documentation',
author, 'wafer_map', 'One line description of project.',
'Miscellaneous'),
(
master_doc,
"wafer_map",
"wafer_map Documentation",
author,
"wafer_map",
"One line description of project.",
"Miscellaneous",
),
]



7 changes: 5 additions & 2 deletions src/wafer_map/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@


### Constants ###############################################################
#__all__ = ['wm_app', 'wm_constants', 'wm_core', 'wm_frame', 'wm_info',
# __all__ = ['wm_app', 'wm_constants', 'wm_core', 'wm_frame', 'wm_info',
# 'wm_legend', 'wm_utils']


if sys.version_info < (3, ):
if sys.version_info < (3,):
PY2 = True
elif sys.version_info < (2, 6):
raise RuntimeError("Only Python >= 2.7 is supported.")
Expand All @@ -28,8 +28,11 @@
# Fix hashing for wx.Colour
# See https://groups.google.com/forum/#!topic/wxpython-dev/NLd4CZv9rII
import wx

ok = getattr(wx.Colour, "__hash__")
if ok is None:

def _Colour___hash(self):
return hash(tuple(self.Get()))

wx.Colour.__hash__ = _Colour___hash
79 changes: 39 additions & 40 deletions src/wafer_map/example.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,10 @@
This module is called when running ``python -m wafer_map``.
"""
# ---------------------------------------------------------------------------
### Imports
# ---------------------------------------------------------------------------
# Standard Library
from __future__ import absolute_import, division, print_function, unicode_literals

# Third-Party
import wx

# Package/Application
from wafer_map import gen_fake_data
from wafer_map import wm_core
from wafer_map import wm_app
Expand Down Expand Up @@ -46,13 +40,14 @@ def standalone_app(xyd, wafer_info):
[(grid_x_1, grid_y_1, data_1), (grid_x_2, grid_y_2, data_2), ..., ]
"""
wm_app.WaferMapApp(xyd,
wafer_info.die_size,
wafer_info.center_xy,
wafer_info.dia,
wafer_info.edge_excl,
wafer_info.flat_excl,
)
wm_app.WaferMapApp(
xyd,
wafer_info.die_size,
wafer_info.center_xy,
wafer_info.dia,
wafer_info.edge_excl,
wafer_info.flat_excl,
)


def add_to_existing_app(xyd, wafer_info):
Expand All @@ -76,12 +71,13 @@ class ExampleFrame(wx.Frame):
"""Base Frame."""

def __init__(self, title, xyd, wafer_info):
wx.Frame.__init__(self,
None, # Window Parent
wx.ID_ANY, # id
title=title, # Window Title
size=(600 + 16, 500 + 38), # Size in px
)
wx.Frame.__init__(
self,
None, # Window Parent
wx.ID_ANY, # id
title=title, # Window Title
size=(600 + 16, 500 + 38), # Size in px
)
self.xyd = xyd
self.wafer_info = wafer_info

Expand All @@ -92,18 +88,20 @@ def __init__(self, title, xyd, wafer_info):
self.Bind(wx.EVT_CLOSE, self.OnQuit)

# Create some other dummy stuff for the example
self.listbox = wx.ListBox(self,
wx.ID_ANY,
choices=['A', 'B', 'C', 'D'],
)
self.listbox = wx.ListBox(
self,
wx.ID_ANY,
choices=["A", "B", "C", "D"],
)
self.button = wx.Button(self, wx.ID_ANY, label="Big Button!")

# Create the wafer map
self.panel = wm_core.WaferMapPanel(self,
self.xyd,
self.wafer_info,
show_die_gridlines=False,
)
self.panel = wm_core.WaferMapPanel(
self,
self.xyd,
self.wafer_info,
show_die_gridlines=False,
)

# set our layout
self.hbox = wx.BoxSizer(wx.HORIZONTAL)
Expand Down Expand Up @@ -138,20 +136,20 @@ def discrete_data_example(xyd, wafer_info):
The wafer information such as die size, diameter, etc.
"""
import random

bins = ["Bin1", "Bin1", "Bin1", "Bin2", "Dragons", "Bin1", "Bin2"]
discrete_xyd = [(_x, _y, random.choice(bins))
for _x, _y, _
in xyd]
discrete_xyd = [(_x, _y, random.choice(bins)) for _x, _y, _ in xyd]

wm_app.WaferMapApp(discrete_xyd,
wafer_info.die_size,
wafer_info.center_xy,
wafer_info.dia,
wafer_info.edge_excl,
wafer_info.flat_excl,
data_type=DataType.DISCRETE,
show_die_gridlines=False,
)
wm_app.WaferMapApp(
discrete_xyd,
wafer_info.die_size,
wafer_info.center_xy,
wafer_info.dia,
wafer_info.edge_excl,
wafer_info.flat_excl,
data_type=DataType.DISCRETE,
show_die_gridlines=False,
)


def main():
Expand All @@ -163,5 +161,6 @@ def main():
add_to_existing_app(xyd, wafer_info)
discrete_data_example(xyd, wafer_info)


if __name__ == "__main__":
main()
Loading

0 comments on commit 226bf46

Please sign in to comment.