[Mlir-commits] [mlir] [mlir] Python: write bytecode to a file path (PR #127118)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Thu Feb 13 12:13:33 PST 2025
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {darker}-->
:warning: Python code formatter, darker found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
darker --check --diff -r f3a29906aa07d08bbde7ec02b93d02e25d805110...b6d637b02c31f90a1f959d5f0864866e3851ec0e mlir/test/python/ir/operation.py
``````````
</details>
<details>
<summary>
View the diff from darker here.
</summary>
``````````diff
--- operation.py 2025-02-13 20:08:49.000000 +0000
+++ operation.py 2025-02-13 20:13:00.286485 +0000
@@ -619,11 +619,13 @@
bytecode = bytecode_stream.getvalue()
assert bytecode.startswith(b"ML\xefR"), "Expected bytecode to start with MLïR"
with NamedTemporaryFile() as tmpfile:
module.operation.write_bytecode(str(tmpfile.name), desired_version=1)
tmpfile.seek(0)
- assert tmpfile.read().startswith(b"ML\xefR"), "Expected bytecode to start with MLïR"
+ assert tmpfile.read().startswith(
+ b"ML\xefR"
+ ), "Expected bytecode to start with MLïR"
ctx2 = Context()
module_roundtrip = Module.parse(bytecode, ctx2)
f = io.StringIO()
module_roundtrip.operation.print(file=f)
roundtrip_value = f.getvalue()
``````````
</details>
https://github.com/llvm/llvm-project/pull/127118
More information about the Mlir-commits
mailing list