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
827fdaae
Kaydet (Commit)
827fdaae
authored
Kas 30, 2010
tarafından
Alexander Belopolsky
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue #10552: Partially fixed a sort error in Tools/unicode/gencodec.py
üst
f498b754
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
7 deletions
+10
-7
gencodec.py
Tools/unicode/gencodec.py
+10
-7
No files found.
Tools/unicode/gencodec.py
Dosyayı görüntüle @
827fdaae
...
@@ -34,6 +34,9 @@ MAX_TABLE_SIZE = 8192
...
@@ -34,6 +34,9 @@ MAX_TABLE_SIZE = 8192
# Standard undefined Unicode code point
# Standard undefined Unicode code point
UNI_UNDEFINED
=
chr
(
0xFFFE
)
UNI_UNDEFINED
=
chr
(
0xFFFE
)
# Placeholder for a missing codepoint
MISSING_CODE
=
-
1
mapRE
=
re
.
compile
(
'((?:0x[0-9a-fA-F]+
\
+?)+)'
mapRE
=
re
.
compile
(
'((?:0x[0-9a-fA-F]+
\
+?)+)'
'
\
s+'
'
\
s+'
'((?:(?:0x[0-9a-fA-Z]+|<[A-Za-z]+>)
\
+?)*)'
'((?:(?:0x[0-9a-fA-Z]+|<[A-Za-z]+>)
\
+?)*)'
...
@@ -52,7 +55,7 @@ def parsecodes(codes, len=len, range=range):
...
@@ -52,7 +55,7 @@ def parsecodes(codes, len=len, range=range):
"""
"""
if
not
codes
:
if
not
codes
:
return
None
return
MISSING_CODE
l
=
codes
.
split
(
'+'
)
l
=
codes
.
split
(
'+'
)
if
len
(
l
)
==
1
:
if
len
(
l
)
==
1
:
return
int
(
l
[
0
],
16
)
return
int
(
l
[
0
],
16
)
...
@@ -60,8 +63,8 @@ def parsecodes(codes, len=len, range=range):
...
@@ -60,8 +63,8 @@ def parsecodes(codes, len=len, range=range):
try
:
try
:
l
[
i
]
=
int
(
l
[
i
],
16
)
l
[
i
]
=
int
(
l
[
i
],
16
)
except
ValueError
:
except
ValueError
:
l
[
i
]
=
None
l
[
i
]
=
MISSING_CODE
l
=
[
x
for
x
in
l
if
x
is
not
None
]
l
=
[
x
for
x
in
l
if
x
!=
MISSING_CODE
]
if
len
(
l
)
==
1
:
if
len
(
l
)
==
1
:
return
l
[
0
]
return
l
[
0
]
else
:
else
:
...
@@ -113,7 +116,7 @@ def readmap(filename):
...
@@ -113,7 +116,7 @@ def readmap(filename):
# mappings to None for the rest
# mappings to None for the rest
if
len
(
identity
)
>=
len
(
unmapped
):
if
len
(
identity
)
>=
len
(
unmapped
):
for
enc
in
unmapped
:
for
enc
in
unmapped
:
enc2uni
[
enc
]
=
(
None
,
""
)
enc2uni
[
enc
]
=
(
MISSING_CODE
,
""
)
enc2uni
[
'IDENTITY'
]
=
256
enc2uni
[
'IDENTITY'
]
=
256
return
enc2uni
return
enc2uni
...
@@ -211,7 +214,7 @@ def python_tabledef_code(varname, map, comments=1, key_precision=2):
...
@@ -211,7 +214,7 @@ def python_tabledef_code(varname, map, comments=1, key_precision=2):
(
mapkey
,
mapcomment
)
=
mapkey
(
mapkey
,
mapcomment
)
=
mapkey
if
isinstance
(
mapvalue
,
tuple
):
if
isinstance
(
mapvalue
,
tuple
):
(
mapvalue
,
mapcomment
)
=
mapvalue
(
mapvalue
,
mapcomment
)
=
mapvalue
if
mapkey
is
None
:
if
mapkey
==
MISSING_CODE
:
continue
continue
table
[
mapkey
]
=
(
mapvalue
,
mapcomment
)
table
[
mapkey
]
=
(
mapvalue
,
mapcomment
)
if
mapkey
>
maxkey
:
if
mapkey
>
maxkey
:
...
@@ -223,11 +226,11 @@ def python_tabledef_code(varname, map, comments=1, key_precision=2):
...
@@ -223,11 +226,11 @@ def python_tabledef_code(varname, map, comments=1, key_precision=2):
# Create table code
# Create table code
for
key
in
range
(
maxkey
+
1
):
for
key
in
range
(
maxkey
+
1
):
if
key
not
in
table
:
if
key
not
in
table
:
mapvalue
=
None
mapvalue
=
MISSING_CODE
mapcomment
=
'UNDEFINED'
mapcomment
=
'UNDEFINED'
else
:
else
:
mapvalue
,
mapcomment
=
table
[
key
]
mapvalue
,
mapcomment
=
table
[
key
]
if
mapvalue
is
None
:
if
mapvalue
==
MISSING_CODE
:
mapchar
=
UNI_UNDEFINED
mapchar
=
UNI_UNDEFINED
else
:
else
:
if
isinstance
(
mapvalue
,
tuple
):
if
isinstance
(
mapvalue
,
tuple
):
...
...
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