Skip to content

Commit

Permalink
removed caching, added some comments.
Browse files Browse the repository at this point in the history
  • Loading branch information
grdn1337 committed Apr 6, 2022
1 parent 66adb45 commit 3acc567
Show file tree
Hide file tree
Showing 3 changed files with 67 additions and 133 deletions.
104 changes: 52 additions & 52 deletions pypaperless/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,119 +5,119 @@


class Correspondent:
"""Class that represents a Light object in the ExampleHub API."""
"""Class that represents a correspondent object in the paperless API."""

def __init__(self, raw_data: dict, auth: Auth):
"""Initialize a light object."""
"""Initialize a correspondent object."""
self.raw_data = raw_data
self.auth = auth

@property
def id(self) -> int:
"""Return the count."""
"""Return the id."""
return self.raw_data["id"]

@property
def slug(self) -> str:
"""Return the count."""
"""Return the slug."""
return self.raw_data["slug"]

@property
def name(self) -> str:
"""Return the count."""
"""Return the name."""
return self.raw_data["name"]

@property
def match(self) -> str:
"""Return the count."""
"""Return the match."""
return self.raw_data["match"]

@property
def matching_algorithm(self) -> int:
"""Return the count."""
"""Return the matching_algorithm."""
return self.raw_data["matching_algorithm"]

@property
def is_insensitive(self) -> bool:
"""Return the count."""
"""Return the is_insensitive flag."""
return self.raw_data["is_insensitive"]

@property
def document_count(self) -> int:
"""Return the count."""
"""Return the document_count."""
return self.raw_data["document_count"]

@property
def last_correspondence(self) -> datetime:
"""Return the count."""
"""Return the last_correspondence date."""
return self.raw_data["last_correspondence"]


class DocumentType:
"""Class that represents a Light object in the ExampleHub API."""
"""Class that represents a document type object in the paperless API."""

def __init__(self, raw_data: dict, auth: Auth):
"""Initialize a light object."""
"""Initialize a document type object."""
self.raw_data = raw_data
self.auth = auth

@property
def id(self) -> int:
"""Return the count."""
"""Return the id."""
return self.raw_data["id"]

@property
def slug(self) -> str:
"""Return the count."""
"""Return the slug."""
return self.raw_data["slug"]

@property
def name(self) -> str:
"""Return the count."""
"""Return the name."""
return self.raw_data["name"]

@property
def match(self) -> str:
"""Return the count."""
"""Return the match."""
return self.raw_data["match"]

@property
def matching_algorithm(self) -> int:
"""Return the count."""
"""Return the matching_algorithm."""
return self.raw_data["matching_algorithm"]

@property
def is_insensitive(self) -> bool:
"""Return the count."""
"""Return the is_insensitive flag."""
return self.raw_data["is_insensitive"]

@property
def document_count(self) -> int:
"""Return the count."""
"""Return the document_count."""
return self.raw_data["document_count"]


class Tag:
"""Class that represents a Light object in the ExampleHub API."""
"""Class that represents a tag object in the paperless API."""

def __init__(self, raw_data: dict, auth: Auth):
"""Initialize a light object."""
"""Initialize a tag object."""
self.raw_data = raw_data
self.auth = auth

@property
def id(self) -> int:
"""Return the count."""
"""Return the id."""
return self.raw_data["id"]

@property
def slug(self) -> str:
"""Return the count."""
"""Return the slug."""
return self.raw_data["slug"]

@property
def name(self) -> str:
"""Return the count."""
"""Return the name."""
return self.raw_data["name"]

@property
Expand All @@ -127,138 +127,138 @@ def colour(self) -> int:

@property
def match(self) -> str:
"""Return the count."""
"""Return the match."""
return self.raw_data["match"]

@property
def matching_algorithm(self) -> int:
"""Return the count."""
"""Return the matching_algorithm."""
return self.raw_data["matching_algorithm"]

@property
def is_insensitive(self) -> bool:
"""Return the count."""
"""Return the is_insensitive flag."""
return self.raw_data["is_insensitive"]

@property
def is_inbox_tag(self) -> bool:
"""Return the count."""
"""Return the is_inbox_tag flag."""
return self.raw_data["is_inbox_tag"]

@property
def document_count(self) -> int:
"""Return the count."""
"""Return the document_count."""
return self.raw_data["document_count"]


class SavedView:
"""Class that represents a Light object in the ExampleHub API."""
"""Class that represents a saved view object in the paperless API."""

def __init__(self, raw_data: dict, auth: Auth):
"""Initialize a light object."""
"""Initialize a saved view object."""
self.raw_data = raw_data
self.auth = auth

@property
def id(self) -> int:
"""Return the count."""
"""Return the id."""
return self.raw_data["id"]

@property
def name(self) -> str:
"""Return the count."""
"""Return the name."""
return self.raw_data["name"]

@property
def show_on_dashboard(self) -> bool:
"""Return the count."""
"""Return the show_on_dashboard flag."""
return self.raw_data["show_on_dashboard"]

@property
def show_in_sidebar(self) -> bool:
"""Return the count."""
"""Return the show_in_sidebar flag."""
return self.raw_data["show_in_sidebar"]

@property
def sort_field(self) -> str:
"""Return the count."""
"""Return the sort_field."""
return self.raw_data["sort_field"]

@property
def sort_reverse(self) -> bool:
"""Return the count."""
"""Return the sort_reverse flag."""
return self.raw_data["sort_reverse"]

@property
def filter_rules(self) -> List[dict]:
"""Return the count."""
"""Return the filter_rules dict."""
return self.raw_data["filter_rules"]


class Document:
"""Class that represents a Light object in the ExampleHub API."""
"""Class that represents a document object in the paperless API."""

def __init__(self, raw_data: dict, auth: Auth):
"""Initialize a light object."""
"""Initialize a document object."""
self.raw_data = raw_data
self.auth = auth

@property
def id(self) -> int:
"""Return the count."""
"""Return the id."""
return self.raw_data["id"]

@property
def correspondent(self) -> int:
"""Return the count."""
"""Return the correspondent id."""
return self.raw_data["correspondent"]

@property
def document_type(self) -> int:
"""Return the count."""
"""Return the document_type id."""
return self.raw_data["document_type"]

@property
def title(self) -> str:
"""Return the count."""
"""Return the title."""
return self.raw_data["title"]

@property
def content(self) -> str:
"""Return the count."""
"""Return the content."""
return self.raw_data["content"]

@property
def tags(self) -> List[int]:
"""Return the count."""
"""Return the list of mapped tags."""
return self.raw_data["tags"]

@property
def created(self) -> datetime:
"""Return the count."""
"""Return the created date."""
return self.raw_data["created"]

@property
def modified(self) -> datetime:
"""Return the count."""
"""Return the modified date."""
return self.raw_data["modified"]

@property
def added(self) -> datetime:
"""Return the count."""
"""Return the added date."""
return self.raw_data["added"]

@property
def archive_serial_number(self) -> str:
"""Return the count."""
"""Return the archive_serial_number."""
return self.raw_data["archive_serial_number"]

@property
def original_file_name(self) -> str:
"""Return the count."""
"""Return the original_file_name."""
return self.raw_data["original_file_name"]

@property
def archived_file_name(self) -> str:
"""Return the count."""
"""Return the archived_file_name."""
return self.raw_data["archived_file_name"]
Loading

0 comments on commit 3acc567

Please sign in to comment.