osbuild/util/containers.py: disable pylint issue W0135
Disable the newly reported pylint issue W0135 (contextmanager-generator-missing-cleanup), because as far as I was able to understand the motivation behind it, it should not apply to the code and it should be a false positive. We do not use context manager inside a generator, but inside another context manager. So the execution flow should return sequentially through the stack and all context manager cleanups should be executed as expected. The reported issue: osbuild/util/containers.py:184:4: W0135: The context used in function 'container_source' will not be exited. (contextmanager-generator-missing-cleanup) Signed-off-by: Tomáš Hozza <thozza@redhat.com>
This commit is contained in:
parent
3ac6d405b5
commit
a50795b627
1 changed files with 4 additions and 0 deletions
|
|
@ -178,5 +178,9 @@ def container_source(image):
|
|||
else:
|
||||
raise RuntimeError(f"Unknown container format {container_format}")
|
||||
|
||||
# pylint: disable=contextmanager-generator-missing-cleanup
|
||||
# thozza: As far as I can tell, the problematic use case is when the ctx manager is used inside a generator.
|
||||
# However, this is not the case here. The ctx manager is used inside another ctx manager with the expectation
|
||||
# that the inner ctx manager won't be cleaned up until the execution returns to this ctx manager.
|
||||
with container_source_fn(image, image_filepath, container_format) as image_source:
|
||||
yield image_name, image_source
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue