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
90a07913
Kaydet (Commit)
90a07913
authored
Haz 30, 2000
tarafından
Fredrik Lundh
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
- pedantic: make sure "python -t" doesn't complain...
üst
df02d0b3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
16 additions
and
16 deletions
+16
-16
sre.py
Lib/sre.py
+11
-11
sre_compile.py
Lib/sre_compile.py
+0
-0
sre_parse.py
Lib/sre_parse.py
+0
-0
test_sre.py
Lib/test/test_sre.py
+5
-5
No files found.
Lib/sre.py
Dosyayı görüntüle @
90a07913
...
@@ -98,7 +98,7 @@ def _subn(pattern, template, string, count=0):
...
@@ -98,7 +98,7 @@ def _subn(pattern, template, string, count=0):
if
callable
(
template
):
if
callable
(
template
):
filter
=
template
filter
=
template
else
:
else
:
template
=
sre_parse
.
parse_template
(
template
,
pattern
)
template
=
sre_parse
.
parse_template
(
template
,
pattern
)
def
filter
(
match
,
template
=
template
):
def
filter
(
match
,
template
=
template
):
return
sre_parse
.
expand_template
(
template
,
match
)
return
sre_parse
.
expand_template
(
template
,
match
)
n
=
i
=
0
n
=
i
=
0
...
@@ -109,11 +109,11 @@ def _subn(pattern, template, string, count=0):
...
@@ -109,11 +109,11 @@ def _subn(pattern, template, string, count=0):
m
=
c
.
search
()
m
=
c
.
search
()
if
not
m
:
if
not
m
:
break
break
b
,
e
=
m
.
span
()
b
,
e
=
m
.
span
()
if
i
<
b
:
if
i
<
b
:
append
(
string
[
i
:
b
])
append
(
string
[
i
:
b
])
append
(
filter
(
m
))
append
(
filter
(
m
))
i
=
e
i
=
e
n
=
n
+
1
n
=
n
+
1
append
(
string
[
i
:])
append
(
string
[
i
:])
return
string
[:
0
]
.
join
(
s
),
n
return
string
[:
0
]
.
join
(
s
),
n
...
@@ -130,15 +130,15 @@ def _split(pattern, string, maxsplit=0):
...
@@ -130,15 +130,15 @@ def _split(pattern, string, maxsplit=0):
m
=
c
.
search
()
m
=
c
.
search
()
if
not
m
:
if
not
m
:
break
break
b
,
e
=
m
.
span
()
b
,
e
=
m
.
span
()
if
b
==
e
:
if
b
==
e
:
if
i
>=
len
(
string
):
if
i
>=
len
(
string
):
break
break
continue
continue
append
(
string
[
i
:
b
])
append
(
string
[
i
:
b
])
if
g
and
b
!=
e
:
if
g
and
b
!=
e
:
extend
(
m
.
groups
())
extend
(
m
.
groups
())
i
=
e
i
=
e
n
=
n
+
1
n
=
n
+
1
append
(
string
[
i
:])
append
(
string
[
i
:])
return
s
return
s
Lib/sre_compile.py
Dosyayı görüntüle @
90a07913
This diff is collapsed.
Click to expand it.
Lib/sre_parse.py
Dosyayı görüntüle @
90a07913
This diff is collapsed.
Click to expand it.
Lib/test/test_sre.py
Dosyayı görüntüle @
90a07913
# FIXME: this is basically test_re.py, with a few
# FIXME: this is basically test_re.py, with a few
minor changes
import
sys
import
sys
sys
.
path
=
[
'.'
]
+
sys
.
path
sys
.
path
=
[
'.'
]
+
sys
.
path
...
@@ -337,7 +337,7 @@ for t in tests:
...
@@ -337,7 +337,7 @@ for t in tests:
print
repr
(
repl
)
+
' should be '
+
repr
(
expected
)
print
repr
(
repl
)
+
' should be '
+
repr
(
expected
)
else
:
else
:
print
'=== Failed incorrectly'
,
t
print
'=== Failed incorrectly'
,
t
continue
continue
# Try the match on a unicode string, and check that it
# Try the match on a unicode string, and check that it
# still succeeds.
# still succeeds.
...
@@ -359,9 +359,9 @@ for t in tests:
...
@@ -359,9 +359,9 @@ for t in tests:
if
pattern
[:
2
]
!=
'
\\
B'
and
pattern
[
-
2
:]
!=
'
\\
B'
:
if
pattern
[:
2
]
!=
'
\\
B'
and
pattern
[
-
2
:]
!=
'
\\
B'
:
obj
=
sre
.
compile
(
pattern
)
obj
=
sre
.
compile
(
pattern
)
result
=
obj
.
search
(
s
,
result
.
start
(
0
),
result
.
end
(
0
)
+
1
)
result
=
obj
.
search
(
s
,
result
.
start
(
0
),
result
.
end
(
0
)
+
1
)
if
result
==
None
:
if
result
==
None
:
print
'=== Failed on range-limited match'
,
t
print
'=== Failed on range-limited match'
,
t
# Try the match with IGNORECASE enabled, and check that it
# Try the match with IGNORECASE enabled, and check that it
# still succeeds.
# still succeeds.
...
...
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