Skip to content

Commit 8136b52

Browse files
authored
Give AdapterInfo a repr (#707)
* Give AdapterInfo a repr * codegen
1 parent bd54418 commit 8136b52

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

wgpu/_classes.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -555,6 +555,10 @@ class GPUAdapterInfo:
555555
def __init__(self, info):
556556
self._info = info
557557

558+
def __repr__(self):
559+
parts = [f"{k}={v!r}" for k, v in self._info.items()]
560+
return f"<GPUAdapterInfo with {', '.join(parts)}>"
561+
558562
# IDL: readonly attribute DOMString vendor;
559563
@property
560564
def vendor(self):
@@ -2648,8 +2652,11 @@ def generic_repr(self):
26482652

26492653

26502654
def _set_repr_methods():
2655+
exceptions = ["GPUAdapterInfo"]
26512656
m = globals()
26522657
for class_name in __all__:
2658+
if class_name in exceptions:
2659+
continue
26532660
cls = m[class_name]
26542661
if len(cls.mro()) == 2: # class itself and object
26552662
cls.__repr__ = generic_repr

wgpu/resources/codegen_report.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
* Diffs for GPUTextureView: add size, add texture
1919
* Diffs for GPUBindingCommandsMixin: change set_bind_group
2020
* Diffs for GPUQueue: add read_buffer, add read_texture, hide copy_external_image_to_texture
21-
* Validated 37 classes, 123 methods, 49 properties
21+
* Validated 37 classes, 124 methods, 49 properties
2222
### Patching API for backends/wgpu_native/_api.py
2323
* Validated 37 classes, 124 methods, 0 properties
2424
## Validating backends/wgpu_native/_api.py

0 commit comments

Comments
 (0)