Skip to content

3. Устинов Семён Михайлович. 614 - #112

Open
SimencaSs wants to merge 19 commits into
python-department:mainfrom
SimencaSs:completed-task-3
Open

SimencaSs wants to merge 19 commits into
python-department:mainfrom
SimencaSs:completed-task-3

Conversation

@SimencaSs

Copy link
Copy Markdown

No description provided.

@github-actions github-actions Bot added the 614 label Oct 9, 2026
Comment thread src/part3/crud.py
for i, product in enumerate(storage):
if product[PRODUCT_ID_INDEX] == product_id:
index = i
break

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Можно было бы сразу вывести на экран нужное сообщение об ошибке и выйти из функции с помощью return вместо прерывания выполнения цикла

Comment thread src/part3/run_admin.py

command = words[0]

if command == "help" and len(words) == 1:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Здесь следовало бы использовать match-case, т.к. эта конструкция лучше подходит для сопоставления шаблонов. Из-за использования ветвления логика проверки количества слов в команде дублируется. Это нарушение критерия S1. Минус балл

Comment thread src/part3/run_admin.py
return True
name = " ".join(words[1:-2])
price = Decimal(words[-2])
quantity = int(words[-1])

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Нарушение критерия S3. Минус балл

Comment thread src/part3/utils.py
+ "|".join(f" {cell:<{width}} " for cell, width in zip(TABLE_HEADERS, widths))
+ "|"
)
dop_line = "|" + "|".join("-" * (width + 2) for width in widths) + "|"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Нарушение критерия T8. Минус 0,25 балла

Comment thread src/part3/utils.py
"""
# TODO: реализуйте функцию
return ""
rows: list[tuple[str, str, str, str]] = [

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Здесь не нужная явная аннотация типа. MyPy должен вывести аннотацию типа самостоятельно по значению в правой части

Comment thread src/part3/utils.py
return " ".join(name.split()).lower()


def get_storage_str_representation(storage: list[Product]) -> str:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Функция нарушает принцип единой ответственности: содержит и логику вычисления ширины столбца, и и логику форматирования строк.

Нарушение критерия S2. Минус балл

Comment thread src/part3/utils.py
+ "|".join(f" {cell:<{width}} " for cell, width in zip(TABLE_HEADERS, widths))
+ "|"
)
dop_line = "|" + "|".join("-" * (width + 2) for width in widths) + "|"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Не используйте транслитерацию для именования переменных. В будущем ваш код могут читать не только русскоговорящие разработчики, поэтому следует использовать валидные английские слова для именования переменных

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants