tzh
2024-08-22 c7d0944258c7d0943aa7b2211498fd612971ce27
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
O\¬Qc@sódZddlZddlZddlmZmZeddeƒddlmZdZdZ    d    Z
d,d-d.d/d0d1d2gZ d3d4d5d6d7d8gZ d9d:d;d<d=d>gZ d'Zd(ejfd)„ƒYZd*„Zed+krïeƒndS(?sÕTest program for MimeWriter module.
 
The test program was too big to comfortably fit in the MimeWriter
class, so it's here in its own file.
 
This should generate Barry's example, modulo some quotes and newlines.
 
iÿÿÿÿN(t run_unittestt import_modulet
MimeWritert
deprecated(Rs–INTERFACE Seller-1;
 
TYPE Seller = OBJECT
    DOCUMENTATION "A simple Seller interface to test ILU"
    METHODS
            price():INTEGER,
    END;
sIclass Buyer:
    def __setup__(self, maxprice):
        self._maxprice = maxprice
 
    def __main__(self, kos):
        """Entry point upon arrival at a new KOS."""
        broker = kos.broker()
        # B4 == Barry's Big Bass Business :-)
        seller = broker.lookup('Seller_1.Seller', 'B4')
        if seller:
            price = seller.price()
            print 'Seller wants $', price, '... '
            if price > self._maxprice:
                print 'too much!'
            else:
                print "I'll take it!"
        else:
            print 'no seller found here'
sy# instantiate a buyer instance and put it in a magic place for the KOS
# to find.
__kp__ = Buyer()
__kp__.__setup__(500)
t InterpretertpythonsInterpreter-Versions1.3s
Owner-Names Barry WarsawsOwner-Rendezvoussbwarsaw@cnri.reston.va.ussHome-KSSskss.cnri.reston.va.ust
Identifiershdl://cnri.kss/my_first_knowbots Launch-DatesMon Feb 12 16:39:03 EST 1996s Metadata-Typetcomplexs Metadata-Keyt
connectiontAccesss    read-onlysConnection-DescriptionsBarry's Big Bass Businesss Connection-IdtB4sConnection-Directiontclientsgeneric-interfaces"Generic Interface for All Knowbotss
generic-kps§    From: bwarsaw@cnri.reston.va.us
Date: Mon Feb 12 17:21:48 EST 1996
To: kss-submit@cnri.reston.va.us
MIME-Version: 1.0
Content-Type: multipart/knowbot;
    boundary="801spam999";
    version="0.1"
 
This is a multi-part message in MIME format.
 
--801spam999
Content-Type: multipart/knowbot-metadata;
    boundary="802spam999"
 
 
--802spam999
Content-Type: message/rfc822
KP-Metadata-Type: simple
KP-Access: read-only
 
KPMD-Interpreter: python
KPMD-Interpreter-Version: 1.3
KPMD-Owner-Name: Barry Warsaw
KPMD-Owner-Rendezvous: bwarsaw@cnri.reston.va.us
KPMD-Home-KSS: kss.cnri.reston.va.us
KPMD-Identifier: hdl://cnri.kss/my_first_knowbot
KPMD-Launch-Date: Mon Feb 12 16:39:03 EST 1996
 
--802spam999
Content-Type: text/isl
KP-Metadata-Type: complex
KP-Metadata-Key: connection
KP-Access: read-only
KP-Connection-Description: Barry's Big Bass Business
KP-Connection-Id: B4
KP-Connection-Direction: client
 
INTERFACE Seller-1;
 
TYPE Seller = OBJECT
    DOCUMENTATION "A simple Seller interface to test ILU"
    METHODS
            price():INTEGER,
    END;
 
--802spam999
Content-Type: message/external-body;
    access-type="URL";
    URL="hdl://cnri.kss/generic-knowbot"
 
Content-Type: text/isl
KP-Metadata-Type: complex
KP-Metadata-Key: generic-interface
KP-Access: read-only
KP-Connection-Description: Generic Interface for All Knowbots
KP-Connection-Id: generic-kp
KP-Connection-Direction: client
 
 
--802spam999--
 
--801spam999
Content-Type: multipart/knowbot-code;
    boundary="803spam999"
 
 
--803spam999
Content-Type: text/plain
KP-Module-Name: BuyerKP
 
class Buyer:
    def __setup__(self, maxprice):
        self._maxprice = maxprice
 
    def __main__(self, kos):
        """Entry point upon arrival at a new KOS."""
        broker = kos.broker()
        # B4 == Barry's Big Bass Business :-)
        seller = broker.lookup('Seller_1.Seller', 'B4')
        if seller:
            price = seller.price()
            print 'Seller wants $', price, '... '
            if price > self._maxprice:
                print 'too much!'
            else:
                print "I'll take it!"
        else:
            print 'no seller found here'
 
--803spam999--
 
--801spam999
Content-Type: multipart/knowbot-state;
    boundary="804spam999"
KP-Main-Module: main
 
 
--804spam999
Content-Type: text/plain
KP-Module-Name: main
 
# instantiate a buyer instance and put it in a magic place for the KOS
# to find.
__kp__ = Buyer()
__kp__.__setup__(500)
 
--804spam999--
 
--801spam999--
tMimewriterTestcBseZd„ZRS(cCsÐtjƒ}t|ƒ}|jddƒ|jddƒ|jddƒ|jddƒ|jd    d
d'gd dƒ}|jdƒ|jƒ}|jddƒ|jƒ}|jddƒ|jddƒt|jdƒƒ}x(tD] \}}|jd||ƒqçW|jƒ~|jƒ}    x(t    D] \}}|    jd||ƒq+W|    jdƒ}|jt
ƒ~    |jƒ}
|
jdd(d)gƒ}t|ƒ}x(t D] \}}|
jd||ƒq¥W|
jdƒ|j ƒ|jƒ} | jddƒ| jƒ} | jd d!ƒ| jd"ƒ}|jt ƒ| j ƒ|jƒ} | jd#d$ƒ| jd%d&ƒ| jƒ}|jd d$ƒ|jd"ƒ}|jtƒ| j ƒ|j ƒ|j|jƒtƒdS(*NtFromsbwarsaw@cnri.reston.va.ustDatesMon Feb 12 17:21:48 EST 1996tToskss-submit@cnri.reston.va.uss MIME-Versions1.0tknowbott
801spam999tversions0.1tprefixis-This is a multi-part message in MIME format.
sknowbot-metadatat
802spam999sKP-Metadata-Typetsimples    KP-Accesss    read-onlysmessage/rfc822sKPMD-sKP-stext/islsmessage/external-bodys access-typetURLshdl://cnri.kss/generic-knowbots knowbot-codet
803spam999sKP-Module-NametBuyerKPs
text/plainsKP-Main-Moduletmains knowbot-statet
804spam999(sversions0.1(s access-typeR(Rshdl://cnri.kss/generic-knowbot(tStringIORt    addheadertstartmultipartbodytwritetnextpartt    startbodytSIMPLE_METADATAt flushheaderstCOMPLEX_METADATAtSELLERtEXTERNAL_METADATAtlastparttBUYERtSTATEt assertEqualtgetvaluetOUTPUT(tselftbufttopleveltftmdtmd1tmtkeytvaluetmd2tmd3tcodetbuyertstatetst((s\/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/test_MimeWriter.pyttestÅsf      
          
 
 
 
(t__name__t
__module__R;(((s\/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/test_MimeWriter.pyR ÃscCsttƒdS(N(RR (((s\/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/test_MimeWriter.pyt    test_main st__main__(Rspython(sInterpreter-Versions1.3(s
Owner-Names Barry Warsaw(sOwner-Rendezvoussbwarsaw@cnri.reston.va.us(sHome-KSSskss.cnri.reston.va.us(Rshdl://cnri.kss/my_first_knowbot(s Launch-DatesMon Feb 12 16:39:03 EST 1996(s Metadata-Typescomplex(s Metadata-KeyR(R    s    read-only(sConnection-DescriptionsBarry's Big Bass Business(s Connection-IdR
(sConnection-DirectionR (s Metadata-Typescomplex(s Metadata-Keysgeneric-interface(R    s    read-only(sConnection-Descriptions"Generic Interface for All Knowbots(s Connection-Ids
generic-kp(sConnection-DirectionR (t__doc__tunittestRttest.test_supportRRtTrueRR$R'R(R!R#R%R+tTestCaseR R>R<(((s\/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/test/test_MimeWriter.pyt<module>s>
            r]