Skip to content

Commit

Permalink
typo pass (#577)
Browse files Browse the repository at this point in the history
* fix typos

* revert notebook metadata

Co-authored-by: Almar Klein <[email protected]>

---------

Co-authored-by: Almar Klein <[email protected]>
  • Loading branch information
Vipitis and almarklein committed Sep 11, 2024
1 parent e9e3672 commit 54eb652
Show file tree
Hide file tree
Showing 28 changed files with 48 additions and 48 deletions.
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ Added:
Changed:

* The flags and enums are implemented using a new enum class, enabling better static code analysis (i.e. autocompletion in IDE's).
* Native (desktop) features must now be specified in the same way as normal (WebGPU) features: lowercase and whith hyphens between the words.
* Native (desktop) features must now be specified in the same way as normal (WebGPU) features: lowercase and with hyphens between the words.
* Bindings can omit offset and size (the full size will be used). This makes our API follow WebGPU better.
* Support omitting fields from `BindGroupLayoutEntry`, `BufferBindingLayout`, `SamplerBindingLayout`, `StorageTextureBindingLayout`, `VertexState`. See https://github.com/pygfx/wgpu-py/pull/534 for details.
* In cases where a `view_dimension` is given, it must be provided as a string (e.g. '2d'). Ints are no longer allowed, because e.g. 2 does *not* mean '2d', which can be a source of confusion.
Expand Down Expand Up @@ -689,7 +689,7 @@ recommend using WGSL instead.

Added:

* Added `GPUAdaper.properties` (the amount of information it contains will increase in the future).
* Added `GPUAdapter.properties` (the amount of information it contains will increase in the future).
* Added proper support for WGSL.

Changed:
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ for details.

Also see the [online documentation](https://wgpu-py.readthedocs.io) and the [examples](https://github.com/pygfx/wgpu-py/tree/main/examples).

The full API is accessable via the main namespace:
The full API is accessible via the main namespace:
```py
import wgpu
```
Expand Down
2 changes: 1 addition & 1 deletion codegen/apipatcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,7 @@ def get_required_method_names(self, classname):


class StructValidationChecker(Patcher):
"""Checks that all structs are vaildated in the methods that have incoming structs."""
"""Checks that all structs are validated in the methods that have incoming structs."""

def apply(self, code):
self._init(code)
Expand Down
2 changes: 1 addition & 1 deletion codegen/wgpu_native_patcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ def patch_wgpu_native_backend(code):
For functions:
* Verify that the function exists in wgpu.h. If not, add a fixme comment.
* Add a comment showing correspinding signature from wgpu.h.
* Add a comment showing corresponding signature from wgpu.h.
For structs:
Expand Down
2 changes: 1 addition & 1 deletion docs/backends.rst
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,6 @@ The js_webgpu backend
This backend calls into the JavaScript WebGPU API. For this, the Python code would need
access to JavaScript - this backend is intended for use-cases like `PScript <https://github.com/flexxui/pscript>`__ `PyScript <https://github.com/pyscript/pyscript>`__, and `RustPyhon <https://github.com/RustPython/RustPython>`__.
access to JavaScript - this backend is intended for use-cases like `PScript <https://github.com/flexxui/pscript>`__ `PyScript <https://github.com/pyscript/pyscript>`__, and `RustPython <https://github.com/RustPython/RustPython>`__.

This backend is still a stub, see `issue #407 <https://github.com/pygfx/wgpu-py/issues/407>`__ for details.
2 changes: 1 addition & 1 deletion docs/start.rst
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,6 @@ The distribution's version of Lavapipe may be a bit outdated. To get a more rece
.. note::

The precise visual output may differ between differen implementations of Vulkan/Metal/DX12.
The precise visual output may differ between different implementations of Vulkan/Metal/DX12.
Therefore you should probably avoid per-pixel comparisons when multiple different systems are
involved. In wgpu-py and pygfx we have solved this by generating all reference images on CI (with Lavapipe).
2 changes: 1 addition & 1 deletion docs/utils.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Utils
=====

The wgpu library provides a few utilities. Note that most functions below need to be explictly imported.
The wgpu library provides a few utilities. Note that most functions below need to be explicitly imported.

Logger
------
Expand Down
6 changes: 3 additions & 3 deletions docs/wgpu.rst
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,11 @@ Adapter, device and canvas
The :class:`GPU` class represents the API root/entrypoint. An instance is available at ``wgpu.gpu``. This instance is loaded from one the :doc:`backends <backends>`.

The :class:`GPUAdapter` represents a hardware or software device, with specific
features, limits and properties. To actually start using that harware for computations or rendering, a :class:`GPUDevice` object must be requisted from the adapter. This is a logical unit
features, limits and properties. To actually start using that hardware for computations or rendering, a :class:`GPUDevice` object must be requisted from the adapter. This is a logical unit
to control your hardware (or software).
The device is the central object; most other GPU objects are created from it.
Also see the convenience function :func:`wgpu.utils.get_default_device`.
Information on the adapter can be obtained using :attr:`wgpu.GPUAdapter.info` (a dict simular to :class:`GPUAdapterInfo`) or :attr:`wgpu.GPUAdapter.summary`.
Information on the adapter can be obtained using :attr:`wgpu.GPUAdapter.info` (a dict similar to :class:`GPUAdapterInfo`) or :attr:`wgpu.GPUAdapter.summary`.

A device is controlled with a specific backend API. By default one is selected automatically.
This can be overridden by setting the
Expand Down Expand Up @@ -137,7 +137,7 @@ except for submitting it to the :class:`GPUQueue`.

The command buffers are one-time use. The :class:`GPURenderBundle` and :class:`GPURenderBundleEncoder` can
be used to record commands to be used multiple times, but this is not yet
implememted in wgpu-py.
implemented in wgpu-py.

Error handling
++++++++++++++
Expand Down
2 changes: 1 addition & 1 deletion examples/compute_noop.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
# %% The short version, using memoryview

# The first arg is the input data, per binding
# The second arg are the ouput types, per binding
# The second arg are the output types, per binding
out = compute_with_buffers({0: data}, {1: (n, "i")}, shader_source, n=n)

# The result is a dict matching the output types
Expand Down
2 changes: 1 addition & 1 deletion examples/wgpu-examples.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
"source": [
"## Event example\n",
"\n",
"The code below is a copy from `show_events.py`. It is just to show how events are handled. These events are the same accross all auto-backends."
"The code below is a copy from `show_events.py`. It is just to show how events are handled. These events are the same across all auto-backends."
]
},
{
Expand Down
2 changes: 1 addition & 1 deletion tests/test_diagnostics.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def get_dict(self):


def test_diagnostics_meta():
# Test that our custom class does what we expet it to do
# Test that our custom class does what we expect it to do
assert isinstance(wgpu.diagnostics, DiagnosticsRoot)
assert wgpu.diagnostics is _diagnostics.diagnostics

Expand Down
4 changes: 2 additions & 2 deletions tests/test_gui_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def test_base_canvas_context():

def test_canvas_logging(caplog):
"""As we attempt to draw, the canvas will error, which are logged.
Each first occurance is logged with a traceback. Subsequent same errors
Each first occurrence is logged with a traceback. Subsequent same errors
are much shorter and have a counter.
"""

Expand Down Expand Up @@ -96,7 +96,7 @@ def get_physical_size(self):
return self.physical_size

def _request_draw(self):
# Note: this would normaly schedule a call in a later event loop iteration
# Note: this would normally schedule a call in a later event loop iteration
self._draw_frame_and_present()

def present(self, texture):
Expand Down
2 changes: 1 addition & 1 deletion tests/test_gui_glfw.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ async def miniloop():
# We should have had just one draw
assert frame_counter == 2

# Change the canvase size
# Change the canvas size
canvas.set_logical_size(300, 200)
canvas.set_logical_size(400, 300)
# We should have had just one draw
Expand Down
2 changes: 1 addition & 1 deletion tests/test_wgpu_native_buffer.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ def test_buffer_mapping_fails():
with raises(ValueError):
buf.write_mapped(data, -8) # not neg
with raises(ValueError):
buf.write_mapped(data, 6) # not multilpe of eight
buf.write_mapped(data, 6) # not multiple of eight

# Ok
buf.write_mapped(b"1" * 4)
Expand Down
2 changes: 1 addition & 1 deletion tests/test_wgpu_native_render.py
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,7 @@ def test_render_orange_square_scissor(use_render_bundle):

def cb(renderpass):
renderpass.set_scissor_rect(0, 0, 32, 32)
# Alse set blend color. Does not change outout, but covers the call.
# Else set blend color. Does not change output, but covers the call.
renderpass.set_blend_constant((0, 0, 0, 1))

# Bindings and layout
Expand Down
4 changes: 2 additions & 2 deletions tests/test_wgpu_native_render_tex.py
Original file line number Diff line number Diff line change
Expand Up @@ -490,14 +490,14 @@ def render_textured_square(fragment_shader, texture_format, texture_size, textur
elif texture_format.endswith("float"):
# On Vanilla wgpu, float32 textures cannot use a filtering
# (interpolating) texture, (need to enable a feature for that).
# Without it, we need to use a non-filterin sampler.
# Without it, we need to use a non-filtering sampler.
texture_sample_type = wgpu.TextureSampleType.unfilterable_float
sampler_type = wgpu.SamplerBindingType.non_filtering
elif "uint" in texture_format:
# Cannot even use a sampler (use textureLoad instwad of textureSample)
texture_sample_type = wgpu.TextureSampleType.uint
else:
# Dito
# Ditto
texture_sample_type = wgpu.TextureSampleType.sint

# Bindings and layout
Expand Down
2 changes: 1 addition & 1 deletion tests/test_wgpu_occlusion_query.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ def test_render_occluding_squares():

# Each test draws a square of size 0.1 centered at
# <x_offset, y_offset, z>
# with the z corrdinate being "z"
# with the z coordinate being "z"
# "Result" indicates whether drawing this square generates any non-occluded points.
def draw_square(result, x_offset=0.0, y_offset=0.0, z=0.5, reverse=False):
# See WGSL above for order. Add padding.
Expand Down
12 changes: 6 additions & 6 deletions wgpu/_classes.py
Original file line number Diff line number Diff line change
Expand Up @@ -624,7 +624,7 @@ def create_sampler(
min_filter (enums.FilterMode): Interpolation when zoomed out. Default 'nearest'.
mipmap_filter: (enums.MipmapFilterMode): Interpolation between mip levels. Default 'nearest'.
lod_min_clamp (float): The minimum level of detail. Default 0.
lod_max_clamp (float): The maxium level of detail. Default 32.
lod_max_clamp (float): The maximum level of detail. Default 32.
compare (enums.CompareFunction): The sample compare operation for depth textures.
Only specify this for depth textures. Default None.
max_anisotropy (int): The maximum anisotropy value clamp used by the sample,
Expand Down Expand Up @@ -961,7 +961,7 @@ def create_render_bundle_encoder(
"""Create a `GPURenderBundleEncoder` object.
Render bundles represent a pre-recorded bundle of commands. In cases where the same
commands are issued accross multiple views or frames, using a rander bundle can improve
commands are issued across multiple views or frames, using a rander bundle can improve
performance by removing the overhead of repeating the commands.
Arguments:
Expand Down Expand Up @@ -1106,7 +1106,7 @@ def read_mapped(self, buffer_offset=None, size=None, *, copy=True):
buffer_offset (int): the buffer offset in bytes. Must be at
least as large as the offset specified in ``map()``. The default
is the offset of the mapped range.
size (int): the size to read (in bytes). The resuling range must fit into the range
size (int): the size to read (in bytes). The resulting range must fit into the range
specified in ``map()``. The default is as large as the mapped range allows.
copy (bool): whether a copy of the data is given. Default True.
If False, the returned memoryview represents the mapped data
Expand Down Expand Up @@ -1142,7 +1142,7 @@ def write_mapped(self, data, buffer_offset=None, size=None):
is the offset of the mapped range.
size (int): the size to write (in bytes). The default is the size of
the data, so this argument can typically be ignored. The
resuling range must fit into the range specified in ``map()``.
resulting range must fit into the range specified in ``map()``.
Alignment: the buffer offset must be a multiple of 8, the size must be a multiple of 4.
Expand Down Expand Up @@ -1283,7 +1283,7 @@ def create_view(
):
"""Create a `GPUTextureView` object.
If no aguments are given, a default view is given, with the
If no arguments are given, a default view is given, with the
same format and dimension as the texture.
Arguments:
Expand Down Expand Up @@ -1929,7 +1929,7 @@ def write_buffer(self, buffer, buffer_offset, data, data_offset=0, size=None):
This maps the data to a temporary buffer and then copies that buffer
to the given buffer. The given buffer's usage must include COPY_DST.
Alignment: the buffer offset must be a multple of 4, the total size to write must be a multiple of 4 bytes.
Alignment: the buffer offset must be a multiple of 4, the total size to write must be a multiple of 4 bytes.
Also see `GPUBuffer.map()`.
Expand Down
4 changes: 2 additions & 2 deletions wgpu/_coreutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,15 +123,15 @@ class BaseEnum(metaclass=EnumType):
"""

def __init__(self):
raise RuntimeError("Connot instantiate an enum.")
raise RuntimeError("Cannot instantiate an enum.")


_flag_cache = {} # str -> int


def str_flag_to_int(flag, s):
"""Allow using strings for flags, i.e. 'READ' instead of wgpu.MapMode.READ.
No worries about repeated overhead, because the resuls are cached.
No worries about repeated overhead, because the results are cached.
"""
cache_key = f"{flag.__name__}.{s}" # use class name
value = _flag_cache.get(cache_key, None)
Expand Down
6 changes: 3 additions & 3 deletions wgpu/_diagnostics.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ def dict_to_text(d, header=None):
for row in rows:
row[0] = row[0].rjust(max_lens[0])

# For the table layour we also rjust the other columns
# For the table layout we also rjust the other columns
if table_layout:
for row in rows:
for i in range(1, ncols):
Expand All @@ -246,7 +246,7 @@ def dict_to_text(d, header=None):
return text.rstrip() + "\n"


def dict_to_table(d, header, header_offest=0):
def dict_to_table(d, header, header_offset=0):
"""Convert a dict data structure to a table (a list of lists of strings).
The keys form the first entry of the row. Values that are dicts recurse.
"""
Expand All @@ -259,7 +259,7 @@ def dict_to_table(d, header, header_offest=0):
rows.append([""] * ncols)
row = [row_title + ":" if row_title else ""]
rows.append(row)
for i in range(header_offest + 1, len(header)):
for i in range(header_offset + 1, len(header)):
key = header[i]
val = values.get(key, None)
if val is None:
Expand Down
6 changes: 3 additions & 3 deletions wgpu/backends/wgpu_native/_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -577,15 +577,15 @@ def get_current_texture(self):
# for doing this check on the former systems, is that errors
# get logged, which would not be there if we did not
# pre-emptively reconfigure. These log entries are harmless but
# anoying, and I currently don't know how to prevent them
# annoying, and I currently don't know how to prevent them
# elegantly. See issue #352
old_size = (self._config.width, self._config.height)
new_size = tuple(self._get_canvas().get_physical_size())
if old_size != new_size:
self._configure(self._config)

# Try to obtain a texture.
# `If it fails, depending on status, we reconfure and try again.
# `If it fails, depending on status, we reconfigure and try again.

# H: texture: WGPUTexture, suboptimal: WGPUBool/int, status: WGPUSurfaceGetCurrentTextureStatus
surface_texture = new_struct_p(
Expand Down Expand Up @@ -2438,7 +2438,7 @@ def begin_render_pass(
check_struct("RenderPassColorAttachment", color_attachment)
texture_view = color_attachment["view"]
if not isinstance(texture_view, GPUTextureView):
raise TypeError("Color attachement view must be a GPUTextureView.")
raise TypeError("Color attachment view must be a GPUTextureView.")
texture_view_id = texture_view._internal
objects_to_keep_alive[texture_view_id] = texture_view
c_resolve_target = (
Expand Down
2 changes: 1 addition & 1 deletion wgpu/backends/wgpu_native/_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ def log_error(self, message):

class SafeLibCalls:
"""Object that copies all library functions, but wrapped in such
a way that errors occuring in that call are raised as exceptions.
a way that errors occurring in that call are raised as exceptions.
"""

def __init__(self, lib, error_handler):
Expand Down
2 changes: 1 addition & 1 deletion wgpu/gui/_gui_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def asyncio_is_running():
@contextmanager
def log_exception(kind):
"""Context manager to log any exceptions, but only log a one-liner
for subsequent occurances of the same error to avoid spamming by
for subsequent occurrences of the same error to avoid spamming by
repeating errors in e.g. a draw function or event callback.
"""
try:
Expand Down
2 changes: 1 addition & 1 deletion wgpu/gui/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ def _get_event_wait_time(self):
def _handle_event_rate_limited(
self, event, call_later_func, match_keys, accum_keys
):
"""Alternative `to handle_event()` for events that must be rate-limted.
"""Alternative `to handle_event()` for events that must be rate-limited.
If any of the ``match_keys`` keys of the new event differ from the currently
pending event, the old event is dispatched now. The ``accum_keys`` keys of
Expand Down
8 changes: 4 additions & 4 deletions wgpu/gui/glfw.py
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ def _on_mouse_button(self, window, but, action, mods):
"button": button,
"buttons": tuple(self._pointer_buttons),
"modifiers": tuple(self._key_modifiers),
"ntouches": 0, # glfw dows not have touch support
"ntouches": 0, # glfw does not have touch support
"touches": {},
}

Expand Down Expand Up @@ -421,7 +421,7 @@ def _follow_double_click(self, action, button):
"button": button,
"buttons": tuple(self._pointer_buttons),
"modifiers": tuple(self._key_modifiers),
"ntouches": 0, # glfw dows not have touch support
"ntouches": 0, # glfw does not have touch support
"touches": {},
}
self._handle_event_and_flush(ev)
Expand All @@ -440,7 +440,7 @@ def _on_cursor_pos(self, window, x, y):
"button": 0,
"buttons": tuple(self._pointer_buttons),
"modifiers": tuple(self._key_modifiers),
"ntouches": 0, # glfw dows not have touch support
"ntouches": 0, # glfw does not have touch support
"touches": {},
}

Expand Down Expand Up @@ -573,7 +573,7 @@ async def keep_glfw_alive():
"""Co-routine that lives forever, keeping glfw going.
Although it stops the event-loop if there are no more canvases (and we're
runnning the loop), this task stays active and continues when the loop is
running the loop), this task stays active and continues when the loop is
restarted.
"""
# TODO: this is not particularly pretty. It'd be better to use normal asyncio to
Expand Down
2 changes: 1 addition & 1 deletion wgpu/gui/jupyter.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def get_frame(self):
self._request_draw_timer_running = False
# The _draw_frame_and_present() does the drawing and then calls
# present_context.present(), which calls our present() method.
# The resuls is either a numpy array or None, and this matches
# The result is either a numpy array or None, and this matches
# with what this method is expected to return.
return self._draw_frame_and_present()

Expand Down
2 changes: 1 addition & 1 deletion wgpu/gui/offscreen.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def get_current_texture(self):

def present(self):
if not self._texture:
msg = "present() is called without a preceeding call to "
msg = "present() is called without a preceding call to "
msg += "get_current_texture(). Note that present() is usually "
msg += "called automatically after the draw function returns."
raise RuntimeError(msg)
Expand Down
Loading

0 comments on commit 54eb652

Please sign in to comment.