From b98f9b9df84894a44ff0ff9807c5f72c6e337c85 Mon Sep 17 00:00:00 2001 From: Evan Sultanik Date: Wed, 29 Nov 2023 16:36:42 -0500 Subject: [PATCH] Fixes a context matcher error --- polyfile/magic.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/polyfile/magic.py b/polyfile/magic.py index c933332..1b19d83 100644 --- a/polyfile/magic.py +++ b/polyfile/magic.py @@ -56,7 +56,8 @@ def get_resource_contents(package): return resources.contents(package) else: def get_resource_path(name: str) -> Path: - return resources.as_file(resources.files(magic_defs).joinpath(name)) + with resources.as_file(resources.files(magic_defs).joinpath(name)) as f: + return f def get_resource_contents(package): return (resource.name for resource in resources.files(package).iterdir() if resource.is_file())