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
be9b507b
Kaydet (Commit)
be9b507b
authored
Şub 09, 2001
tarafından
Eric S. Raymond
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
String method conversion.
üst
be185528
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
12 deletions
+12
-12
locale.py
Lib/locale.py
+12
-12
xmllib.py
Lib/xmllib.py
+0
-0
No files found.
Lib/locale.py
Dosyayı görüntüle @
be9b507b
...
...
@@ -11,7 +11,7 @@
"""
import
s
tring
,
s
ys
import
sys
# Try importing the _locale module.
#
...
...
@@ -140,24 +140,24 @@ def str(val):
"""Convert float to integer, taking the locale into account."""
return
format
(
"
%.12
g"
,
val
)
def
atof
(
str
,
func
=
string
.
atof
):
def
atof
(
str
,
func
=
float
):
"Parses a string as a float according to the locale settings."
#First, get rid of the grouping
ts
=
localeconv
()[
'thousands_sep'
]
if
ts
:
s
=
str
ing
.
split
(
str
,
ts
)
str
=
string
.
join
(
s
,
""
)
s
=
str
.
split
(
ts
)
str
=
""
.
join
(
s
)
#next, replace the decimal point with a dot
dd
=
localeconv
()[
'decimal_point'
]
if
dd
:
s
=
str
ing
.
split
(
str
,
dd
)
str
=
string
.
join
(
s
,
'.'
)
s
=
str
.
split
(
dd
)
str
=
'.'
.
join
(
s
)
#finally, parse the string
return
func
(
str
)
def
atoi
(
str
):
"Converts a string to an integer according to the locale settings."
return
atof
(
str
,
string
.
atoi
)
return
atof
(
str
,
int
)
def
_test
():
setlocale
(
LC_ALL
,
""
)
...
...
@@ -194,12 +194,12 @@ def normalize(localename):
"""
# Normalize the locale name and extract the encoding
fullname
=
string
.
lower
(
localename
)
fullname
=
localename
.
lower
(
)
if
':'
in
fullname
:
# ':' is sometimes used as encoding delimiter.
fullname
=
string
.
replace
(
fullname
,
':'
,
'.'
)
fullname
=
fullname
.
replace
(
':'
,
'.'
)
if
'.'
in
fullname
:
langname
,
encoding
=
string
.
split
(
fullname
,
'.'
)[:
2
]
langname
,
encoding
=
fullname
.
split
(
'.'
)[:
2
]
fullname
=
langname
+
'.'
+
encoding
else
:
langname
=
fullname
...
...
@@ -214,7 +214,7 @@ def normalize(localename):
code
=
locale_alias
.
get
(
langname
,
None
)
if
code
is
not
None
:
if
'.'
in
code
:
langname
,
defenc
=
string
.
split
(
code
,
'.'
)
langname
,
defenc
=
code
.
split
(
'.'
)
else
:
langname
=
code
defenc
=
''
...
...
@@ -246,7 +246,7 @@ def _parse_localename(localename):
"""
code
=
normalize
(
localename
)
if
'.'
in
code
:
return
string
.
split
(
code
,
'.'
)[:
2
]
return
code
.
split
(
'.'
)[:
2
]
elif
code
==
'C'
:
return
None
,
None
else
:
...
...
Lib/xmllib.py
Dosyayı görüntüle @
be9b507b
This diff is collapsed.
Click to expand it.
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