Minecon724
209a9e6adc
I legit forgot to commit today and then there was (still kinda is) a thunderstorm and power got rekt it's back online but ssh is broken so kinda sad I'll probably have to fix this
18 lines
No EOL
430 B
Python
18 lines
No EOL
430 B
Python
from dataclasses import dataclass
|
|
from io import TextIOWrapper
|
|
from os import sep
|
|
|
|
@dataclass
|
|
class Article:
|
|
id: str
|
|
title: str
|
|
summary: str
|
|
content: str
|
|
|
|
def read_article_file(file: TextIOWrapper) -> Article:
|
|
id = file.name.split(sep)[-1].split('.')[0]
|
|
title = file.readline().strip()
|
|
summary = file.readline().strip()
|
|
content = file.read().strip()
|
|
|
|
return Article(id, title, summary, content) |