-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathpost.py
34 lines (27 loc) · 1.01 KB
/
post.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
"""Module for class definition of a post"""
class Post:
"""Represents a post
Args:
post_id (int): The number of the post_id
title (str): The title of the post
message (str): The text message of the post
original_poster (obj): The original poster object
"""
def __init__(self, post_id, title, message, original_poster) -> None:
self.post_id = post_id
self.title = title
self.message = message
self.original_poster = original_poster
def edit_post(self, new_title, new_message):
"""Edit a post
Args:
new_title (_type_): _description_
new_message (_type_): _description_
"""
self.title = new_title
self.message = new_message
def show_post(self):
"""Show a post"""
print(
f"Title: {self.title} \nMessage: {self.message} \n written by: {self.original_poster.name}. Tell them what you think at: {self.original_poster.email}\n" # noqa: E501
)