Skip to content

Commit

Permalink
Merge branch 'main' into 1.1.1rc0
Browse files Browse the repository at this point in the history
  • Loading branch information
swcurran authored Dec 2, 2024
2 parents 9a3e93a + 389e9d2 commit f8ebb2c
Show file tree
Hide file tree
Showing 5 changed files with 118 additions and 117 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ repos:
additional_dependencies: ['@commitlint/config-conventional']
- repo: https://github.com/astral-sh/ruff-pre-commit
# Ensure this is synced with pyproject.toml
rev: v0.8.0
rev: v0.8.1
hooks:
# Run the linter
- id: ruff
Expand Down
13 changes: 8 additions & 5 deletions acapy_agent/utils/classloader.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,18 +181,21 @@ def scan_subpackages(cls, package: str) -> Sequence[str]:
class DeferLoad:
"""Helper to defer loading of a class definition."""

_class_cache = {} # Shared cache for resolved classes

def __init__(self, cls_path: str):
"""Initialize the `DeferLoad` instance with a qualified class path."""
self._cls_path = cls_path
self._inst = None

def __call__(self, *args, **kwargs):
"""Magic method to call the `DeferLoad` as a function."""
return (self.resolved)(*args, **kwargs)
return self.resolved(*args, **kwargs)

@property
def resolved(self):
"""Accessor for the resolved class instance."""
if not self._inst:
self._inst = ClassLoader.load_class(self._cls_path)
return self._inst
if self._cls_path not in DeferLoad._class_cache:
DeferLoad._class_cache[self._cls_path] = ClassLoader.load_class(
self._cls_path
)
return DeferLoad._class_cache[self._cls_path]
2 changes: 1 addition & 1 deletion mkdocs-requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@

mkdocs-material==9.5.46
mkdocs-material==9.5.47
mike==2.1.3
Loading

0 comments on commit f8ebb2c

Please sign in to comment.