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 Jul 30, 2023
1 parent 8e7b968 commit ae9ca43
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions importlib_metadata/__init__.py
Original file line number Diff line number Diff line change
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 ae9ca43

Please sign in to comment.