Skip to content

Commit 1a9c7f4

Browse files
1 parent 641d098 commit 1a9c7f4

4 files changed

Lines changed: 37 additions & 36 deletions

File tree

python/makarov/chapter_3_if_and_loops.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,7 @@
171171
# +
172172
# Функция enumerate()
173173
# пусть дан список с днями недели
174+
# pylint: disable=duplicate-code
174175
days = [
175176
"Понедельник",
176177
"Вторник",

python/makarov/chapter_7_list_tuple_set.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@
119119
# # Распаковка списков
120120

121121
# заново создадим список с днями недели
122+
# pylint: disable=duplicate-code
122123
week = [
123124
"Понедельник",
124125
"Вторник",

python/makarov/chapter_9_oop.ipynb

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -38,20 +38,20 @@
3838
},
3939
{
4040
"cell_type": "code",
41-
"execution_count": 2,
41+
"execution_count": null,
4242
"id": "62d87976",
4343
"metadata": {},
4444
"outputs": [],
4545
"source": [
4646
"# Создание объекта\n",
4747
"\n",
48-
"# создадим объект Matroskin класса CatClass\n",
49-
"Matroskin: CatClass = CatClass()"
48+
"# создадим объект matroskin класса CatClass\n",
49+
"matroskin: CatClass = CatClass()"
5050
]
5151
},
5252
{
5353
"cell_type": "code",
54-
"execution_count": 3,
54+
"execution_count": null,
5555
"id": "81e8ab61",
5656
"metadata": {},
5757
"outputs": [
@@ -68,7 +68,7 @@
6868
],
6969
"source": [
7070
"# проверим тип данных созданной переменной\n",
71-
"type(Matroskin)"
71+
"type(matroskin)"
7272
]
7373
},
7474
{
@@ -102,7 +102,7 @@
102102
},
103103
{
104104
"cell_type": "code",
105-
"execution_count": 5,
105+
"execution_count": null,
106106
"id": "e115491e",
107107
"metadata": {},
108108
"outputs": [
@@ -120,10 +120,10 @@
120120
"source": [
121121
"# повторно создадим объект класса CatClass\n",
122122
"# передав ему параметр цвета шерсти\n",
123-
"Matroskin = CatClass(\"gray\") # type: ignore[call-arg]\n",
123+
"matroskin = CatClass(\"gray\") # type: ignore[call-arg]\n",
124124
"\n",
125125
"# и выведем атрибуты класса\n",
126-
"Matroskin.color, Matroskin.type_ # type: ignore[attr-defined]"
126+
"matroskin.color, matroskin.type_ # type: ignore[attr-defined]"
127127
]
128128
},
129129
{
@@ -169,18 +169,18 @@
169169
},
170170
{
171171
"cell_type": "code",
172-
"execution_count": 7,
172+
"execution_count": null,
173173
"id": "953df6f5",
174174
"metadata": {},
175175
"outputs": [],
176176
"source": [
177177
"# создадим объект\n",
178-
"Matroskin = CatClass(\"gray\") # type: ignore[call-arg]"
178+
"matroskin = CatClass(\"gray\") # type: ignore[call-arg]"
179179
]
180180
},
181181
{
182182
"cell_type": "code",
183-
"execution_count": 8,
183+
"execution_count": null,
184184
"id": "87d5d7c8",
185185
"metadata": {},
186186
"outputs": [
@@ -196,12 +196,12 @@
196196
],
197197
"source": [
198198
"# применим метод .meow()\n",
199-
"Matroskin.meow() # type: ignore[attr-defined]"
199+
"matroskin.meow() # type: ignore[attr-defined]"
200200
]
201201
},
202202
{
203203
"cell_type": "code",
204-
"execution_count": 9,
204+
"execution_count": null,
205205
"id": "67c689c0",
206206
"metadata": {},
207207
"outputs": [
@@ -215,7 +215,7 @@
215215
],
216216
"source": [
217217
"# и метод .info()\n",
218-
"Matroskin.info() # type: ignore[attr-defined]"
218+
"matroskin.info() # type: ignore[attr-defined]"
219219
]
220220
},
221221
{
@@ -254,7 +254,7 @@
254254
},
255255
{
256256
"cell_type": "code",
257-
"execution_count": 10,
257+
"execution_count": null,
258258
"id": "23a75346",
259259
"metadata": {},
260260
"outputs": [
@@ -272,11 +272,11 @@
272272
"source": [
273273
"# Причем не просто получить доступ, но и изменить их.\n",
274274
"\n",
275-
"# изменим атрибут type_ объекта Matroskin на dog\n",
276-
"Matroskin.type_ = \"dog\" # type: ignore[attr-defined]\n",
275+
"# изменим атрибут type_ объекта matroskin на dog\n",
276+
"matroskin.type_ = \"dog\" # type: ignore[attr-defined]\n",
277277
"\n",
278278
"# выведем этот атрибут\n",
279-
"Matroskin.type_ # type: ignore[attr-defined]"
279+
"matroskin.type_ # type: ignore[attr-defined]"
280280
]
281281
},
282282
{
@@ -329,15 +329,15 @@
329329
},
330330
{
331331
"cell_type": "code",
332-
"execution_count": 3,
332+
"execution_count": null,
333333
"id": "1a7ff7a0",
334334
"metadata": {},
335335
"outputs": [],
336336
"source": [
337-
"Matroskin = CatClass(\"gray\") # type: ignore[call-arg]\n",
337+
"matroskin = CatClass(\"gray\") # type: ignore[call-arg]\n",
338338
"\n",
339339
"# теперь при вызове этого атрибута Питон выдаст ошибку\n",
340-
"# Matroskin.__type_"
340+
"# matroskin.__type_"
341341
]
342342
},
343343
{

python/makarov/chapter_9_oop.py

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,12 @@ def __init__(self) -> None:
2020
# +
2121
# Создание объекта
2222

23-
# создадим объект Matroskin класса CatClass
24-
Matroskin: CatClass = CatClass()
23+
# создадим объект matroskin класса CatClass
24+
matroskin: CatClass = CatClass()
2525
# -
2626

2727
# проверим тип данных созданной переменной
28-
type(Matroskin)
28+
type(matroskin)
2929

3030
# +
3131
# Атрибуты класса
@@ -53,10 +53,10 @@ def __init__(self, color: str) -> None:
5353
# +
5454
# повторно создадим объект класса CatClass
5555
# передав ему параметр цвета шерсти
56-
Matroskin = CatClass("gray") # type: ignore[call-arg]
56+
matroskin = CatClass("gray") # type: ignore[call-arg]
5757

5858
# и выведем атрибуты класса
59-
Matroskin.color, Matroskin.type_ # type: ignore[attr-defined]
59+
matroskin.color, matroskin.type_ # type: ignore[attr-defined]
6060
# -
6161

6262
# # Методы класса
@@ -91,13 +91,13 @@ def info(self) -> None:
9191
# -
9292

9393
# создадим объект
94-
Matroskin = CatClass("gray") # type: ignore[call-arg]
94+
matroskin = CatClass("gray") # type: ignore[call-arg]
9595

9696
# применим метод .meow()
97-
Matroskin.meow() # type: ignore[attr-defined]
97+
matroskin.meow() # type: ignore[attr-defined]
9898

9999
# и метод .info()
100-
Matroskin.info() # type: ignore[attr-defined]
100+
matroskin.info() # type: ignore[attr-defined]
101101

102102
# # Принципы объектно-ориентированного программирования
103103

@@ -116,11 +116,11 @@ def info(self) -> None:
116116
# +
117117
# Причем не просто получить доступ, но и изменить их.
118118

119-
# изменим атрибут type_ объекта Matroskin на dog
120-
Matroskin.type_ = "dog" # type: ignore[attr-defined]
119+
# изменим атрибут type_ объекта matroskin на dog
120+
matroskin.type_ = "dog" # type: ignore[attr-defined]
121121

122122
# выведем этот атрибут
123-
Matroskin.type_ # type: ignore[attr-defined]
123+
matroskin.type_ # type: ignore[attr-defined]
124124

125125
# +
126126
# Способ 1. Один символ подчеркивания указывает на приватный атрибут
@@ -159,10 +159,10 @@ def __init__(self, color: str) -> None:
159159

160160

161161
# +
162-
Matroskin = CatClass("gray") # type: ignore[call-arg]
162+
matroskin = CatClass("gray") # type: ignore[call-arg]
163163

164164
# теперь при вызове этого атрибута Питон выдаст ошибку
165-
# Matroskin.__type_
165+
# matroskin.__type_
166166

167167
# +
168168
# Наследование
@@ -231,8 +231,7 @@ def move(self) -> None:
231231

232232

233233
# снова создадим класс Bird
234-
# pylint: disable=function-redefined
235-
class Bird(Animal): # type: ignore[no-redef]
234+
class Bird(Animal): # type: ignore[no-redef] # pylint: disable=function-redefined
236235
"""Класс птицы со скоростью полета."""
237236

238237
def __init__(self, weight: float, length: float, flying_speed: float) -> None:

0 commit comments

Comments
 (0)