Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New ruff #648

Merged
merged 2 commits into from
Nov 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion codegen/apipatcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def patch_base_api(code):
if found_all:
part2 = part2.split("]", 1)[-1]
line = "\n__all__ = ["
line += ", ".join(f'"{name}"' for name in idl.classes.keys())
line += ", ".join(f'"{name}"' for name in sorted(idl.classes.keys()))
line += "]"
code = part1 + line + part2

Expand Down
6 changes: 3 additions & 3 deletions codegen/apiwriter.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def write_flags():
# List'm
pylines.append(f"# There are {n} flags\n")
pylines.append("__all__ = [")
for name in idl.flags.keys():
for name in sorted(idl.flags.keys()):
pylines.append(f' "{name}",')
pylines.append("]\n\n")
# The flags definitions
Expand Down Expand Up @@ -78,7 +78,7 @@ def write_enums():
# List'm
pylines.append(f"# There are {n} enums\n")
pylines.append("__all__ = [")
for name in idl.enums.keys():
for name in sorted(idl.enums.keys()):
pylines.append(f' "{name}",')
pylines.append("]\n\n")
for name, d in idl.enums.items():
Expand Down Expand Up @@ -108,7 +108,7 @@ def write_structs():
pylines.append(f"# There are {n} structs\n")
# List'm
pylines.append("__all__ = [")
for name in idl.structs.keys():
for name in sorted(idl.structs.keys()):
if name not in ignore:
pylines.append(f' "{name}",')
pylines.append("]\n\n")
Expand Down
56 changes: 28 additions & 28 deletions wgpu/_classes.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,43 +21,43 @@


__all__ = [
"GPUObjectBase",
"GPUAdapterInfo",
"GPU",
"GPUAdapter",
"GPUDevice",
"GPUBuffer",
"GPUTexture",
"GPUTextureView",
"GPUSampler",
"GPUBindGroupLayout",
"GPUAdapterInfo",
"GPUBindGroup",
"GPUPipelineLayout",
"GPUShaderModule",
"GPUCompilationMessage",
"GPUCompilationInfo",
"GPUPipelineError",
"GPUPipelineBase",
"GPUComputePipeline",
"GPURenderPipeline",
"GPUBindGroupLayout",
"GPUBindingCommandsMixin",
"GPUBuffer",
"GPUCanvasContext",
"GPUCommandBuffer",
"GPUCommandsMixin",
"GPUCommandEncoder",
"GPUBindingCommandsMixin",
"GPUDebugCommandsMixin",
"GPUCommandsMixin",
"GPUCompilationInfo",
"GPUCompilationMessage",
"GPUComputePassEncoder",
"GPURenderPassEncoder",
"GPURenderCommandsMixin",
"GPURenderBundle",
"GPURenderBundleEncoder",
"GPUQueue",
"GPUQuerySet",
"GPUCanvasContext",
"GPUComputePipeline",
"GPUDebugCommandsMixin",
"GPUDevice",
"GPUDeviceLostInfo",
"GPUError",
"GPUValidationError",
"GPUOutOfMemoryError",
"GPUInternalError",
"GPUObjectBase",
"GPUOutOfMemoryError",
"GPUPipelineBase",
"GPUPipelineError",
"GPUPipelineLayout",
"GPUQuerySet",
"GPUQueue",
"GPURenderBundle",
"GPURenderBundleEncoder",
"GPURenderCommandsMixin",
"GPURenderPassEncoder",
"GPURenderPipeline",
"GPUSampler",
"GPUShaderModule",
"GPUTexture",
"GPUTextureView",
"GPUValidationError",
]

logger = logging.getLogger("wgpu")
Expand Down
52 changes: 26 additions & 26 deletions wgpu/enums.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,40 +21,40 @@ class Enum(_BaseEnum):
# There are 34 enums

__all__ = [
"PowerPreference",
"FeatureName",
"BufferMapState",
"TextureDimension",
"TextureViewDimension",
"TextureAspect",
"TextureFormat",
"AddressMode",
"FilterMode",
"MipmapFilterMode",
"CompareFunction",
"BufferBindingType",
"SamplerBindingType",
"TextureSampleType",
"StorageTextureAccess",
"CompilationMessageType",
"PipelineErrorReason",
"AutoLayoutMode",
"PrimitiveTopology",
"FrontFace",
"CullMode",
"BlendFactor",
"BlendOperation",
"StencilOperation",
"IndexFormat",
"VertexFormat",
"VertexStepMode",
"LoadOp",
"StoreOp",
"QueryType",
"BufferBindingType",
"BufferMapState",
"CanvasAlphaMode",
"CanvasToneMappingMode",
"CompareFunction",
"CompilationMessageType",
"CullMode",
"DeviceLostReason",
"ErrorFilter",
"FeatureName",
"FilterMode",
"FrontFace",
"IndexFormat",
"LoadOp",
"MipmapFilterMode",
"PipelineErrorReason",
"PowerPreference",
"PrimitiveTopology",
"QueryType",
"SamplerBindingType",
"StencilOperation",
"StorageTextureAccess",
"StoreOp",
"TextureAspect",
"TextureDimension",
"TextureFormat",
"TextureSampleType",
"TextureViewDimension",
"VertexFormat",
"VertexStepMode",
]


Expand Down
4 changes: 2 additions & 2 deletions wgpu/flags.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ class Flags(_BaseEnum):

__all__ = [
"BufferUsage",
"ColorWrite",
"MapMode",
"TextureUsage",
"ShaderStage",
"ColorWrite",
"TextureUsage",
]


Expand Down
4 changes: 2 additions & 2 deletions wgpu/gui/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from .base import WgpuCanvasInterface, WgpuCanvasBase, WgpuAutoGui

__all__ = [
"WgpuCanvasInterface",
"WgpuCanvasBase",
"WgpuAutoGui",
"WgpuCanvasBase",
"WgpuCanvasInterface",
]
2 changes: 1 addition & 1 deletion wgpu/gui/auto.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
for e.g. wx later. Or we might decide to stick with these three.
"""

__all__ = ["WgpuCanvas", "run", "call_later"]
__all__ = ["WgpuCanvas", "call_later", "run"]

import os
import sys
Expand Down
96 changes: 48 additions & 48 deletions wgpu/structs.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,65 +30,65 @@ def __repr__(self):
# There are 60 structs

__all__ = [
"RequestAdapterOptions",
"DeviceDescriptor",
"BufferDescriptor",
"TextureDescriptor",
"TextureViewDescriptor",
"ExternalTextureDescriptor",
"SamplerDescriptor",
"BindGroupLayoutDescriptor",
"BindGroupLayoutEntry",
"BufferBindingLayout",
"SamplerBindingLayout",
"TextureBindingLayout",
"StorageTextureBindingLayout",
"ExternalTextureBindingLayout",
"BindGroupDescriptor",
"BindGroupEntry",
"BindGroupLayoutDescriptor",
"BindGroupLayoutEntry",
"BlendComponent",
"BlendState",
"BufferBinding",
"PipelineLayoutDescriptor",
"ShaderModuleDescriptor",
"ShaderModuleCompilationHint",
"PipelineErrorInit",
"ProgrammableStage",
"ComputePipelineDescriptor",
"RenderPipelineDescriptor",
"PrimitiveState",
"MultisampleState",
"FragmentState",
"BufferBindingLayout",
"BufferDescriptor",
"CanvasConfiguration",
"CanvasToneMapping",
"Color",
"ColorTargetState",
"BlendState",
"BlendComponent",
"DepthStencilState",
"StencilFaceState",
"VertexState",
"VertexBufferLayout",
"VertexAttribute",
"ImageDataLayout",
"ImageCopyBuffer",
"ImageCopyTexture",
"ImageCopyExternalImage",
"CommandBufferDescriptor",
"CommandEncoderDescriptor",
"ComputePassTimestampWrites",
"ComputePassDescriptor",
"RenderPassTimestampWrites",
"RenderPassDescriptor",
"ComputePassTimestampWrites",
"ComputePipelineDescriptor",
"DepthStencilState",
"DeviceDescriptor",
"Extent3D",
"ExternalTextureBindingLayout",
"ExternalTextureDescriptor",
"FragmentState",
"ImageCopyBuffer",
"ImageCopyExternalImage",
"ImageCopyTexture",
"ImageDataLayout",
"MultisampleState",
"Origin2D",
"Origin3D",
"PipelineErrorInit",
"PipelineLayoutDescriptor",
"PrimitiveState",
"ProgrammableStage",
"QuerySetDescriptor",
"QueueDescriptor",
"RenderBundleDescriptor",
"RenderBundleEncoderDescriptor",
"RenderPassColorAttachment",
"RenderPassDepthStencilAttachment",
"RenderPassDescriptor",
"RenderPassLayout",
"RenderBundleDescriptor",
"RenderBundleEncoderDescriptor",
"QueueDescriptor",
"QuerySetDescriptor",
"CanvasToneMapping",
"CanvasConfiguration",
"RenderPassTimestampWrites",
"RenderPipelineDescriptor",
"RequestAdapterOptions",
"SamplerBindingLayout",
"SamplerDescriptor",
"ShaderModuleCompilationHint",
"ShaderModuleDescriptor",
"StencilFaceState",
"StorageTextureBindingLayout",
"TextureBindingLayout",
"TextureDescriptor",
"TextureViewDescriptor",
"UncapturedErrorEventInit",
"Color",
"Origin2D",
"Origin3D",
"Extent3D",
"VertexAttribute",
"VertexBufferLayout",
"VertexState",
]


Expand Down