diff --git a/importlib_metadata/__init__.py b/importlib_metadata/__init__.py index 6ba414e5..79a5b17b 100644 --- a/importlib_metadata/__init__.py +++ b/importlib_metadata/__init__.py @@ -3,8 +3,10 @@ import abc import csv import sys +import json import zipp import email +import types import inspect import pathlib import operator @@ -618,6 +620,16 @@ def url_req_space(req): space = url_req_space(section.value) yield section.value + space + quoted_marker(section.name) + @property + def origin(self): + return self._load_json('direct_url.json') + + def _load_json(self, filename): + return pass_none(json.loads)( + self.read_text(filename), + object_hook=lambda data: types.SimpleNamespace(**data), + ) + class DistributionFinder(MetaPathFinder): """