+annotated-types==0.7.0
certifi==2024.12.14
charset-normalizer==3.4.1
-feedparser==6.0.11
+feedparser==6.0.0
idna==3.10
+iniconfig==2.0.0
+# Editable Git install (nom==0.0.1) with either a deleted local remote or invalid URI:
+# 'git@goddard.local:/srv/git/nom.git'
+-e /home/kyle/projects/nom
+packaging==24.2
+pluggy==1.5.0
+pydantic==2.10.5
+pydantic_core==2.27.2
+pytest==8.3.4
requests==2.32.3
sgmllib3k==1.0.0
+typing_extensions==4.12.2
urllib3==2.3.0
from csv import DictReader, DictWriter, excel_tab
from copy import copy
from pathlib import Path
+from pydantic import BaseModel
from nom.utils import NomError
-class NomListItem:
+class NomListItem(BaseModel):
@abstractmethod
def __hash__(self):
@classmethod
def get_fieldnames(cls):
- return cls.__dataclass_fields__.keys()
+ return cls.__fields__.keys()
# TODO: What if there's a pipe in one of the fields?
def to_str(self, delimiter: str ='|'):
-from dataclasses import dataclass
from pathlib import Path
from typing import Optional
# TODO: Use proper types, not strings. (Pydantic?)
-@dataclass
class EntryListItem(NomListItem):
title: str
url: str
import os
from pathlib import Path
from typing import Optional
-from dataclasses import dataclass
import feedparser
import requests
def __init__(self, feedparsable):
d = feedparser.parse(feedparsable)
self.name = d.feed.title
- self.url = d.feed.link # how is this different from d.feed.link?
+ self.url = d.feed.link
self.entries = d.entries
def to_entrylist(self)->EntryList:
items = []
for e in self.entries:
entry = EntryListItem(
- e.title, e.link, e.updated,
- self.url, "no alias", "False", "no summary")
+ title=e.title,
+ url=e.link,
+ date=e.updated,
+ feed_url=self.url,
+ feed_alias="no alias",
+ viewed="False",
+ summary="no summary")
items.append(entry)
return EntryList(items=items)
-@dataclass
class FeedListItem(NomListItem):
url: str