mirror of
https://github.com/davegallant/rfd-notify.git
synced 2025-08-06 00:33:39 +00:00
Migrate to python (#265)
* Add initial python migration * Add pylint * Add pre-commit * Add Dockerfile * Add expression matching * Use shelve to store previous matches * Add notifications * Calculate post age * Update README.md
This commit is contained in:
0
rfd_notify/models/__init__.py
Normal file
0
rfd_notify/models/__init__.py
Normal file
8
rfd_notify/models/offer.py
Normal file
8
rfd_notify/models/offer.py
Normal file
@@ -0,0 +1,8 @@
|
||||
class Offer:
|
||||
# pylint: disable=unused-argument
|
||||
def __init__(self, dealer_name, url, **kwargs):
|
||||
self.dealer_name = dealer_name
|
||||
self.url = url
|
||||
|
||||
def __repr__(self):
|
||||
return f"Offer({self.url})"
|
8
rfd_notify/models/post.py
Normal file
8
rfd_notify/models/post.py
Normal file
@@ -0,0 +1,8 @@
|
||||
class Post:
|
||||
# pylint: disable=unused-argument
|
||||
def __init__(
|
||||
self,
|
||||
body: str,
|
||||
**kwargs,
|
||||
):
|
||||
self.body = body
|
23
rfd_notify/models/topic.py
Normal file
23
rfd_notify/models/topic.py
Normal file
@@ -0,0 +1,23 @@
|
||||
from .offer import Offer
|
||||
|
||||
|
||||
class Topic:
|
||||
# pylint: disable=unused-argument
|
||||
# pylint: disable=too-many-arguments
|
||||
def __init__(
|
||||
self,
|
||||
topic_id: int,
|
||||
title: str,
|
||||
post_time: str,
|
||||
web_path: str,
|
||||
offer: dict,
|
||||
**kwargs,
|
||||
):
|
||||
self.topic_id = topic_id
|
||||
self.title = title
|
||||
self.post_time = post_time
|
||||
self.web_path = web_path
|
||||
self.offer = Offer(**offer)
|
||||
|
||||
def __repr__(self):
|
||||
return f"Topic({self.title})"
|
Reference in New Issue
Block a user