Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DWI-34 Module and Function Documentation #11

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions aim/digifeeds/item.py
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"]