add linters
This commit is contained in:
@@ -1,13 +1,30 @@
|
||||
"""Базовые протоколы и сериализаторы для рендереров резюме.
|
||||
|
||||
Содержит `ProfileSerializer` для подготовки данных профиля к выводу
|
||||
и протокол `Renderer` с контрактом метода `render`.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from io import BytesIO
|
||||
from typing import Any, Dict, Protocol
|
||||
from typing import Any, Protocol
|
||||
|
||||
|
||||
class ProfileSerializer:
|
||||
"""Сериализатор данных профиля для рендереров."""
|
||||
"""Сериализатор данных профиля для рендереров.
|
||||
|
||||
def serialize(self, profile) -> Dict[str, Any]:
|
||||
Готовит словарь с данными, необходимыми для HTML/PDF/DOCX рендеринга.
|
||||
"""
|
||||
|
||||
def serialize(self, profile: Any) -> dict[str, Any]:
|
||||
"""Собрать слепок профиля для рендеринга.
|
||||
|
||||
Args:
|
||||
profile: Экземпляр модели профиля.
|
||||
|
||||
Returns:
|
||||
dict[str, Any]: Сериализованные поля профиля, контактов, опыта и навыков.
|
||||
"""
|
||||
return {
|
||||
"full_name": profile.full_name,
|
||||
"role": getattr(profile, "role", ""),
|
||||
@@ -25,6 +42,8 @@ class ProfileSerializer:
|
||||
|
||||
|
||||
class Renderer(Protocol):
|
||||
def render(self, profile) -> BytesIO: ...
|
||||
|
||||
"""Протокол рендерера документов с методом `render`."""
|
||||
|
||||
def render(self, profile: Any) -> BytesIO:
|
||||
"""Сгенерировать бинарный документ по профилю."""
|
||||
...
|
||||
|
||||
Reference in New Issue
Block a user