Skip to content

1. Жажин Владислав Артемович. 613 - #54

Open
2016pac wants to merge 14 commits into
python-department:mainfrom
2016pac:main
Open

2016pac wants to merge 14 commits into
python-department:mainfrom
2016pac:main

Conversation

@2016pac

@2016pac 2016pac commented Sep 25, 2026

Copy link
Copy Markdown

No description provided.

@github-actions github-actions Bot added the 613 label Sep 25, 2026
Comment thread src/part2/cart.py Outdated

from .crud import read_product, update_product # noqa: F401
from .storage import ( # noqa: F401
from crud import read_product, update_product

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Не проходит mypy и ruff

Comment thread src/part2/cart.py
"""
# TODO: реализуйте функцию
return (0, 0)
prod = read_product(storage, product_id)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Лучше не экономить строки и оставлять пробелы (пустые строки) между логическими блоками. Так читабельность кода улучшается.

Comment thread src/part2/crud.py Outdated
# TODO: реализуйте функцию
return (0, "", Decimal(0), 0)
for i in range(len(storage)):
if storage[i][PRODUCT_ID_INDEX] is product_id:

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Если значения id у вас будут большими, то is уже не будет проходить, так как is сравнивает, что объект один и тот же, а не равен

Comment thread src/part2/crud.py Outdated
# TODO: реализуйте функцию
return (0, "", Decimal(0), 0)
for i in range(len(storage)):
if storage[i][PRODUCT_ID_INDEX] is product_id:

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Этот цикл встречается несколько раз, лучше было бы поиск вынести в отдельную функцию.
Пункт S1

Comment thread src/part3/crud.py Outdated
from decimal import Decimal

from .storage import ( # noqa: F401
from storage import (

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Не проходят ruff и mypy

Comment thread src/part3/crud.py
# TODO: реализуйте функцию
return 0
def create_product(storage: list[Product], fields: tuple[str, Decimal, int]) -> int | None:
fields = (normalize_product_name(fields[0]), fields[1], fields[2])

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Магические константы
Пункт S3

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants