diff --git a/src/posit/connect/content.py b/src/posit/connect/content.py index c7d5f203..4d3a8227 100644 --- a/src/posit/connect/content.py +++ b/src/posit/connect/content.py @@ -347,17 +347,17 @@ def environment_variables(self) -> EnvVars: def permissions(self) -> Permissions: return Permissions(context_to_resource_parameters(self._ctx), self["guid"]) - _owner: User - @property def owner(self) -> dict: - if "_owner" not in self.__dict__: + if not hasattr(self, "_owner"): # It is possible to get a content item that does not contain owner. # "owner" is an optional additional request param. # If it's not included, we can retrieve the information by `owner_guid` from .users import Users - self._owner = Users(context_to_resource_parameters(self._ctx)).get(self["owner_guid"]) + self._owner: User = Users(context_to_resource_parameters(self._ctx)).get( + self["owner_guid"] + ) return self._owner @property diff --git a/src/posit/connect/jobs.py b/src/posit/connect/jobs.py index c46a233f..bf4a2ccf 100644 --- a/src/posit/connect/jobs.py +++ b/src/posit/connect/jobs.py @@ -289,7 +289,7 @@ def jobs(self: ContentItemP) -> Jobs: """ # Do not cache result. `content.jobs` should always return the latest jobs. - # if self.__dict__.get("_jobs") is not None: + # if hasattr(self, "_jobs"): # # Early return # return self._jobs diff --git a/src/posit/connect/vanities.py b/src/posit/connect/vanities.py index c1c7b552..22967c14 100644 --- a/src/posit/connect/vanities.py +++ b/src/posit/connect/vanities.py @@ -157,7 +157,7 @@ class ContentItemVanityMixin: @property def vanity(self: ContentItemVanityP) -> str | None: """Get the vanity.""" - if "_vanity" in self.__dict__ and self._vanity: + if hasattr(self, "_vanity") and self._vanity: return self._vanity["path"] try: