Skip to content

Commit b476295

Browse files
sanity jupyter notebooks
1 parent e53f49a commit b476295

File tree

13 files changed

+88
-422
lines changed

13 files changed

+88
-422
lines changed

docs/_sources/prodigiouspython/Chapter_8/2_Class_Attributes.ipynb

Lines changed: 33 additions & 200 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
},
5151
{
5252
"cell_type": "code",
53-
"execution_count": 1,
53+
"execution_count": null,
5454
"id": "a9684aaf-4734-4b94-b228-2be25264ebe9",
5555
"metadata": {},
5656
"outputs": [],
@@ -91,22 +91,10 @@
9191
},
9292
{
9393
"cell_type": "code",
94-
"execution_count": 2,
94+
"execution_count": null,
9595
"id": "fd02d287-7cca-452f-a810-d908b86f6e8f",
9696
"metadata": {},
97-
"outputs": [
98-
{
99-
"ename": "AttributeError",
100-
"evalue": "type object 'SuperMarket' has no attribute 'item_price'",
101-
"output_type": "error",
102-
"traceback": [
103-
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
104-
"\u001b[0;31mAttributeError\u001b[0m Traceback (most recent call last)",
105-
"\u001b[0;32m/tmp/ipykernel_3333/3157468629.py\u001b[0m in \u001b[0;36m<module>\u001b[0;34m\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0mSuperMarket\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mitem_price\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m",
106-
"\u001b[0;31mAttributeError\u001b[0m: type object 'SuperMarket' has no attribute 'item_price'"
107-
]
108-
}
109-
],
97+
"outputs": [],
11098
"source": [
11199
"SuperMarket.item_price"
112100
]
@@ -129,21 +117,10 @@
129117
},
130118
{
131119
"cell_type": "code",
132-
"execution_count": 3,
120+
"execution_count": null,
133121
"id": "31b89df9-4a61-472f-b493-812883b32755",
134122
"metadata": {},
135-
"outputs": [
136-
{
137-
"data": {
138-
"text/plain": [
139-
"0"
140-
]
141-
},
142-
"execution_count": 3,
143-
"metadata": {},
144-
"output_type": "execute_result"
145-
}
146-
],
123+
"outputs": [],
147124
"source": [
148125
"SuperMarket.discount"
149126
]
@@ -174,27 +151,10 @@
174151
},
175152
{
176153
"cell_type": "code",
177-
"execution_count": 4,
154+
"execution_count": null,
178155
"id": "b7a00af4-73f8-4a8a-a652-f6d962ef491c",
179156
"metadata": {},
180-
"outputs": [
181-
{
182-
"data": {
183-
"text/plain": [
184-
"mappingproxy({'__module__': '__main__',\n",
185-
" 'discount': 0,\n",
186-
" '__init__': <function __main__.SuperMarket.__init__(self, item_price)>,\n",
187-
" 'get_bill': <function __main__.SuperMarket.get_bill(self)>,\n",
188-
" '__dict__': <attribute '__dict__' of 'SuperMarket' objects>,\n",
189-
" '__weakref__': <attribute '__weakref__' of 'SuperMarket' objects>,\n",
190-
" '__doc__': None})"
191-
]
192-
},
193-
"execution_count": 4,
194-
"metadata": {},
195-
"output_type": "execute_result"
196-
}
197-
],
157+
"outputs": [],
198158
"source": [
199159
"SuperMarket.__dict__"
200160
]
@@ -225,21 +185,10 @@
225185
},
226186
{
227187
"cell_type": "code",
228-
"execution_count": 5,
188+
"execution_count": null,
229189
"id": "d9bb1549-c4c4-4ba2-a749-452f177b2376",
230190
"metadata": {},
231-
"outputs": [
232-
{
233-
"data": {
234-
"text/plain": [
235-
"0"
236-
]
237-
},
238-
"execution_count": 5,
239-
"metadata": {},
240-
"output_type": "execute_result"
241-
}
242-
],
191+
"outputs": [],
243192
"source": [
244193
"SuperMarket.discount"
245194
]
@@ -254,7 +203,7 @@
254203
},
255204
{
256205
"cell_type": "code",
257-
"execution_count": 6,
206+
"execution_count": null,
258207
"id": "62e12c46-5594-4f96-9281-8f41edcf3702",
259208
"metadata": {},
260209
"outputs": [],
@@ -264,21 +213,10 @@
264213
},
265214
{
266215
"cell_type": "code",
267-
"execution_count": 7,
216+
"execution_count": null,
268217
"id": "752e9ac4-df77-4956-971d-6b65c456ce01",
269218
"metadata": {},
270-
"outputs": [
271-
{
272-
"data": {
273-
"text/plain": [
274-
"0"
275-
]
276-
},
277-
"execution_count": 7,
278-
"metadata": {},
279-
"output_type": "execute_result"
280-
}
281-
],
219+
"outputs": [],
282220
"source": [
283221
"obj.discount"
284222
]
@@ -301,7 +239,7 @@
301239
},
302240
{
303241
"cell_type": "code",
304-
"execution_count": 8,
242+
"execution_count": null,
305243
"id": "c3f376d3-3b4a-4862-9e63-0a3d01c3b808",
306244
"metadata": {},
307245
"outputs": [],
@@ -319,42 +257,20 @@
319257
},
320258
{
321259
"cell_type": "code",
322-
"execution_count": 9,
260+
"execution_count": null,
323261
"id": "ca489bd1-0e0a-478c-8c73-bc56f7f483e8",
324262
"metadata": {},
325-
"outputs": [
326-
{
327-
"data": {
328-
"text/plain": [
329-
"10"
330-
]
331-
},
332-
"execution_count": 9,
333-
"metadata": {},
334-
"output_type": "execute_result"
335-
}
336-
],
263+
"outputs": [],
337264
"source": [
338265
"SuperMarket.discount"
339266
]
340267
},
341268
{
342269
"cell_type": "code",
343-
"execution_count": 10,
270+
"execution_count": null,
344271
"id": "5ece5ff0-ceae-48b0-b818-fbe8244ea5c5",
345272
"metadata": {},
346-
"outputs": [
347-
{
348-
"data": {
349-
"text/plain": [
350-
"10"
351-
]
352-
},
353-
"execution_count": 10,
354-
"metadata": {},
355-
"output_type": "execute_result"
356-
}
357-
],
273+
"outputs": [],
358274
"source": [
359275
"obj.discount"
360276
]
@@ -377,42 +293,20 @@
377293
},
378294
{
379295
"cell_type": "code",
380-
"execution_count": 11,
296+
"execution_count": null,
381297
"id": "6478b920-090e-496e-bdbd-308743fc721e",
382298
"metadata": {},
383-
"outputs": [
384-
{
385-
"data": {
386-
"text/plain": [
387-
"10"
388-
]
389-
},
390-
"execution_count": 11,
391-
"metadata": {},
392-
"output_type": "execute_result"
393-
}
394-
],
299+
"outputs": [],
395300
"source": [
396301
"SuperMarket.discount"
397302
]
398303
},
399304
{
400305
"cell_type": "code",
401-
"execution_count": 12,
306+
"execution_count": null,
402307
"id": "8affb3a6-1d8e-4f68-a3c7-fc61f737a9db",
403308
"metadata": {},
404-
"outputs": [
405-
{
406-
"data": {
407-
"text/plain": [
408-
"10"
409-
]
410-
},
411-
"execution_count": 12,
412-
"metadata": {},
413-
"output_type": "execute_result"
414-
}
415-
],
309+
"outputs": [],
416310
"source": [
417311
"obj.discount"
418312
]
@@ -427,7 +321,7 @@
427321
},
428322
{
429323
"cell_type": "code",
430-
"execution_count": 13,
324+
"execution_count": null,
431325
"id": "3abce644-2d12-46f9-9ac7-1a9cbea6f1fa",
432326
"metadata": {},
433327
"outputs": [],
@@ -437,42 +331,20 @@
437331
},
438332
{
439333
"cell_type": "code",
440-
"execution_count": 14,
334+
"execution_count": null,
441335
"id": "82c98c6a-ade1-495f-ba82-14f3423a980a",
442336
"metadata": {},
443-
"outputs": [
444-
{
445-
"data": {
446-
"text/plain": [
447-
"20"
448-
]
449-
},
450-
"execution_count": 14,
451-
"metadata": {},
452-
"output_type": "execute_result"
453-
}
454-
],
337+
"outputs": [],
455338
"source": [
456339
"obj.discount # Checking if the object's discount changed to 20?"
457340
]
458341
},
459342
{
460343
"cell_type": "code",
461-
"execution_count": 15,
344+
"execution_count": null,
462345
"id": "4329fb22-e091-416b-9bcf-56aecb325018",
463346
"metadata": {},
464-
"outputs": [
465-
{
466-
"data": {
467-
"text/plain": [
468-
"10"
469-
]
470-
},
471-
"execution_count": 15,
472-
"metadata": {},
473-
"output_type": "execute_result"
474-
}
475-
],
347+
"outputs": [],
476348
"source": [
477349
"SuperMarket.discount # Checking for the class Attribute 'discount' bound to the class."
478350
]
@@ -495,7 +367,7 @@
495367
},
496368
{
497369
"cell_type": "code",
498-
"execution_count": 16,
370+
"execution_count": null,
499371
"id": "3dcf3855-7289-4725-bb4a-61ecd4a6dd37",
500372
"metadata": {},
501373
"outputs": [],
@@ -513,23 +385,12 @@
513385
},
514386
{
515387
"cell_type": "code",
516-
"execution_count": 17,
388+
"execution_count": null,
517389
"id": "373af90f-8779-45f6-8f5d-2979f09ec410",
518390
"metadata": {
519391
"tags": []
520392
},
521-
"outputs": [
522-
{
523-
"data": {
524-
"text/plain": [
525-
"{'item_price': 100}"
526-
]
527-
},
528-
"execution_count": 17,
529-
"metadata": {},
530-
"output_type": "execute_result"
531-
}
532-
],
393+
"outputs": [],
533394
"source": [
534395
"obj2.__dict__"
535396
]
@@ -544,23 +405,12 @@
544405
},
545406
{
546407
"cell_type": "code",
547-
"execution_count": 18,
408+
"execution_count": null,
548409
"id": "e6b273e6-59b3-41d0-83ad-0a4bd095d7c7",
549410
"metadata": {
550411
"tags": []
551412
},
552-
"outputs": [
553-
{
554-
"data": {
555-
"text/plain": [
556-
"{'item_price': 100, 'discount': 20}"
557-
]
558-
},
559-
"execution_count": 18,
560-
"metadata": {},
561-
"output_type": "execute_result"
562-
}
563-
],
413+
"outputs": [],
564414
"source": [
565415
"obj.__dict__"
566416
]
@@ -599,27 +449,10 @@
599449
},
600450
{
601451
"cell_type": "code",
602-
"execution_count": 19,
452+
"execution_count": null,
603453
"id": "7ec660e8-378e-4b57-b53c-4275f753af95",
604454
"metadata": {},
605-
"outputs": [
606-
{
607-
"data": {
608-
"text/plain": [
609-
"mappingproxy({'__module__': '__main__',\n",
610-
" 'discount': 10,\n",
611-
" '__init__': <function __main__.SuperMarket.__init__(self, item_price)>,\n",
612-
" 'get_bill': <function __main__.SuperMarket.get_bill(self)>,\n",
613-
" '__dict__': <attribute '__dict__' of 'SuperMarket' objects>,\n",
614-
" '__weakref__': <attribute '__weakref__' of 'SuperMarket' objects>,\n",
615-
" '__doc__': None})"
616-
]
617-
},
618-
"execution_count": 19,
619-
"metadata": {},
620-
"output_type": "execute_result"
621-
}
622-
],
455+
"outputs": [],
623456
"source": [
624457
"obj.__class__.__dict__ # Equivalent to SuperMarket.__dict__"
625458
]

0 commit comments

Comments
 (0)