dashitongzhi opened a new pull request, #759:
URL: https://github.com/apache/burr/pull/759
## Problem
In `burr/core/graph.py`, the function `_render_graphviz()` uses `format` as
a local variable name (lines 98, 100). This shadows Python's built-in
`format()` function, which can lead to confusion and potential bugs if the
builtin is needed within the function's scope. Many linters (flake8 A001/A002,
pylint W0622) flag this as a code smell.
## Fix
Renamed the local variable from `format` to `fmt` across all 5 occurrences
within the function:
```python
# Before
format = output_file_path.suffix.partition(".")[-1]
format = "png"
graphviz_obj.render(path_without_suffix, format=format, view=view)
pathlib.Path(f"{path_without_suffix}.{format}").write_bytes(...)
graphviz_obj.pipe(format=format)
# After
fmt = output_file_path.suffix.partition(".")[-1]
fmt = "png"
graphviz_obj.render(path_without_suffix, format=fmt, view=view)
pathlib.Path(f"{path_without_suffix}.{fmt}").write_bytes(...)
graphviz_obj.pipe(format=fmt)
```
The keyword argument `format=` in calls to `graphviz_obj.render()` and
`graphviz_obj.pipe()` is preserved as-is — only the local variable assignment
and its usages are renamed. All behavior remains identical.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]