From 1d9a3ded883e69f1a11ce397f05d3e621fc02bf3 Mon Sep 17 00:00:00 2001 From: Christopher Bohn <bohn@unl.edu> Date: Thu, 30 Jul 2020 08:25:45 -0500 Subject: [PATCH] Replaced GitlabIssue.get_state() with is_open() & is_closed() --- api/gitlab_classes.py | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/api/gitlab_classes.py b/api/gitlab_classes.py index a82d3ee..628d5ef 100644 --- a/api/gitlab_classes.py +++ b/api/gitlab_classes.py @@ -1,4 +1,5 @@ from datetime import datetime, date +from deprecated import deprecated from functools import reduce from typing import ClassVar, Dict, Iterable, List, Optional, Set, Union @@ -110,12 +111,25 @@ class GitlabIssue: """ return self.git_issue.description - def get_state(self) -> str: # TODO, deprecate and replace with is_opened & is_closed + @deprecated + def get_state(self) -> str: # TODO, delete after we're sure there are no uses """ :return: opened or closed """ return self.git_issue.state + def is_open(self) -> bool: + """ + :return: True if the issue is open; False if the issue is closed + """ + return self.git_issue.state == 'opened' + + def is_closed(self) -> bool: + """ + :return: True if the issue is closed; False if the issue is open + """ + return self.git_issue.state == 'closed' + def get_created_at(self) -> datetime: """ :return: an "aware" datetime object representing the creation date/time -- GitLab