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
afd44de8
Kaydet (Commit)
afd44de8
authored
Ara 12, 2002
tarafından
Greg Ward
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Hardcode the recognized whitespace characters to the US-ASCII whitespace
chars. See the comment for rationale.
üst
b5bfb9f3
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
3 deletions
+12
-3
textwrap.py
Lib/textwrap.py
+12
-3
No files found.
Lib/textwrap.py
Dosyayı görüntüle @
afd44de8
...
...
@@ -12,6 +12,16 @@ __revision__ = "$Id$"
import
string
,
re
# Hardcode the recognized whitespace characters to the US-ASCII
# whitespace characters. The main reason for doing this is that in
# ISO-8859-1, 0xa0 is non-breaking whitespace, so in certain locales
# that character winds up in string.whitespace. Respecting
# string.whitespace in those cases would 1) make textwrap treat 0xa0 the
# same as any other whitespace char, which is clearly wrong (it's a
# *non-breaking* space), 2) possibly cause problems with Unicode,
# since 0xa0 is not in range(128).
whitespace
=
'
\t\n\x0b\x0c\r
'
class
TextWrapper
:
"""
Object for wrapping/filling text. The public interface consists of
...
...
@@ -48,12 +58,11 @@ class TextWrapper:
be broken, and some lines might be longer than 'width'.
"""
whitespace_trans
=
string
.
maketrans
(
string
.
whitespace
,
' '
*
len
(
string
.
whitespace
))
whitespace_trans
=
string
.
maketrans
(
whitespace
,
' '
*
len
(
whitespace
))
unicode_whitespace_trans
=
{}
uspace
=
ord
(
u' '
)
for
x
in
map
(
ord
,
string
.
whitespace
):
for
x
in
map
(
ord
,
whitespace
):
unicode_whitespace_trans
[
x
]
=
uspace
# This funky little regex is just the trick for splitting
...
...
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