Skip to content

Commit bee9797

Browse files
committed
Improve code foramtting
1 parent 28fad82 commit bee9797

1 file changed

Lines changed: 39 additions & 5 deletions

File tree

source-code/object-orientation/dynamic_classes.ipynb

Lines changed: 39 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,15 @@
119119
"metadata": {},
120120
"outputs": [],
121121
"source": [
122-
"Cat = make_dataclass('Cat', [('species', str, 'cat'), ('nr_legs', int, 4), ('sound', str, 'meow')], bases=(Animal, ))"
122+
"Cat = make_dataclass(\n",
123+
" 'Cat',\n",
124+
" [\n",
125+
" ('species', str, 'cat'),\n",
126+
" ('nr_legs', int, 4),\n",
127+
" ('sound', str, 'meow')\n",
128+
" ],\n",
129+
" bases=(Animal, )\n",
130+
")"
123131
]
124132
},
125133
{
@@ -202,7 +210,15 @@
202210
"metadata": {},
203211
"outputs": [],
204212
"source": [
205-
"Dog = make_dataclass('Dog', [('nr_legs', int, 4), ('species', str, 'dog'), ('sound', str, 'woof')], bases=(Animal, ))"
213+
"Dog = make_dataclass(\n",
214+
" 'Dog',\n",
215+
" [\n",
216+
" ('nr_legs', int, 4),\n",
217+
" ('species', str, 'dog'),\n",
218+
" ('sound', str, 'woof')\n",
219+
" ],\n",
220+
" bases=(Animal, )\n",
221+
")"
206222
]
207223
},
208224
{
@@ -423,7 +439,16 @@
423439
"metadata": {},
424440
"outputs": [],
425441
"source": [
426-
"Animal = type('Animal', tuple(), {'name': None, 'species': None, 'nr_legs': None, '__init__': animal_init})"
442+
"Animal = type(\n",
443+
" 'Animal',\n",
444+
" tuple(),\n",
445+
" {\n",
446+
" 'name': None,\n",
447+
" 'species': None,\n",
448+
" 'nr_legs': None,\n",
449+
" '__init__': animal_init,\n",
450+
" }\n",
451+
")"
427452
]
428453
},
429454
{
@@ -579,7 +604,16 @@
579604
"metadata": {},
580605
"outputs": [],
581606
"source": [
582-
"Cat = type('Cat', (Animal, ), {'name': None, 'species': 'cat', 'nr_legs': 4, 'sound': 'meow'})"
607+
"Cat = type(\n",
608+
" 'Cat',\n",
609+
" (Animal, ),\n",
610+
" {\n",
611+
" 'name': None,\n",
612+
" 'species': 'cat',\n",
613+
" 'nr_legs': 4,\n",
614+
" 'sound': 'meow',\n",
615+
" }\n",
616+
")"
583617
]
584618
},
585619
{
@@ -970,7 +1004,7 @@
9701004
"name": "python",
9711005
"nbconvert_exporter": "python",
9721006
"pygments_lexer": "ipython3",
973-
"version": "3.9.7"
1007+
"version": "3.12.3"
9741008
}
9751009
},
9761010
"nbformat": 4,

0 commit comments

Comments
 (0)