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
706824f1
Kaydet (Commit)
706824f1
authored
Haz 04, 2009
tarafından
Georg Brandl
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
More codestring -> codebytes.
üst
3ed0deb9
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
16 additions
and
15 deletions
+16
-15
base64.py
Lib/base64.py
+2
-2
upload.py
Lib/distutils/command/upload.py
+1
-1
test_email.py
Lib/email/test/test_email.py
+2
-2
server.py
Lib/http/server.py
+1
-1
plistlib.py
Lib/plistlib.py
+2
-2
smtplib.py
Lib/smtplib.py
+1
-1
ssl.py
Lib/ssl.py
+1
-1
test_gettext.py
Lib/test/test_gettext.py
+3
-3
test_urllib2.py
Lib/test/test_urllib2.py
+1
-1
request.py
Lib/urllib/request.py
+2
-1
No files found.
Lib/base64.py
Dosyayı görüntüle @
706824f1
...
@@ -391,9 +391,9 @@ def main():
...
@@ -391,9 +391,9 @@ def main():
def
test
():
def
test
():
s0
=
b
"Aladdin:open sesame"
s0
=
b
"Aladdin:open sesame"
print
(
repr
(
s0
))
print
(
repr
(
s0
))
s1
=
encode
string
(
s0
)
s1
=
encode
bytes
(
s0
)
print
(
repr
(
s1
))
print
(
repr
(
s1
))
s2
=
decode
string
(
s1
)
s2
=
decode
bytes
(
s1
)
print
(
repr
(
s2
))
print
(
repr
(
s2
))
assert
s0
==
s2
assert
s0
==
s2
...
...
Lib/distutils/command/upload.py
Dosyayı görüntüle @
706824f1
...
@@ -127,7 +127,7 @@ class upload(PyPIRCCommand):
...
@@ -127,7 +127,7 @@ class upload(PyPIRCCommand):
user_pass
=
(
self
.
username
+
":"
+
self
.
password
)
.
encode
(
'ascii'
)
user_pass
=
(
self
.
username
+
":"
+
self
.
password
)
.
encode
(
'ascii'
)
# The exact encoding of the authentication string is debated.
# The exact encoding of the authentication string is debated.
# Anyway PyPI only accepts ascii for both username or password.
# Anyway PyPI only accepts ascii for both username or password.
auth
=
"Basic "
+
base64
.
encode
string
(
user_pass
)
.
strip
()
.
decode
(
'ascii'
)
auth
=
"Basic "
+
base64
.
encode
bytes
(
user_pass
)
.
strip
()
.
decode
(
'ascii'
)
# Build up the MIME payload for the POST data
# Build up the MIME payload for the POST data
boundary
=
'--------------GHSKFJDLGDS7543FJKLFHRE75642756743254'
boundary
=
'--------------GHSKFJDLGDS7543FJKLFHRE75642756743254'
...
...
Lib/email/test/test_email.py
Dosyayı görüntüle @
706824f1
...
@@ -944,7 +944,7 @@ class TestMIMEAudio(unittest.TestCase):
...
@@ -944,7 +944,7 @@ class TestMIMEAudio(unittest.TestCase):
def
test_encoding
(
self
):
def
test_encoding
(
self
):
payload
=
self
.
_au
.
get_payload
()
payload
=
self
.
_au
.
get_payload
()
self
.
assertEqual
(
base64
.
decode
string
(
payload
),
self
.
_audiodata
)
self
.
assertEqual
(
base64
.
decode
bytes
(
payload
),
self
.
_audiodata
)
def
test_checkSetMinor
(
self
):
def
test_checkSetMinor
(
self
):
au
=
MIMEAudio
(
self
.
_audiodata
,
'fish'
)
au
=
MIMEAudio
(
self
.
_audiodata
,
'fish'
)
...
@@ -984,7 +984,7 @@ class TestMIMEImage(unittest.TestCase):
...
@@ -984,7 +984,7 @@ class TestMIMEImage(unittest.TestCase):
def
test_encoding
(
self
):
def
test_encoding
(
self
):
payload
=
self
.
_im
.
get_payload
()
payload
=
self
.
_im
.
get_payload
()
self
.
assertEqual
(
base64
.
decode
string
(
payload
),
self
.
_imgdata
)
self
.
assertEqual
(
base64
.
decode
bytes
(
payload
),
self
.
_imgdata
)
def
test_checkSetMinor
(
self
):
def
test_checkSetMinor
(
self
):
im
=
MIMEImage
(
self
.
_imgdata
,
'fish'
)
im
=
MIMEImage
(
self
.
_imgdata
,
'fish'
)
...
...
Lib/http/server.py
Dosyayı görüntüle @
706824f1
...
@@ -985,7 +985,7 @@ class CGIHTTPRequestHandler(SimpleHTTPRequestHandler):
...
@@ -985,7 +985,7 @@ class CGIHTTPRequestHandler(SimpleHTTPRequestHandler):
if
authorization
[
0
]
.
lower
()
==
"basic"
:
if
authorization
[
0
]
.
lower
()
==
"basic"
:
try
:
try
:
authorization
=
authorization
[
1
]
.
encode
(
'ascii'
)
authorization
=
authorization
[
1
]
.
encode
(
'ascii'
)
authorization
=
base64
.
decode
string
(
authorization
)
.
\
authorization
=
base64
.
decode
bytes
(
authorization
)
.
\
decode
(
'ascii'
)
decode
(
'ascii'
)
except
(
binascii
.
Error
,
UnicodeError
):
except
(
binascii
.
Error
,
UnicodeError
):
pass
pass
...
...
Lib/plistlib.py
Dosyayı görüntüle @
706824f1
...
@@ -316,7 +316,7 @@ class Plist(_InternalDict):
...
@@ -316,7 +316,7 @@ class Plist(_InternalDict):
def
_encodeBase64
(
s
,
maxlinelength
=
76
):
def
_encodeBase64
(
s
,
maxlinelength
=
76
):
# copied from base64.encode
string
(), with added maxlinelength argument
# copied from base64.encode
bytes
(), with added maxlinelength argument
maxbinsize
=
(
maxlinelength
//
4
)
*
3
maxbinsize
=
(
maxlinelength
//
4
)
*
3
pieces
=
[]
pieces
=
[]
for
i
in
range
(
0
,
len
(
s
),
maxbinsize
):
for
i
in
range
(
0
,
len
(
s
),
maxbinsize
):
...
@@ -335,7 +335,7 @@ class Data:
...
@@ -335,7 +335,7 @@ class Data:
@classmethod
@classmethod
def
fromBase64
(
cls
,
data
):
def
fromBase64
(
cls
,
data
):
# base64.decode
string
just calls binascii.a2b_base64;
# base64.decode
bytes
just calls binascii.a2b_base64;
# it seems overkill to use both base64 and binascii.
# it seems overkill to use both base64 and binascii.
return
cls
(
binascii
.
a2b_base64
(
data
))
return
cls
(
binascii
.
a2b_base64
(
data
))
...
...
Lib/smtplib.py
Dosyayı görüntüle @
706824f1
...
@@ -540,7 +540,7 @@ class SMTP:
...
@@ -540,7 +540,7 @@ class SMTP:
"""
"""
def
encode_cram_md5
(
challenge
,
user
,
password
):
def
encode_cram_md5
(
challenge
,
user
,
password
):
challenge
=
base64
.
decode
string
(
challenge
)
challenge
=
base64
.
decode
bytes
(
challenge
)
response
=
user
+
" "
+
hmac
.
HMAC
(
password
.
encode
(
'ascii'
),
response
=
user
+
" "
+
hmac
.
HMAC
(
password
.
encode
(
'ascii'
),
challenge
)
.
hexdigest
()
challenge
)
.
hexdigest
()
return
encode_base64
(
response
.
encode
(
'ascii'
),
eol
=
''
)
return
encode_base64
(
response
.
encode
(
'ascii'
),
eol
=
''
)
...
...
Lib/ssl.py
Dosyayı görüntüle @
706824f1
...
@@ -413,7 +413,7 @@ def PEM_cert_to_DER_cert(pem_cert_string):
...
@@ -413,7 +413,7 @@ def PEM_cert_to_DER_cert(pem_cert_string):
raise
ValueError
(
"Invalid PEM encoding; must end with
%
s"
raise
ValueError
(
"Invalid PEM encoding; must end with
%
s"
%
PEM_FOOTER
)
%
PEM_FOOTER
)
d
=
pem_cert_string
.
strip
()[
len
(
PEM_HEADER
):
-
len
(
PEM_FOOTER
)]
d
=
pem_cert_string
.
strip
()[
len
(
PEM_HEADER
):
-
len
(
PEM_FOOTER
)]
return
base64
.
decode
string
(
d
.
encode
(
'ASCII'
,
'strict'
))
return
base64
.
decode
bytes
(
d
.
encode
(
'ASCII'
,
'strict'
))
def
get_server_certificate
(
addr
,
ssl_version
=
PROTOCOL_SSLv3
,
ca_certs
=
None
):
def
get_server_certificate
(
addr
,
ssl_version
=
PROTOCOL_SSLv3
,
ca_certs
=
None
):
"""Retrieve the certificate from the server at the specified address,
"""Retrieve the certificate from the server at the specified address,
...
...
Lib/test/test_gettext.py
Dosyayı görüntüle @
706824f1
...
@@ -65,13 +65,13 @@ class GettextBaseTest(unittest.TestCase):
...
@@ -65,13 +65,13 @@ class GettextBaseTest(unittest.TestCase):
if
not
os
.
path
.
isdir
(
LOCALEDIR
):
if
not
os
.
path
.
isdir
(
LOCALEDIR
):
os
.
makedirs
(
LOCALEDIR
)
os
.
makedirs
(
LOCALEDIR
)
fp
=
open
(
MOFILE
,
'wb'
)
fp
=
open
(
MOFILE
,
'wb'
)
fp
.
write
(
base64
.
decode
string
(
GNU_MO_DATA
))
fp
.
write
(
base64
.
decode
bytes
(
GNU_MO_DATA
))
fp
.
close
()
fp
.
close
()
fp
=
open
(
UMOFILE
,
'wb'
)
fp
=
open
(
UMOFILE
,
'wb'
)
fp
.
write
(
base64
.
decode
string
(
UMO_DATA
))
fp
.
write
(
base64
.
decode
bytes
(
UMO_DATA
))
fp
.
close
()
fp
.
close
()
fp
=
open
(
MMOFILE
,
'wb'
)
fp
=
open
(
MMOFILE
,
'wb'
)
fp
.
write
(
base64
.
decode
string
(
MMO_DATA
))
fp
.
write
(
base64
.
decode
bytes
(
MMO_DATA
))
fp
.
close
()
fp
.
close
()
self
.
env
=
support
.
EnvironmentVarGuard
()
self
.
env
=
support
.
EnvironmentVarGuard
()
self
.
env
[
'LANGUAGE'
]
=
'xx'
self
.
env
[
'LANGUAGE'
]
=
'xx'
...
...
Lib/test/test_urllib2.py
Dosyayı görüntüle @
706824f1
...
@@ -1050,7 +1050,7 @@ class HandlerTests(unittest.TestCase):
...
@@ -1050,7 +1050,7 @@ class HandlerTests(unittest.TestCase):
self
.
assertFalse
(
http_handler
.
requests
[
0
]
.
has_header
(
auth_header
))
self
.
assertFalse
(
http_handler
.
requests
[
0
]
.
has_header
(
auth_header
))
userpass
=
bytes
(
'
%
s:
%
s'
%
(
user
,
password
),
"ascii"
)
userpass
=
bytes
(
'
%
s:
%
s'
%
(
user
,
password
),
"ascii"
)
auth_hdr_value
=
(
'Basic '
+
auth_hdr_value
=
(
'Basic '
+
base64
.
encode
string
(
userpass
)
.
strip
()
.
decode
())
base64
.
encode
bytes
(
userpass
)
.
strip
()
.
decode
())
self
.
assertEqual
(
http_handler
.
requests
[
1
]
.
get_header
(
auth_header
),
self
.
assertEqual
(
http_handler
.
requests
[
1
]
.
get_header
(
auth_header
),
auth_hdr_value
)
auth_hdr_value
)
...
...
Lib/urllib/request.py
Dosyayı görüntüle @
706824f1
...
@@ -1758,7 +1758,8 @@ class URLopener:
...
@@ -1758,7 +1758,8 @@ class URLopener:
msg
.
append
(
'Content-type:
%
s'
%
type
)
msg
.
append
(
'Content-type:
%
s'
%
type
)
if
encoding
==
'base64'
:
if
encoding
==
'base64'
:
import
base64
import
base64
data
=
base64
.
decodestring
(
data
)
# XXX is this encoding/decoding ok?
data
=
base64
.
decodebytes
(
data
.
encode
(
'ascii'
))
.
decode
(
'latin1'
)
else
:
else
:
data
=
unquote
(
data
)
data
=
unquote
(
data
)
msg
.
append
(
'Content-Length:
%
d'
%
len
(
data
))
msg
.
append
(
'Content-Length:
%
d'
%
len
(
data
))
...
...
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