Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
8d2080d0
Kaydet (Commit)
8d2080d0
authored
Ock 12, 1995
tarafından
Guido van Rossum
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
use getattr() instead of eval(), fix string representations
üst
fb00a99e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
4 deletions
+4
-4
repr.py
Lib/repr.py
+4
-4
No files found.
Lib/repr.py
Dosyayı görüntüle @
8d2080d0
...
...
@@ -18,16 +18,15 @@ class Repr:
if
' '
in
typename
:
parts
=
string
.
split
(
typename
)
typename
=
string
.
joinfields
(
parts
,
'_'
)
try
:
f
=
eval
(
'self.repr_'
+
typename
)
e
xcept
AttributeError
:
if
hasattr
(
self
,
'repr_'
+
typename
)
:
return
getattr
(
self
,
'repr_'
+
typename
)(
x
,
level
)
e
lse
:
s
=
`x`
if
len
(
s
)
>
self
.
maxother
:
i
=
max
(
0
,
(
self
.
maxother
-
3
)
/
2
)
j
=
max
(
0
,
self
.
maxother
-
3
-
i
)
s
=
s
[:
i
]
+
'...'
+
s
[
len
(
s
)
-
j
:]
return
s
return
f
(
x
,
level
)
def
repr_tuple
(
self
,
x
,
level
):
n
=
len
(
x
)
if
n
==
0
:
return
'()'
...
...
@@ -68,6 +67,7 @@ class Repr:
if
len
(
s
)
>
self
.
maxstring
:
i
=
max
(
0
,
(
self
.
maxstring
-
3
)
/
2
)
j
=
max
(
0
,
self
.
maxstring
-
3
-
i
)
s
=
`x[:i] + x[len(x)-j:]`
s
=
s
[:
i
]
+
'...'
+
s
[
len
(
s
)
-
j
:]
return
s
def
repr_long_int
(
self
,
x
,
level
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment