Skip to content

Commit 95b5551

Browse files
authored
New ruff (#648)
* New ruff * codegen must produce sorted __all__
1 parent 350de70 commit 95b5551

File tree

8 files changed

+111
-111
lines changed

8 files changed

+111
-111
lines changed

codegen/apipatcher.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ def patch_base_api(code):
4444
if found_all:
4545
part2 = part2.split("]", 1)[-1]
4646
line = "\n__all__ = ["
47-
line += ", ".join(f'"{name}"' for name in idl.classes.keys())
47+
line += ", ".join(f'"{name}"' for name in sorted(idl.classes.keys()))
4848
line += "]"
4949
code = part1 + line + part2
5050

codegen/apiwriter.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ def write_flags():
4848
# List'm
4949
pylines.append(f"# There are {n} flags\n")
5050
pylines.append("__all__ = [")
51-
for name in idl.flags.keys():
51+
for name in sorted(idl.flags.keys()):
5252
pylines.append(f' "{name}",')
5353
pylines.append("]\n\n")
5454
# The flags definitions
@@ -78,7 +78,7 @@ def write_enums():
7878
# List'm
7979
pylines.append(f"# There are {n} enums\n")
8080
pylines.append("__all__ = [")
81-
for name in idl.enums.keys():
81+
for name in sorted(idl.enums.keys()):
8282
pylines.append(f' "{name}",')
8383
pylines.append("]\n\n")
8484
for name, d in idl.enums.items():
@@ -108,7 +108,7 @@ def write_structs():
108108
pylines.append(f"# There are {n} structs\n")
109109
# List'm
110110
pylines.append("__all__ = [")
111-
for name in idl.structs.keys():
111+
for name in sorted(idl.structs.keys()):
112112
if name not in ignore:
113113
pylines.append(f' "{name}",')
114114
pylines.append("]\n\n")

wgpu/_classes.py

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -21,43 +21,43 @@
2121

2222

2323
__all__ = [
24-
"GPUObjectBase",
25-
"GPUAdapterInfo",
2624
"GPU",
2725
"GPUAdapter",
28-
"GPUDevice",
29-
"GPUBuffer",
30-
"GPUTexture",
31-
"GPUTextureView",
32-
"GPUSampler",
33-
"GPUBindGroupLayout",
26+
"GPUAdapterInfo",
3427
"GPUBindGroup",
35-
"GPUPipelineLayout",
36-
"GPUShaderModule",
37-
"GPUCompilationMessage",
38-
"GPUCompilationInfo",
39-
"GPUPipelineError",
40-
"GPUPipelineBase",
41-
"GPUComputePipeline",
42-
"GPURenderPipeline",
28+
"GPUBindGroupLayout",
29+
"GPUBindingCommandsMixin",
30+
"GPUBuffer",
31+
"GPUCanvasContext",
4332
"GPUCommandBuffer",
44-
"GPUCommandsMixin",
4533
"GPUCommandEncoder",
46-
"GPUBindingCommandsMixin",
47-
"GPUDebugCommandsMixin",
34+
"GPUCommandsMixin",
35+
"GPUCompilationInfo",
36+
"GPUCompilationMessage",
4837
"GPUComputePassEncoder",
49-
"GPURenderPassEncoder",
50-
"GPURenderCommandsMixin",
51-
"GPURenderBundle",
52-
"GPURenderBundleEncoder",
53-
"GPUQueue",
54-
"GPUQuerySet",
55-
"GPUCanvasContext",
38+
"GPUComputePipeline",
39+
"GPUDebugCommandsMixin",
40+
"GPUDevice",
5641
"GPUDeviceLostInfo",
5742
"GPUError",
58-
"GPUValidationError",
59-
"GPUOutOfMemoryError",
6043
"GPUInternalError",
44+
"GPUObjectBase",
45+
"GPUOutOfMemoryError",
46+
"GPUPipelineBase",
47+
"GPUPipelineError",
48+
"GPUPipelineLayout",
49+
"GPUQuerySet",
50+
"GPUQueue",
51+
"GPURenderBundle",
52+
"GPURenderBundleEncoder",
53+
"GPURenderCommandsMixin",
54+
"GPURenderPassEncoder",
55+
"GPURenderPipeline",
56+
"GPUSampler",
57+
"GPUShaderModule",
58+
"GPUTexture",
59+
"GPUTextureView",
60+
"GPUValidationError",
6161
]
6262

6363
logger = logging.getLogger("wgpu")

wgpu/enums.py

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -21,40 +21,40 @@ class Enum(_BaseEnum):
2121
# There are 34 enums
2222

2323
__all__ = [
24-
"PowerPreference",
25-
"FeatureName",
26-
"BufferMapState",
27-
"TextureDimension",
28-
"TextureViewDimension",
29-
"TextureAspect",
30-
"TextureFormat",
3124
"AddressMode",
32-
"FilterMode",
33-
"MipmapFilterMode",
34-
"CompareFunction",
35-
"BufferBindingType",
36-
"SamplerBindingType",
37-
"TextureSampleType",
38-
"StorageTextureAccess",
39-
"CompilationMessageType",
40-
"PipelineErrorReason",
4125
"AutoLayoutMode",
42-
"PrimitiveTopology",
43-
"FrontFace",
44-
"CullMode",
4526
"BlendFactor",
4627
"BlendOperation",
47-
"StencilOperation",
48-
"IndexFormat",
49-
"VertexFormat",
50-
"VertexStepMode",
51-
"LoadOp",
52-
"StoreOp",
53-
"QueryType",
28+
"BufferBindingType",
29+
"BufferMapState",
5430
"CanvasAlphaMode",
5531
"CanvasToneMappingMode",
32+
"CompareFunction",
33+
"CompilationMessageType",
34+
"CullMode",
5635
"DeviceLostReason",
5736
"ErrorFilter",
37+
"FeatureName",
38+
"FilterMode",
39+
"FrontFace",
40+
"IndexFormat",
41+
"LoadOp",
42+
"MipmapFilterMode",
43+
"PipelineErrorReason",
44+
"PowerPreference",
45+
"PrimitiveTopology",
46+
"QueryType",
47+
"SamplerBindingType",
48+
"StencilOperation",
49+
"StorageTextureAccess",
50+
"StoreOp",
51+
"TextureAspect",
52+
"TextureDimension",
53+
"TextureFormat",
54+
"TextureSampleType",
55+
"TextureViewDimension",
56+
"VertexFormat",
57+
"VertexStepMode",
5858
]
5959

6060

wgpu/flags.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@ class Flags(_BaseEnum):
2323

2424
__all__ = [
2525
"BufferUsage",
26+
"ColorWrite",
2627
"MapMode",
27-
"TextureUsage",
2828
"ShaderStage",
29-
"ColorWrite",
29+
"TextureUsage",
3030
]
3131

3232

wgpu/gui/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from .base import WgpuCanvasInterface, WgpuCanvasBase, WgpuAutoGui
77

88
__all__ = [
9-
"WgpuCanvasInterface",
10-
"WgpuCanvasBase",
119
"WgpuAutoGui",
10+
"WgpuCanvasBase",
11+
"WgpuCanvasInterface",
1212
]

wgpu/gui/auto.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
for e.g. wx later. Or we might decide to stick with these three.
66
"""
77

8-
__all__ = ["WgpuCanvas", "run", "call_later"]
8+
__all__ = ["WgpuCanvas", "call_later", "run"]
99

1010
import os
1111
import sys

wgpu/structs.py

Lines changed: 48 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -30,65 +30,65 @@ def __repr__(self):
3030
# There are 60 structs
3131

3232
__all__ = [
33-
"RequestAdapterOptions",
34-
"DeviceDescriptor",
35-
"BufferDescriptor",
36-
"TextureDescriptor",
37-
"TextureViewDescriptor",
38-
"ExternalTextureDescriptor",
39-
"SamplerDescriptor",
40-
"BindGroupLayoutDescriptor",
41-
"BindGroupLayoutEntry",
42-
"BufferBindingLayout",
43-
"SamplerBindingLayout",
44-
"TextureBindingLayout",
45-
"StorageTextureBindingLayout",
46-
"ExternalTextureBindingLayout",
4733
"BindGroupDescriptor",
4834
"BindGroupEntry",
35+
"BindGroupLayoutDescriptor",
36+
"BindGroupLayoutEntry",
37+
"BlendComponent",
38+
"BlendState",
4939
"BufferBinding",
50-
"PipelineLayoutDescriptor",
51-
"ShaderModuleDescriptor",
52-
"ShaderModuleCompilationHint",
53-
"PipelineErrorInit",
54-
"ProgrammableStage",
55-
"ComputePipelineDescriptor",
56-
"RenderPipelineDescriptor",
57-
"PrimitiveState",
58-
"MultisampleState",
59-
"FragmentState",
40+
"BufferBindingLayout",
41+
"BufferDescriptor",
42+
"CanvasConfiguration",
43+
"CanvasToneMapping",
44+
"Color",
6045
"ColorTargetState",
61-
"BlendState",
62-
"BlendComponent",
63-
"DepthStencilState",
64-
"StencilFaceState",
65-
"VertexState",
66-
"VertexBufferLayout",
67-
"VertexAttribute",
68-
"ImageDataLayout",
69-
"ImageCopyBuffer",
70-
"ImageCopyTexture",
71-
"ImageCopyExternalImage",
7246
"CommandBufferDescriptor",
7347
"CommandEncoderDescriptor",
74-
"ComputePassTimestampWrites",
7548
"ComputePassDescriptor",
76-
"RenderPassTimestampWrites",
77-
"RenderPassDescriptor",
49+
"ComputePassTimestampWrites",
50+
"ComputePipelineDescriptor",
51+
"DepthStencilState",
52+
"DeviceDescriptor",
53+
"Extent3D",
54+
"ExternalTextureBindingLayout",
55+
"ExternalTextureDescriptor",
56+
"FragmentState",
57+
"ImageCopyBuffer",
58+
"ImageCopyExternalImage",
59+
"ImageCopyTexture",
60+
"ImageDataLayout",
61+
"MultisampleState",
62+
"Origin2D",
63+
"Origin3D",
64+
"PipelineErrorInit",
65+
"PipelineLayoutDescriptor",
66+
"PrimitiveState",
67+
"ProgrammableStage",
68+
"QuerySetDescriptor",
69+
"QueueDescriptor",
70+
"RenderBundleDescriptor",
71+
"RenderBundleEncoderDescriptor",
7872
"RenderPassColorAttachment",
7973
"RenderPassDepthStencilAttachment",
74+
"RenderPassDescriptor",
8075
"RenderPassLayout",
81-
"RenderBundleDescriptor",
82-
"RenderBundleEncoderDescriptor",
83-
"QueueDescriptor",
84-
"QuerySetDescriptor",
85-
"CanvasToneMapping",
86-
"CanvasConfiguration",
76+
"RenderPassTimestampWrites",
77+
"RenderPipelineDescriptor",
78+
"RequestAdapterOptions",
79+
"SamplerBindingLayout",
80+
"SamplerDescriptor",
81+
"ShaderModuleCompilationHint",
82+
"ShaderModuleDescriptor",
83+
"StencilFaceState",
84+
"StorageTextureBindingLayout",
85+
"TextureBindingLayout",
86+
"TextureDescriptor",
87+
"TextureViewDescriptor",
8788
"UncapturedErrorEventInit",
88-
"Color",
89-
"Origin2D",
90-
"Origin3D",
91-
"Extent3D",
89+
"VertexAttribute",
90+
"VertexBufferLayout",
91+
"VertexState",
9292
]
9393

9494

0 commit comments

Comments
 (0)