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
d8f21203
Kaydet (Commit)
d8f21203
authored
May 14, 2003
tarafından
Skip Montanaro
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
defer re module imports to help improve interpreter startup
üst
76963441
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
1 deletion
+4
-1
warnings.py
Lib/warnings.py
+4
-1
No files found.
Lib/warnings.py
Dosyayı görüntüle @
d8f21203
...
...
@@ -3,7 +3,7 @@
# Note: function level imports should *not* be used
# in this module as it may cause import lock deadlock.
# See bug 683658.
import
sys
,
re
,
types
import
sys
,
types
import
linecache
__all__
=
[
"warn"
,
"showwarning"
,
"formatwarning"
,
"filterwarnings"
,
...
...
@@ -129,6 +129,7 @@ def filterwarnings(action, message="", category=Warning, module="", lineno=0,
"""Insert an entry into the list of warnings filters (at the front).
Use assertions to check that all arguments have the right type."""
import
re
assert
action
in
(
"error"
,
"ignore"
,
"always"
,
"default"
,
"module"
,
"once"
),
"invalid action:
%
s"
%
`action`
assert
isinstance
(
message
,
basestring
),
"message must be a string"
...
...
@@ -162,6 +163,7 @@ def _processoptions(args):
# Helper for _processoptions()
def
_setoption
(
arg
):
import
re
parts
=
arg
.
split
(
':'
)
if
len
(
parts
)
>
5
:
raise
_OptionError
(
"too many fields (max 5):
%
s"
%
`arg`
)
...
...
@@ -198,6 +200,7 @@ def _getaction(action):
# Helper for _setoption()
def
_getcategory
(
category
):
import
re
if
not
category
:
return
Warning
if
re
.
match
(
"^[a-zA-Z0-9_]+$"
,
category
):
...
...
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