def METHOD_NAME():
    """Message must not trigger if the resource is allocated in a context manager."""
    class MyContextManager:
        def __init__(self):
            self.file_handle = None
        def __enter__(self):
            self.file_handle = open("foo.txt", "w", encoding="utf-8")  # must not trigger
        def __exit__(self, exc_type, exc_value, traceback):
            self.file_handle.close()