Fix typos and add codespell pre-commit hook

This commit is contained in:
Kian-Meng Ang 2022-11-22 09:54:41 +08:00
parent 8120662740
commit 201a5b3ab2
10 changed files with 14 additions and 10 deletions

View File

@ -1,4 +1,8 @@
repos:
- repo: https://github.com/codespell-project/codespell
rev: v2.2.2
hooks:
- id: codespell
- repo: https://github.com/psf/black
rev: 22.10.0
hooks:

View File

@ -87,7 +87,7 @@
(e.g. which elements are attached to some element).
Added a Table class to support this functionality.
- Added a timeout property on the @async decorator. The method is invoked
the amunt of milliseconds after the first invocation.
the amount of milliseconds after the first invocation.
0.4.1
------

View File

@ -4,7 +4,7 @@ Handles and Ports
To connect one item to another, you need something to connect, and something to connect to.
These roles are fulfilled by ``Handle`` and ``Port``.
The Handle is an item you normally see on screen as a small square, eiter green or red.
The Handle is an item you normally see on screen as a small square, either green or red.
Although the actual shape depends on the Painter_ used.
Ports represent the receiving side. A port decides if it wants a connection with a handle.

View File

@ -7,7 +7,7 @@ it easy to work with.
Next to that there's Position, which is a coordinate ``(x, y)`` defined by two variables.
To support connections between variables, a ``MatrixProjection`` class is available. It translates
a position to a common coordinate space, baed on ``Item.matrix_i2c``. Normally, it's only ``Ports`` that
a position to a common coordinate space, based on ``Item.matrix_i2c``. Normally, it's only ``Ports`` that
deal with item-to-common translation of positions.
.. autoclass:: gaphas.solver.Variable

View File

@ -80,4 +80,4 @@ decision on what should happen is done in the tool, the aspect which is then
used to work on the item ensures a certain behaviour is performed.
.. [#] as opposed to versions < 0.5, where tools could be shared among multiple views.
.. [#] not the AOP term. The term aspect is coming from a paper by Dirk Riehe: The Tools and Materials metaphore https://wiki.c2.com/?ToolsAndMaterialsMetaphor..>.
.. [#] not the AOP term. The term aspect is coming from a paper by Dirk Riehe: The Tools and Materials metaphor https://wiki.c2.com/?ToolsAndMaterialsMetaphor..>.

View File

@ -276,7 +276,7 @@ def create_window(canvas, title, zoom=1.0): # noqa too complex
assert view.model
painter = ItemPainter()
# Update bounding boxes with a temporaly CairoContext
# Update bounding boxes with a temporarily CairoContext
# (used for stuff like calculating font metrics)
tmpsurface = cairo.ImageSurface(cairo.FORMAT_ARGB32, 0, 0)
tmpcr = cairo.Context(tmpsurface)

View File

@ -14,7 +14,7 @@ class View(Protocol):
matrix_only_items: Collection[Item],
removed_items: Collection[Item],
) -> None:
"""Propage update requests to the view.
"""Propagate update requests to the view.
By invoking this method, the View will be made aware of state changes,
that will either:

View File

@ -84,7 +84,7 @@ class Quadtree(Generic[T, D]):
Capacity defines the number of elements in one tree bucket (default: 10).
The resize_step defines the increments in which the quadtree will grow when items
are moved out of the current quadtree boundries.
are moved out of the current quadtree boundaries.
"""
self._capacity = capacity
self._resize_step = resize_step

View File

@ -41,7 +41,7 @@ class BaseConstraint:
self._variables = [v for v in variables if hasattr(v, "strength")]
strength = min(v.strength for v in self._variables)
# manage weakest based on id, so variables are uniquely identifyable
# manage weakest based on id, so variables are uniquely identifiable
self._weakest = [(id(v), v) for v in self._variables if v.strength == strength]
self._handlers: set[Callable[[Constraint], None]] = set()
@ -113,7 +113,7 @@ class BaseConstraint:
class MultiConstraint:
"""A constraint constaining constraints."""
"""A constraint containing constraints."""
def __init__(self, *constraints: Constraint):
self._constraints = constraints

View File

@ -9,7 +9,7 @@ from gaphas.view import GtkView
def hover_tool(view: GtkView) -> Gtk.EventController:
"""Highlight the currenly hovered item."""
"""Highlight the currently hovered item."""
ctrl = (
Gtk.EventControllerMotion.new(view)
if Gtk.get_major_version() == 3