diff options
author | finefoot <33361833+finefoot@users.noreply.github.com> | 2022-07-07 14:55:33 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-07-07 14:55:33 (GMT) |
commit | b6558d768f19584ad724be23030603280f9e6361 (patch) | |
tree | 30f7a50014e3deff7e1db1b69ffc2dacd4869b96 /Lib/reprlib.py | |
parent | 29f86d6c28fa9ed39e42678776d6005eaf5090c8 (diff) | |
download | cpython-b6558d768f19584ad724be23030603280f9e6361.zip cpython-b6558d768f19584ad724be23030603280f9e6361.tar.gz cpython-b6558d768f19584ad724be23030603280f9e6361.tar.bz2 |
gh-94343: Ease initialization of reprlib.Repr attributes (GH-94581)
Diffstat (limited to 'Lib/reprlib.py')
-rw-r--r-- | Lib/reprlib.py | 30 |
1 files changed, 17 insertions, 13 deletions
diff --git a/Lib/reprlib.py b/Lib/reprlib.py index f3518df..c33b4da 100644 --- a/Lib/reprlib.py +++ b/Lib/reprlib.py @@ -35,19 +35,23 @@ def recursive_repr(fillvalue='...'): class Repr: - def __init__(self): - self.fillvalue = '...' - self.maxlevel = 6 - self.maxtuple = 6 - self.maxlist = 6 - self.maxarray = 5 - self.maxdict = 4 - self.maxset = 6 - self.maxfrozenset = 6 - self.maxdeque = 6 - self.maxstring = 30 - self.maxlong = 40 - self.maxother = 30 + def __init__( + self, *, maxlevel=6, maxtuple=6, maxlist=6, maxarray=5, maxdict=4, + maxset=6, maxfrozenset=6, maxdeque=6, maxstring=30, maxlong=40, + maxother=30, fillvalue='...', + ): + self.maxlevel = maxlevel + self.maxtuple = maxtuple + self.maxlist = maxlist + self.maxarray = maxarray + self.maxdict = maxdict + self.maxset = maxset + self.maxfrozenset = maxfrozenset + self.maxdeque = maxdeque + self.maxstring = maxstring + self.maxlong = maxlong + self.maxother = maxother + self.fillvalue = fillvalue def repr(self, x): return self.repr1(x, self.maxlevel) |