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
ec6ec90d
Kaydet (Commit)
ec6ec90d
authored
Mar 06, 2001
tarafından
Fred Drake
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Define & use NetrcParseError instead of improperly overloading SyntaxError.
Always has the lineno and filename of the source text.
üst
a76ba6ed
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
5 deletions
+22
-5
netrc.py
Lib/netrc.py
+22
-5
No files found.
Lib/netrc.py
Dosyayı görüntüle @
ec6ec90d
...
...
@@ -4,7 +4,20 @@
import
os
,
shlex
__all__
=
[
"netrc"
]
__all__
=
[
"netrc"
,
"NetrcParseError"
]
class
NetrcParseError
(
Exception
):
"""Exception raised on syntax errors in the .netrc file."""
def
__init__
(
self
,
msg
,
filename
=
None
,
lineno
=
None
):
self
.
filename
=
file
self
.
lineno
=
lineno
self
.
msg
=
msg
Exception
.
__init__
(
self
,
msg
)
def
__str__
(
self
):
return
"
%
s (
%
s, line
%
s)"
%
(
self
.
msg
,
self
.
filename
,
self
.
lineno
)
class
netrc
:
def
__init__
(
self
,
file
=
None
):
...
...
@@ -37,8 +50,8 @@ class netrc:
tt
=
line
self
.
macros
[
entryname
]
.
append
(
line
)
else
:
raise
SyntaxError
,
"bad toplevel token
%
s, file
%
s, line
%
d"
\
%
(
tt
,
file
,
lexer
.
lineno
)
raise
NetrcParseError
(
"bad toplevel token
%
r"
%
tt
,
file
,
lexer
.
lineno
)
# We're looking at start of an entry for a named machine or default.
if
toplevel
==
'machine'
:
...
...
@@ -54,7 +67,10 @@ class netrc:
lexer
.
push_token
(
tt
)
break
else
:
raise
SyntaxError
,
"malformed
%
s entry
%
s terminated by
%
s"
%
(
toplevel
,
entryname
,
repr
(
tt
))
raise
NetrcParseError
(
"malformed
%
s entry
%
s terminated by
%
s"
%
(
toplevel
,
entryname
,
repr
(
tt
)),
file
,
lexer
.
lineno
)
elif
tt
==
'login'
or
tt
==
'user'
:
login
=
lexer
.
get_token
()
elif
tt
==
'account'
:
...
...
@@ -62,7 +78,8 @@ class netrc:
elif
tt
==
'password'
:
password
=
lexer
.
get_token
()
else
:
raise
SyntaxError
,
"bad follower token
%
s, file
%
s, line
%
d"
%
(
tt
,
file
,
lexer
.
lineno
)
raise
NetrcParseError
(
"bad follower token
%
r"
%
tt
,
file
,
lexer
.
lineno
)
def
authenticators
(
self
,
host
):
"""Return a (user, account, password) tuple for given host."""
...
...
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