From 54eb6526092903e65db6f55865d45ece3ddd7a46 Mon Sep 17 00:00:00 2001 From: Jan Date: Wed, 11 Sep 2024 21:06:12 +0200 Subject: [PATCH] typo pass (#577) * fix typos * revert notebook metadata Co-authored-by: Almar Klein --------- Co-authored-by: Almar Klein --- CHANGELOG.md | 4 ++-- README.md | 2 +- codegen/apipatcher.py | 2 +- codegen/wgpu_native_patcher.py | 2 +- docs/backends.rst | 2 +- docs/start.rst | 2 +- docs/utils.rst | 2 +- docs/wgpu.rst | 6 +++--- examples/compute_noop.py | 2 +- examples/wgpu-examples.ipynb | 2 +- tests/test_diagnostics.py | 2 +- tests/test_gui_base.py | 4 ++-- tests/test_gui_glfw.py | 2 +- tests/test_wgpu_native_buffer.py | 2 +- tests/test_wgpu_native_render.py | 2 +- tests/test_wgpu_native_render_tex.py | 4 ++-- tests/test_wgpu_occlusion_query.py | 2 +- wgpu/_classes.py | 12 ++++++------ wgpu/_coreutils.py | 4 ++-- wgpu/_diagnostics.py | 6 +++--- wgpu/backends/wgpu_native/_api.py | 6 +++--- wgpu/backends/wgpu_native/_helpers.py | 2 +- wgpu/gui/_gui_utils.py | 2 +- wgpu/gui/base.py | 2 +- wgpu/gui/glfw.py | 8 ++++---- wgpu/gui/jupyter.py | 2 +- wgpu/gui/offscreen.py | 2 +- wgpu/utils/compute.py | 6 +++--- 28 files changed, 48 insertions(+), 48 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 77670182..dae27d89 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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. @@ -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: diff --git a/README.md b/README.md index c4f12382..c807850d 100644 --- a/README.md +++ b/README.md @@ -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 ``` diff --git a/codegen/apipatcher.py b/codegen/apipatcher.py index a4cfdcc3..1c18a099 100644 --- a/codegen/apipatcher.py +++ b/codegen/apipatcher.py @@ -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) diff --git a/codegen/wgpu_native_patcher.py b/codegen/wgpu_native_patcher.py index 2afcd0d0..08d45eb5 100644 --- a/codegen/wgpu_native_patcher.py +++ b/codegen/wgpu_native_patcher.py @@ -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: diff --git a/docs/backends.rst b/docs/backends.rst index fabe7b35..ec3bafcd 100644 --- a/docs/backends.rst +++ b/docs/backends.rst @@ -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 `__ `PyScript `__, and `RustPyhon `__. +access to JavaScript - this backend is intended for use-cases like `PScript `__ `PyScript `__, and `RustPython `__. This backend is still a stub, see `issue #407 `__ for details. diff --git a/docs/start.rst b/docs/start.rst index 3ec9cfba..6ccc490b 100644 --- a/docs/start.rst +++ b/docs/start.rst @@ -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). diff --git a/docs/utils.rst b/docs/utils.rst index 794e43fb..c240c4bf 100644 --- a/docs/utils.rst +++ b/docs/utils.rst @@ -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 ------ diff --git a/docs/wgpu.rst b/docs/wgpu.rst index 9b5078d9..8df5cf63 100644 --- a/docs/wgpu.rst +++ b/docs/wgpu.rst @@ -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 `. 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 @@ -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 ++++++++++++++ diff --git a/examples/compute_noop.py b/examples/compute_noop.py index e997fa54..b353a09f 100644 --- a/examples/compute_noop.py +++ b/examples/compute_noop.py @@ -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 diff --git a/examples/wgpu-examples.ipynb b/examples/wgpu-examples.ipynb index 3e671058..8ddb5e0c 100644 --- a/examples/wgpu-examples.ipynb +++ b/examples/wgpu-examples.ipynb @@ -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." ] }, { diff --git a/tests/test_diagnostics.py b/tests/test_diagnostics.py index 99ebe294..0d8f62ed 100644 --- a/tests/test_diagnostics.py +++ b/tests/test_diagnostics.py @@ -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 diff --git a/tests/test_gui_base.py b/tests/test_gui_base.py index 26fc5a03..1b8ac2ba 100644 --- a/tests/test_gui_base.py +++ b/tests/test_gui_base.py @@ -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. """ @@ -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): diff --git a/tests/test_gui_glfw.py b/tests/test_gui_glfw.py index b758b9c4..10c75d64 100644 --- a/tests/test_gui_glfw.py +++ b/tests/test_gui_glfw.py @@ -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 diff --git a/tests/test_wgpu_native_buffer.py b/tests/test_wgpu_native_buffer.py index 15adc990..31f9f5e3 100644 --- a/tests/test_wgpu_native_buffer.py +++ b/tests/test_wgpu_native_buffer.py @@ -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) diff --git a/tests/test_wgpu_native_render.py b/tests/test_wgpu_native_render.py index b1e4a217..85b93884 100644 --- a/tests/test_wgpu_native_render.py +++ b/tests/test_wgpu_native_render.py @@ -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 diff --git a/tests/test_wgpu_native_render_tex.py b/tests/test_wgpu_native_render_tex.py index 8096d877..f11b7fed 100644 --- a/tests/test_wgpu_native_render_tex.py +++ b/tests/test_wgpu_native_render_tex.py @@ -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 diff --git a/tests/test_wgpu_occlusion_query.py b/tests/test_wgpu_occlusion_query.py index aa85135f..734b4805 100644 --- a/tests/test_wgpu_occlusion_query.py +++ b/tests/test_wgpu_occlusion_query.py @@ -89,7 +89,7 @@ def test_render_occluding_squares(): # Each test draws a square of size 0.1 centered at # - # 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. diff --git a/wgpu/_classes.py b/wgpu/_classes.py index 0dcde929..49c2a299 100644 --- a/wgpu/_classes.py +++ b/wgpu/_classes.py @@ -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, @@ -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: @@ -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 @@ -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. @@ -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: @@ -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()`. diff --git a/wgpu/_coreutils.py b/wgpu/_coreutils.py index 0980fa89..559fc34d 100644 --- a/wgpu/_coreutils.py +++ b/wgpu/_coreutils.py @@ -123,7 +123,7 @@ class BaseEnum(metaclass=EnumType): """ def __init__(self): - raise RuntimeError("Connot instantiate an enum.") + raise RuntimeError("Cannot instantiate an enum.") _flag_cache = {} # str -> int @@ -131,7 +131,7 @@ def __init__(self): 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) diff --git a/wgpu/_diagnostics.py b/wgpu/_diagnostics.py index 6679384f..b94e349f 100644 --- a/wgpu/_diagnostics.py +++ b/wgpu/_diagnostics.py @@ -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): @@ -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. """ @@ -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: diff --git a/wgpu/backends/wgpu_native/_api.py b/wgpu/backends/wgpu_native/_api.py index 67001826..d3252c92 100644 --- a/wgpu/backends/wgpu_native/_api.py +++ b/wgpu/backends/wgpu_native/_api.py @@ -577,7 +577,7 @@ 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()) @@ -585,7 +585,7 @@ def get_current_texture(self): 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( @@ -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 = ( diff --git a/wgpu/backends/wgpu_native/_helpers.py b/wgpu/backends/wgpu_native/_helpers.py index 24c5cda5..43b58495 100644 --- a/wgpu/backends/wgpu_native/_helpers.py +++ b/wgpu/backends/wgpu_native/_helpers.py @@ -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): diff --git a/wgpu/gui/_gui_utils.py b/wgpu/gui/_gui_utils.py index e7e97cef..99ed527e 100644 --- a/wgpu/gui/_gui_utils.py +++ b/wgpu/gui/_gui_utils.py @@ -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: diff --git a/wgpu/gui/base.py b/wgpu/gui/base.py index 8b49b6df..e172f4da 100644 --- a/wgpu/gui/base.py +++ b/wgpu/gui/base.py @@ -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 diff --git a/wgpu/gui/glfw.py b/wgpu/gui/glfw.py index 714717dc..00800eca 100644 --- a/wgpu/gui/glfw.py +++ b/wgpu/gui/glfw.py @@ -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": {}, } @@ -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) @@ -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": {}, } @@ -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 diff --git a/wgpu/gui/jupyter.py b/wgpu/gui/jupyter.py index 5ea919c9..d2cadd1c 100644 --- a/wgpu/gui/jupyter.py +++ b/wgpu/gui/jupyter.py @@ -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() diff --git a/wgpu/gui/offscreen.py b/wgpu/gui/offscreen.py index acea9622..95b6e373 100644 --- a/wgpu/gui/offscreen.py +++ b/wgpu/gui/offscreen.py @@ -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) diff --git a/wgpu/utils/compute.py b/wgpu/utils/compute.py index 3eab65e4..c6c8289a 100644 --- a/wgpu/utils/compute.py +++ b/wgpu/utils/compute.py @@ -39,9 +39,9 @@ def compute_with_buffers(input_arrays, output_arrays, shader, n=None): The format characters to cast a ``memoryview`` are hard to remember, so here's a refresher: - * "b" and "B" are signed and unsiged 8-bit ints. - * "h" and "H" are signed and unsiged 16-bit ints. - * "i" and "I" are signed and unsiged 32-bit ints. + * "b" and "B" are signed and unsigned 8-bit ints. + * "h" and "H" are signed and unsigned 16-bit ints. + * "i" and "I" are signed and unsigned 32-bit ints. * "e" and "f" are 16-bit and 32-bit floats. """