Skip to content

Commit

Permalink
Removed one @cache to avoid potential issues. Also removed some comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Panchenko committed Jun 6, 2024
1 parent 186425f commit 93e1554
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
3 changes: 1 addition & 2 deletions src/penai/models.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from copy import deepcopy
from dataclasses import dataclass, field
from functools import cache, cached_property
from functools import cached_property
from pathlib import Path
from typing import Generic, Self, TypeVar
from uuid import UUID
Expand Down Expand Up @@ -100,7 +100,6 @@ class PenpotComponentDict(dict[str, PenpotComponent]):
def get_component_names(self) -> list[str]:
return [component.name for component in self.values()]

@cache
def get_by_name(self, name: str) -> PenpotComponent:
# This can definitely be implemented more efficiently but since the number
# of components per file is typically very small, this shouldn't become
Expand Down
2 changes: 0 additions & 2 deletions src/penai/svg.py
Original file line number Diff line number Diff line change
Expand Up @@ -579,11 +579,9 @@ def _get_shapes_by_attr(
)
return matched_shapes[0]

# @cache
def get_shape_by_name(self, name: str) -> PenpotShapeElement:
return self._get_shapes_by_attr("name", name, should_be_unique=True)

# @cache
def get_shape_by_id(self, shape_id: str) -> PenpotShapeElement:
return self._get_shapes_by_attr("shape_id", shape_id, should_be_unique=True)

Expand Down
4 changes: 3 additions & 1 deletion src/penai/utils/svg.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,9 @@ def validate_uri(x: Any) -> bool:

@contextmanager
def temp_file_for_content(
content: str | bytes, extension: str, delete: bool = False
content: str | bytes,
extension: str,
delete: bool = False,
) -> Generator[Path, Any, Any]:
"""Create a temporary file for a given file content."""
if extension and not extension.startswith("."):
Expand Down

0 comments on commit 93e1554

Please sign in to comment.