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
2922c6da
Kaydet (Commit)
2922c6da
authored
May 06, 1994
tarafından
Guido van Rossum
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Changes to use default argument values where possible
üst
e4c6131b
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
13 additions
and
29 deletions
+13
-29
gopherlib.py
Lib/gopherlib.py
+4
-8
httplib.py
Lib/httplib.py
+4
-8
mailbox.py
Lib/mailbox.py
+4
-8
random.py
Lib/random.py
+1
-5
No files found.
Lib/gopherlib.py
Dosyayı görüntüle @
2922c6da
...
@@ -54,14 +54,10 @@ CRLF = '\r\n'
...
@@ -54,14 +54,10 @@ CRLF = '\r\n'
TAB
=
'
\t
'
TAB
=
'
\t
'
# Send a selector to a given host and port, return a file with the reply
# Send a selector to a given host and port, return a file with the reply
def
send_selector
(
selector
,
host
,
*
args
):
def
send_selector
(
selector
,
host
,
port
=
0
):
import
socket
import
socket
import
string
import
string
if
args
:
if
not
port
:
if
args
[
1
:]:
raise
TypeError
,
'too many args'
port
=
args
[
0
]
else
:
port
=
None
i
=
string
.
find
(
host
,
':'
)
i
=
string
.
find
(
host
,
':'
)
if
i
>=
0
:
if
i
>=
0
:
host
,
port
=
host
[:
i
],
string
.
atoi
(
host
[
i
+
1
:])
host
,
port
=
host
[:
i
],
string
.
atoi
(
host
[
i
+
1
:])
...
@@ -76,8 +72,8 @@ def send_selector(selector, host, *args):
...
@@ -76,8 +72,8 @@ def send_selector(selector, host, *args):
return
s
.
makefile
(
'r'
)
return
s
.
makefile
(
'r'
)
# Send a selector and a query string
# Send a selector and a query string
def
send_query
(
selector
,
query
,
host
,
*
args
):
def
send_query
(
selector
,
query
,
host
,
port
=
0
):
return
apply
(
send_selector
,
(
selector
+
'
\t
'
+
query
,
host
)
+
args
)
return
send_selector
(
selector
+
'
\t
'
+
query
,
host
,
port
)
# The following functions interpret the data returned by the gopher
# The following functions interpret the data returned by the gopher
# server according to the expected type, e.g. textfile or directory
# server according to the expected type, e.g. textfile or directory
...
...
Lib/httplib.py
Dosyayı görüntüle @
2922c6da
...
@@ -43,20 +43,16 @@ replyprog = regex.compile(replypat)
...
@@ -43,20 +43,16 @@ replyprog = regex.compile(replypat)
class
HTTP
:
class
HTTP
:
def
__init__
(
self
,
*
args
):
def
__init__
(
self
,
host
=
''
,
port
=
0
):
self
.
debuglevel
=
0
self
.
debuglevel
=
0
if
args
:
apply
(
self
.
connect
,
args
)
if
host
:
self
.
connect
(
host
,
port
)
def
set_debuglevel
(
self
,
debuglevel
):
def
set_debuglevel
(
self
,
debuglevel
):
self
.
debuglevel
=
debuglevel
self
.
debuglevel
=
debuglevel
def
connect
(
self
,
host
,
*
args
):
def
connect
(
self
,
host
,
port
=
0
):
if
args
:
if
not
port
:
if
args
[
1
:]:
raise
TypeError
,
'too many args'
port
=
args
[
0
]
else
:
i
=
string
.
find
(
host
,
':'
)
i
=
string
.
find
(
host
,
':'
)
port
=
None
if
i
>=
0
:
if
i
>=
0
:
host
,
port
=
host
[:
i
],
host
[
i
+
1
:]
host
,
port
=
host
[:
i
],
host
[
i
+
1
:]
try
:
port
=
string
.
atoi
(
port
)
try
:
port
=
string
.
atoi
(
port
)
...
...
Lib/mailbox.py
Dosyayı görüntüle @
2922c6da
...
@@ -35,24 +35,20 @@ class _Subfile:
...
@@ -35,24 +35,20 @@ class _Subfile:
self
.
stop
=
stop
self
.
stop
=
stop
self
.
pos
=
self
.
start
self
.
pos
=
self
.
start
def
read
(
self
,
*
args
):
def
read
(
self
,
length
=
None
):
if
self
.
pos
>=
self
.
stop
:
if
self
.
pos
>=
self
.
stop
:
return
''
return
''
if
args
==
()
:
if
length
is
None
:
length
=
self
.
stop
-
self
.
pos
length
=
self
.
stop
-
self
.
pos
else
:
length
=
args
[
0
]
self
.
fp
.
seek
(
self
.
pos
)
self
.
fp
.
seek
(
self
.
pos
)
self
.
pos
=
self
.
pos
+
length
self
.
pos
=
self
.
pos
+
length
return
self
.
fp
.
read
(
length
)
return
self
.
fp
.
read
(
length
)
def
readline
(
self
,
*
args
):
def
readline
(
self
,
length
=
None
):
if
self
.
pos
>=
self
.
stop
:
if
self
.
pos
>=
self
.
stop
:
return
''
return
''
if
args
==
()
:
if
length
is
None
:
length
=
self
.
stop
-
self
.
pos
length
=
self
.
stop
-
self
.
pos
else
:
length
=
args
[
0
]
self
.
fp
.
seek
(
self
.
pos
)
self
.
fp
.
seek
(
self
.
pos
)
data
=
self
.
fp
.
readline
(
length
)
data
=
self
.
fp
.
readline
(
length
)
if
len
(
data
)
<
length
:
if
len
(
data
)
<
length
:
...
...
Lib/random.py
Dosyayı görüntüle @
2922c6da
...
@@ -214,15 +214,11 @@ def betavariate(alpha, beta):
...
@@ -214,15 +214,11 @@ def betavariate(alpha, beta):
# -------------------- test program --------------------
# -------------------- test program --------------------
def
test
(
*
args
):
def
test
(
N
=
200
):
print
'TWOPI ='
,
TWOPI
print
'TWOPI ='
,
TWOPI
print
'LOG4 ='
,
LOG4
print
'LOG4 ='
,
LOG4
print
'NV_MAGICCONST ='
,
NV_MAGICCONST
print
'NV_MAGICCONST ='
,
NV_MAGICCONST
print
'SG_MAGICCONST ='
,
SG_MAGICCONST
print
'SG_MAGICCONST ='
,
SG_MAGICCONST
N
=
200
if
args
:
if
args
[
1
:]:
print
'Excess test() arguments ignored'
N
=
args
[
0
]
test_generator
(
N
,
'random()'
)
test_generator
(
N
,
'random()'
)
test_generator
(
N
,
'normalvariate(0.0, 1.0)'
)
test_generator
(
N
,
'normalvariate(0.0, 1.0)'
)
test_generator
(
N
,
'lognormvariate(0.0, 1.0)'
)
test_generator
(
N
,
'lognormvariate(0.0, 1.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