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
8cde0b47
Kaydet (Commit)
8cde0b47
authored
May 26, 1997
tarafından
Guido van Rossum
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Added keyword searching.
üst
d993695b
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
3 deletions
+24
-3
faqwiz.py
Tools/faqwiz/faqwiz.py
+24
-3
No files found.
Tools/faqwiz/faqwiz.py
Dosyayı görüntüle @
8cde0b47
...
...
@@ -386,22 +386,43 @@ class FaqWizard:
if
not
query
:
self
.
error
(
"Empty query string!"
)
return
self
.
prologue
(
T_SEARCH
)
if
self
.
ui
.
querytype
!=
'regex'
:
if
self
.
ui
.
querytype
==
'simple'
:
for
c
in
'
\\
.[]?+^$*'
:
if
c
in
query
:
query
=
replace
(
query
,
c
,
'
\\
'
+
c
)
queries
=
[
query
]
elif
self
.
ui
.
querytype
in
(
'anykeywords'
,
'allkeywords'
):
import
regsub
words
=
string
.
split
(
regsub
.
gsub
(
'[^a-zA-Z0-9]+'
,
' '
,
query
))
if
not
words
:
self
.
error
(
"No keywords specified!"
)
return
words
=
map
(
lambda
w
:
'
\
<
%
s
\
>'
%
w
,
words
)
if
self
.
ui
.
querytype
[:
3
]
==
'any'
:
queries
=
[
string
.
join
(
words
,
'
\
|'
)]
else
:
queries
=
words
else
:
# Default to regex
queries
=
[
query
]
self
.
prologue
(
T_SEARCH
)
progs
=
[]
for
query
in
queries
:
if
self
.
ui
.
casefold
==
'no'
:
p
=
regex
.
compile
(
query
)
else
:
p
=
regex
.
compile
(
query
,
regex
.
casefold
)
progs
.
append
(
p
)
hits
=
[]
for
file
in
self
.
dir
.
list
():
try
:
entry
=
self
.
dir
.
open
(
file
)
except
FileError
:
constants
if
p
.
search
(
entry
.
title
)
>=
0
or
p
.
search
(
entry
.
body
)
>=
0
:
for
p
in
progs
:
if
p
.
search
(
entry
.
title
)
<
0
and
p
.
search
(
entry
.
body
)
<
0
:
break
else
:
hits
.
append
(
file
)
if
not
hits
:
emit
(
NO_HITS
,
self
.
ui
,
count
=
0
)
...
...
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