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
068ad973
Kaydet (Commit)
068ad973
authored
Haz 09, 1998
tarafından
Guido van Rossum
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Untabified -- to satisfy the tab nanny.
üst
5a43e1a9
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
44 additions
and
44 deletions
+44
-44
ni.py
Lib/lib-old/ni.py
+0
-0
test_MimeWriter.py
Lib/test/test_MimeWriter.py
+44
-44
No files found.
Lib/lib-old/ni.py
Dosyayı görüntüle @
068ad973
This diff is collapsed.
Click to expand it.
Lib/test/test_MimeWriter.py
Dosyayı görüntüle @
068ad973
...
@@ -16,30 +16,30 @@ INTERFACE Seller-1;
...
@@ -16,30 +16,30 @@ INTERFACE Seller-1;
TYPE Seller = OBJECT
TYPE Seller = OBJECT
DOCUMENTATION "A simple Seller interface to test ILU"
DOCUMENTATION "A simple Seller interface to test ILU"
METHODS
METHODS
price():INTEGER,
price():INTEGER,
END;
END;
'''
'''
BUYER
=
'''
\
BUYER
=
'''
\
class Buyer:
class Buyer:
def __setup__(self, maxprice):
def __setup__(self, maxprice):
self._maxprice = maxprice
self._maxprice = maxprice
def __main__(self, kos):
def __main__(self, kos):
"""Entry point upon arrival at a new KOS."""
"""Entry point upon arrival at a new KOS."""
broker = kos.broker()
broker = kos.broker()
# B4 == Barry's Big Bass Business :-)
# B4 == Barry's Big Bass Business :-)
seller = broker.lookup('Seller_1.Seller', 'B4')
seller = broker.lookup('Seller_1.Seller', 'B4')
if seller:
if seller:
price = seller.price()
price = seller.price()
print 'Seller wants $', price, '... '
print 'Seller wants $', price, '... '
if price > self._maxprice:
if price > self._maxprice:
print 'too much!'
print 'too much!'
else:
else:
print "I'll take it!"
print "I'll take it!"
else:
else:
print 'no seller found here'
print 'no seller found here'
'''
# Don't ask why this comment is here
'''
# Don't ask why this comment is here
STATE
=
'''
\
STATE
=
'''
\
# instantiate a buyer instance and put it in a magic place for the KOS
# instantiate a buyer instance and put it in a magic place for the KOS
...
@@ -49,32 +49,32 @@ __kp__.__setup__(500)
...
@@ -49,32 +49,32 @@ __kp__.__setup__(500)
'''
'''
SIMPLE_METADATA
=
[
SIMPLE_METADATA
=
[
(
"Interpreter"
,
"python"
),
(
"Interpreter"
,
"python"
),
(
"Interpreter-Version"
,
"1.3"
),
(
"Interpreter-Version"
,
"1.3"
),
(
"Owner-Name"
,
"Barry Warsaw"
),
(
"Owner-Name"
,
"Barry Warsaw"
),
(
"Owner-Rendezvous"
,
"bwarsaw@cnri.reston.va.us"
),
(
"Owner-Rendezvous"
,
"bwarsaw@cnri.reston.va.us"
),
(
"Home-KSS"
,
"kss.cnri.reston.va.us"
),
(
"Home-KSS"
,
"kss.cnri.reston.va.us"
),
(
"Identifier"
,
"hdl://cnri.kss/my_first_knowbot"
),
(
"Identifier"
,
"hdl://cnri.kss/my_first_knowbot"
),
(
"Launch-Date"
,
"Mon Feb 12 16:39:03 EST 1996"
),
(
"Launch-Date"
,
"Mon Feb 12 16:39:03 EST 1996"
),
]
]
COMPLEX_METADATA
=
[
COMPLEX_METADATA
=
[
(
"Metadata-Type"
,
"complex"
),
(
"Metadata-Type"
,
"complex"
),
(
"Metadata-Key"
,
"connection"
),
(
"Metadata-Key"
,
"connection"
),
(
"Access"
,
"read-only"
),
(
"Access"
,
"read-only"
),
(
"Connection-Description"
,
"Barry's Big Bass Business"
),
(
"Connection-Description"
,
"Barry's Big Bass Business"
),
(
"Connection-Id"
,
"B4"
),
(
"Connection-Id"
,
"B4"
),
(
"Connection-Direction"
,
"client"
),
(
"Connection-Direction"
,
"client"
),
]
]
EXTERNAL_METADATA
=
[
EXTERNAL_METADATA
=
[
(
"Metadata-Type"
,
"complex"
),
(
"Metadata-Type"
,
"complex"
),
(
"Metadata-Key"
,
"generic-interface"
),
(
"Metadata-Key"
,
"generic-interface"
),
(
"Access"
,
"read-only"
),
(
"Access"
,
"read-only"
),
(
"Connection-Description"
,
"Generic Interface for All Knowbots"
),
(
"Connection-Description"
,
"Generic Interface for All Knowbots"
),
(
"Connection-Id"
,
"generic-kp"
),
(
"Connection-Id"
,
"generic-kp"
),
(
"Connection-Direction"
,
"client"
),
(
"Connection-Direction"
,
"client"
),
]
]
def
main
():
def
main
():
...
@@ -91,7 +91,7 @@ def main():
...
@@ -91,7 +91,7 @@ def main():
# Toplevel body parts
# Toplevel body parts
f
=
toplevel
.
startmultipartbody
(
"knowbot"
,
"801spam999"
,
f
=
toplevel
.
startmultipartbody
(
"knowbot"
,
"801spam999"
,
[(
"version"
,
"0.1"
)],
prefix
=
0
)
[(
"version"
,
"0.1"
)],
prefix
=
0
)
f
.
write
(
"This is a multi-part message in MIME format.
\n
"
)
f
.
write
(
"This is a multi-part message in MIME format.
\n
"
)
# First toplevel body part: metadata
# First toplevel body part: metadata
...
@@ -106,7 +106,7 @@ def main():
...
@@ -106,7 +106,7 @@ def main():
md1
.
addheader
(
"KP-Access"
,
"read-only"
)
md1
.
addheader
(
"KP-Access"
,
"read-only"
)
m
=
MimeWriter
(
md1
.
startbody
(
"message/rfc822"
))
m
=
MimeWriter
(
md1
.
startbody
(
"message/rfc822"
))
for
key
,
value
in
SIMPLE_METADATA
:
for
key
,
value
in
SIMPLE_METADATA
:
m
.
addheader
(
"KPMD-"
+
key
,
value
)
m
.
addheader
(
"KPMD-"
+
key
,
value
)
m
.
flushheaders
()
m
.
flushheaders
()
del
md1
del
md1
...
@@ -114,7 +114,7 @@ def main():
...
@@ -114,7 +114,7 @@ def main():
md2
=
md
.
nextpart
()
md2
=
md
.
nextpart
()
for
key
,
value
in
COMPLEX_METADATA
:
for
key
,
value
in
COMPLEX_METADATA
:
md2
.
addheader
(
"KP-"
+
key
,
value
)
md2
.
addheader
(
"KP-"
+
key
,
value
)
f
=
md2
.
startbody
(
"text/isl"
)
f
=
md2
.
startbody
(
"text/isl"
)
f
.
write
(
SELLER
)
f
.
write
(
SELLER
)
del
md2
del
md2
...
@@ -123,11 +123,11 @@ def main():
...
@@ -123,11 +123,11 @@ def main():
md3
=
md
.
nextpart
()
md3
=
md
.
nextpart
()
f
=
md3
.
startbody
(
"message/external-body"
,
f
=
md3
.
startbody
(
"message/external-body"
,
[(
"access-type"
,
"URL"
),
[(
"access-type"
,
"URL"
),
(
"URL"
,
"hdl://cnri.kss/generic-knowbot"
)])
(
"URL"
,
"hdl://cnri.kss/generic-knowbot"
)])
m
=
MimeWriter
(
f
)
m
=
MimeWriter
(
f
)
for
key
,
value
in
EXTERNAL_METADATA
:
for
key
,
value
in
EXTERNAL_METADATA
:
md3
.
addheader
(
"KP-"
+
key
,
value
)
md3
.
addheader
(
"KP-"
+
key
,
value
)
md3
.
startbody
(
"text/isl"
)
md3
.
startbody
(
"text/isl"
)
# Phantom body doesn't need to be written
# Phantom body doesn't need to be written
...
...
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