diff --git a/bl_pkg/bl_extension_utils.py b/bl_pkg/bl_extension_utils.py index 5564a3f..6024c23 100644 --- a/bl_pkg/bl_extension_utils.py +++ b/bl_pkg/bl_extension_utils.py @@ -341,7 +341,7 @@ def pkg_make_obsolete_for_testing(local_dir: str, pkg_id: str) -> None: fh.write(data) -def pkg_validate_data_or_error( +def pkg_manifest_dict_is_valid_or_error( pkg_idname: str, data: Dict[str, Any], from_repo: bool, @@ -715,7 +715,7 @@ class _RepoCacheEntry: pkg_idname = filename # Validate so local-only packages with invalid manifests aren't used. - if (error_str := pkg_validate_data_or_error(pkg_idname, item_local, from_repo=False)): + if (error_str := pkg_manifest_dict_is_valid_or_error(pkg_idname, item_local, from_repo=False)): error_fn(Exception(error_str)) continue diff --git a/bl_pkg/cli/blender_ext.py b/bl_pkg/cli/blender_ext.py index e6665ca..e4da697 100755 --- a/bl_pkg/cli/blender_ext.py +++ b/bl_pkg/cli/blender_ext.py @@ -821,16 +821,16 @@ def pkg_manifest_toml_is_valid_or_error(filepath: str) -> Tuple[Optional[str], D return None, result -def extract_metadata_from_data(data: bytes) -> Optional[Dict[str, Any]]: +def toml_from_bytes(data: bytes) -> Optional[Dict[str, Any]]: result = tomllib.loads(data.decode('utf-8')) assert isinstance(result, dict) return result -def extract_metadata_from_filepath(filepath: str) -> Optional[Dict[str, Any]]: +def toml_from_filepath(filepath: str) -> Optional[Dict[str, Any]]: with open(filepath, "rb") as fh: data = fh.read() - result = extract_metadata_from_data(data) + result = toml_from_bytes(data) return result @@ -847,7 +847,7 @@ def extract_metadata_from_archive(filepath: str) -> Optional[Dict[str, Any]]: if file_content is None: return None - result = extract_metadata_from_data(file_content.read()) + result = toml_from_bytes(file_content.read()) assert isinstance(result, dict) return result