Skip to content

Commit

Permalink
Defer json import
Browse files Browse the repository at this point in the history
  • Loading branch information
danielhollas committed Aug 27, 2024
1 parent 76eebe0 commit e0b4f09
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion importlib_metadata/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
import email
import functools
import itertools
import json
import operator
import os
import pathlib
Expand Down Expand Up @@ -673,6 +672,8 @@ def origin(self):
return self._load_json('direct_url.json')

def _load_json(self, filename):
import json

return pass_none(json.loads)(
self.read_text(filename),
object_hook=lambda data: types.SimpleNamespace(**data),
Expand Down

0 comments on commit e0b4f09

Please sign in to comment.