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
d40a92b3
Kaydet (Commit)
d40a92b3
authored
Agu 09, 2004
tarafından
Tim Peters
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Indent body of _EXAMPLE_RE for readability. _IS_BLANK_OR_COMMENT makes
more sense as a callable.
üst
78b58f38
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
13 deletions
+13
-13
doctest.py
Lib/doctest.py
+13
-13
No files found.
Lib/doctest.py
Dosyayı görüntüle @
d40a92b3
...
...
@@ -590,18 +590,18 @@ class Parser:
self
.
string
=
string
.
expandtabs
()
_EXAMPLE_RE
=
re
.
compile
(
r'''
# Source consists of a PS1 line followed by zero or more PS2 lines.
(?P<source>
(?:^(?P<indent> [ ]*) >>> .*) # PS1 line
(?:\n [ ]* \.\.\. .*)*) # PS2 lines
\n?
# Want consists of any non-blank lines that do not start with PS1.
(?P<want> (?:(?![ ]*$) # Not a blank line
(?![ ]*>>>) # Not a line starting with PS1
.*$\n? # But any other line
)*)
'''
,
re
.
MULTILINE
|
re
.
VERBOSE
)
_IS_BLANK_OR_COMMENT
=
re
.
compile
(
'^[ ]*(#.*)?$'
)
# Source consists of a PS1 line followed by zero or more PS2 lines.
(?P<source>
(?:^(?P<indent> [ ]*) >>> .*) # PS1 line
(?:\n [ ]* \.\.\. .*)*) # PS2 lines
\n?
# Want consists of any non-blank lines that do not start with PS1.
(?P<want> (?:(?![ ]*$) # Not a blank line
(?![ ]*>>>) # Not a line starting with PS1
.*$\n? # But any other line
)*)
'''
,
re
.
MULTILINE
|
re
.
VERBOSE
)
_IS_BLANK_OR_COMMENT
=
re
.
compile
(
'^[ ]*(#.*)?$'
)
.
match
def
get_examples
(
self
):
"""
...
...
@@ -638,7 +638,7 @@ class Parser:
# Extract source/want from the regexp match.
(
source
,
want
)
=
self
.
_parse_example
(
m
,
lineno
)
if
self
.
_IS_BLANK_OR_COMMENT
.
match
(
source
):
if
self
.
_IS_BLANK_OR_COMMENT
(
source
):
continue
examples
.
append
(
Example
(
source
,
want
,
lineno
)
)
...
...
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