Skip to content

Commit

Permalink
Add origin property. Ref #404.
Browse files Browse the repository at this point in the history
  • Loading branch information
jaraco committed Jun 8, 2023
1 parent 4ebe490 commit 5898112
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions importlib_metadata/__init__.py
Expand Up @@ -3,8 +3,10 @@
import abc
import csv
import sys
import json
import zipp
import email
import types
import inspect
import pathlib
import operator
Expand Down Expand Up @@ -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):
"""
Expand Down

0 comments on commit 5898112

Please sign in to comment.