Skip to content

Commit 5e5fb14

Browse files
committed
refactor: use @cached_property for library_key and course_key
1 parent fece3a3 commit 5e5fb14

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

openedx_authz/api/data.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import re
66
from abc import abstractmethod
77
from enum import Enum
8+
from functools import cached_property
89
from typing import Any, ClassVar, Literal, Type
910

1011
from attrs import define
@@ -468,7 +469,7 @@ def library_id(self) -> str:
468469
"""
469470
return self.external_key
470471

471-
@property
472+
@cached_property
472473
def library_key(self) -> LibraryLocatorV2:
473474
"""The LibraryLocatorV2 object for the content library.
474475
@@ -581,7 +582,7 @@ def course_id(self) -> str:
581582
"""
582583
return self.external_key
583584

584-
@property
585+
@cached_property
585586
def course_key(self) -> CourseKey:
586587
"""The CourseKey object for the course.
587588

0 commit comments

Comments
 (0)