generated from mlibrary/python-starter
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
26 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,36 @@ | ||
class Item: | ||
"""A Digifeeds Item | ||
An item to be processed by the Digifeeds process. | ||
Attributes: | ||
data: ? | ||
""" | ||
|
||
def __init__(self, data: dict) -> None: | ||
"""Initializes the instance with data argument. | ||
Args: | ||
data (dict): ? | ||
""" | ||
self.data = data | ||
|
||
def has_status(self, status: str) -> bool: | ||
"""The status of this Digifeeds Item. | ||
Args: | ||
status (str): A Digifeeds status. | ||
Returns: | ||
bool: True if Digifeeds item has a status, Fales if Digifeeds item does not have a status. | ||
""" | ||
return any(s["name"] == status for s in self.data["statuses"]) | ||
|
||
@property | ||
def barcode(self) -> str: | ||
"""The barcode of the Digifeeds item. | ||
Returns: | ||
str: The barcode. | ||
""" | ||
return self.data["barcode"] |