Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Lib/json/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,8 @@
from .encoder import JSONEncoder
import codecs

lazy from warnings import _deprecated

_default_encoder = JSONEncoder(
skipkeys=False,
ensure_ascii=True,
Expand Down Expand Up @@ -388,8 +390,6 @@ def loads(s, *, cls=None, object_hook=None, parse_float=None,

def __getattr__(name):
if name == "__version__":
from warnings import _deprecated

_deprecated("__version__", remove=(3, 20))
return "2.0.9" # Do not change
raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
5 changes: 3 additions & 2 deletions Lib/json/tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@
See `json.__main__` for a usage example (invocation as
`python -m json.tool` is supported for backwards compatibility).
"""
import argparse
import json
import re
import sys
from _colorize import get_theme, can_colorize

lazy import argparse
lazy from _colorize import can_colorize, get_theme


# The string we are colorizing is valid JSON,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Speed up ``import json.tool`` by importing :mod:`argparse` and ``_colorize``
lazily.
Comment thread
brittanyrey marked this conversation as resolved.
Outdated
Loading