Skip to content

Commit d50db48

Browse files
rename component and asset registries (#86)
1 parent 3d6c035 commit d50db48

File tree

4 files changed

+11
-7
lines changed

4 files changed

+11
-7
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ and this project attempts to adhere to [Semantic Versioning](https://semver.org/
1818

1919
## [Unreleased]
2020

21+
### Changed
22+
23+
- **Internal**: Renamed Component and Asset registries.
24+
2125
## [0.7.2]
2226

2327
### Changed

src/django_bird/components.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ def from_name(cls, name: str):
3636
return cls(name=name, template=template, assets=assets)
3737

3838

39-
class Registry:
39+
class ComponentRegistry:
4040
def __init__(self, maxsize: int = 100):
4141
self._cache: LRUCache[str, Component] = LRUCache(maxsize=maxsize)
4242

@@ -54,4 +54,4 @@ def clear(self) -> None:
5454
self._cache.clear()
5555

5656

57-
components = Registry()
57+
components = ComponentRegistry()

src/django_bird/staticfiles.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ def get_template_assets(template: DjangoTemplate):
5959

6060

6161
@dataclass
62-
class ComponentAssetRegistry:
62+
class AssetRegistry:
6363
components: set[Component] = field(default_factory=set)
6464

6565
def clear(self) -> None:
@@ -76,4 +76,4 @@ def get_assets(self, asset_type: AssetType) -> list[Asset]:
7676
return assets
7777

7878

79-
assets = ComponentAssetRegistry()
79+
assets = AssetRegistry()

tests/test_components.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from django.test import override_settings
77

88
from django_bird.components import Component
9-
from django_bird.components import Registry
9+
from django_bird.components import ComponentRegistry
1010
from django_bird.staticfiles import Asset
1111
from django_bird.staticfiles import AssetType
1212

@@ -64,10 +64,10 @@ def test_from_name_with_partial_assets(
6464
assert Asset(file, expected_asset_type) in comp.assets
6565

6666

67-
class TestRegistry:
67+
class TestComponentRegistry:
6868
@pytest.fixture
6969
def registry(self):
70-
return Registry(maxsize=2)
70+
return ComponentRegistry(maxsize=2)
7171

7272
def test_get_component_caches(self, registry, create_bird_template):
7373
create_bird_template(name="button", content="<button>Click me</button>")

0 commit comments

Comments
 (0)