Skip to content

Commit e055683

Browse files
committed
Use private imports
1 parent 82d7d1f commit e055683

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

‎Lib/pprint.py‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,9 @@
3939
import types as _types
4040
from io import StringIO as _StringIO
4141

42-
lazy from dataclasses import is_dataclass
43-
lazy from dataclasses import fields as dataclass_fields
44-
lazy import re
42+
lazy from dataclasses import is_dataclass as _is_dataclass
43+
lazy from dataclasses import fields as _dataclass_fields
44+
lazy import re as _re
4545

4646
__all__ = ["pprint","pformat","isreadable","isrecursive","saferepr",
4747
"PrettyPrinter", "pp"]
@@ -208,7 +208,7 @@ def _format(self, object, stream, indent, allowance, context, level):
208208
p(self, object, stream, indent, allowance, context, level + 1)
209209
del context[objid]
210210
return
211-
elif (is_dataclass(object) and
211+
elif (_is_dataclass(object) and
212212
not isinstance(object, type) and
213213
object.__dataclass_params__.repr and
214214
# Check dataclass has generated repr method.
@@ -248,7 +248,7 @@ def _pprint_dataclass(self, object, stream, indent, allowance, context, level):
248248
indent += self._indent_per_level
249249
else:
250250
indent += len(cls_name) + 1
251-
items = [(f.name, getattr(object, f.name)) for f in dataclass_fields(object) if f.repr]
251+
items = [(f.name, getattr(object, f.name)) for f in _dataclass_fields(object) if f.repr]
252252
stream.write(self._format_block_start(cls_name + '(', indent))
253253
self._format_namespace_items(items, stream, indent, allowance, context, level)
254254
stream.write(self._format_block_end(')', indent - self._indent_per_level))
@@ -423,7 +423,7 @@ def _pprint_str(self, object, stream, indent, allowance, context, level):
423423
chunks.append(rep)
424424
else:
425425
# A list of alternating (non-space, space) strings
426-
parts = re.findall(r'\S*\s*', line)
426+
parts = _re.findall(r'\S*\s*', line)
427427
assert parts
428428
assert not parts[-1]
429429
parts.pop() # drop empty last part

0 commit comments

Comments
 (0)