Skip to content

Commit b921113

Browse files
committed
make EntitySpec an abstract base class with abstract methods for rendering
1 parent 449a901 commit b921113

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

pyrogram/parser/specs.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from __future__ import annotations
22

3+
from abc import ABC, abstractmethod
34
import html
45
from typing import Dict, Optional
56

@@ -9,7 +10,7 @@
910
from .types import EntityMeta
1011

1112

12-
class EntitySpec:
13+
class EntitySpec(ABC):
1314
entity_type: Optional[enums.MessageEntityType] = None
1415
html_tags: tuple[str, ...] = ()
1516

@@ -39,9 +40,11 @@ def create_entity(
3940
**payload
4041
)
4142

43+
@abstractmethod
4244
def render_html(self, content: str, entity: MessageEntity) -> str:
4345
raise NotImplementedError
4446

47+
@abstractmethod
4548
def render_markdown(self, content: str, entity: MessageEntity) -> str:
4649
raise NotImplementedError
4750

0 commit comments

Comments
 (0)