Conversation
Each of these only runs on an error/optional path, so it raised NameError instead of doing what the code intended: - Detray options/common_options.py: `os` used for --logfile but not imported - Detray options/plotting_options.py: log message used undefined `out_format` - Detray propagation_benchmarks.py: `except NVMLError` (never imported); use `nvidia_smi.NVMLError` - detray_sympy/output.py: `sys.stdout` used without importing `sys` - Python/Examples/python/odd.py: raised undefined `InvalidArgumentError`; use `ValueError` Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes five
NameErrors in Python code that only runs on error or optional paths, so they were never hit in normal use or CI. In each case the intended behaviour (log + exit, handle the NVML failure, raise a clear argument error, write to stdout) was replaced by aNameError.Detray/tests/tools/python/options/common_options.py--logfilepath usesos.path/os.mkdir, butosis not importedimport osDetray/tests/tools/python/options/plotting_options.py--output_formatlogs{out_format}(undefined) beforesys.exit(1)args.output_formatDetray/tests/tools/python/propagation_benchmarks.pyexcept NVMLError— name never imported, so an NVML failure raisesNameErrorfrom inside the handlerexcept nvidia_smi.NVMLError(nvidia_smidoesfrom pynvml import *)Detray/codegen/detray-sympy/detray_sympy/output.pywrite_out_file(code)with no file name writes tosys.stdout, butsysis not importedimport sysPython/Examples/python/odd.pygetOpenDataDetector(gen3=True, misaligned=True)raises undefinedInvalidArgumentErrorValueErrorFound with
pyflakes. Verified by calling each function on the failing path, before and after:(
nvidia_smi.NVMLErrorchecked against thenvidia-ml-py3package: resolves topynvml.NVMLError.)odd.pywas reformatted by black 26.5.1, which collapsed theraiseonto one line.🤖 Generated with Claude Code